First commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace MMT\DDDSharedKernel\ValueObjects;
|
||||
|
||||
use MMT\DDDSharedKernel\Interfaces\Commission;
|
||||
|
||||
class FixedCommission extends Commission
|
||||
{
|
||||
public function __construct(
|
||||
public private(set) Money $value
|
||||
)
|
||||
{
|
||||
if($value->isNegative()) {
|
||||
throw new \InvalidArgumentException('The amount of a commission cannot be negative');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyTo(?Money $money = null): Money
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user