First commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace MMT\DDDSharedKernel\ValueObjects;
|
||||
|
||||
class PositiveMoney extends ValueObject
|
||||
{
|
||||
public function __construct(
|
||||
private Money $money
|
||||
)
|
||||
{
|
||||
if($this->money->isNegative()) {
|
||||
throw new \InvalidArgumentException("The value cannot be negative");
|
||||
}
|
||||
}
|
||||
|
||||
public function greaterThan(PositiveMoney $positiveMoney): bool
|
||||
{
|
||||
return $this->money->greaterThan($positiveMoney->money);
|
||||
}
|
||||
|
||||
public function greaterThanOrEqual(PositiveMoney $positiveMoney): bool
|
||||
{
|
||||
return $this->money->greaterThanOrEqual($positiveMoney->money);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user