15 lines
299 B
PHP
15 lines
299 B
PHP
<?php
|
|
|
|
namespace MMT\DDDSharedKernel\ValueObjects;
|
|
|
|
class Price extends ValueObject
|
|
{
|
|
public function __construct(
|
|
private Money $money
|
|
)
|
|
{
|
|
if($this->money->isNegative()) {
|
|
throw new \InvalidArgumentException("The price cannot be negative");
|
|
}
|
|
}
|
|
} |