Basic signup for events
This commit is contained in:
16
app/ValueObjects/Age.php
Normal file
16
app/ValueObjects/Age.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\ValueObjects;
|
||||
|
||||
class Age {
|
||||
function __construct(private \DateTime $birthday) {
|
||||
}
|
||||
|
||||
public function getAge() : int {
|
||||
return (new \DateTime())->diff($this->birthday)->y;
|
||||
}
|
||||
|
||||
public function isfullAged() : bool {
|
||||
return $this->getAge() >= 18;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,11 @@ class Amount {
|
||||
$this->amount -= $amount->getAmount();
|
||||
}
|
||||
|
||||
public function multiply(float $factor) : Amount {
|
||||
$this->amount *= $factor;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFormattedAmount() : string {
|
||||
$value = number_format( round( $this->amount, 2 ), 2, ',', '.' );
|
||||
return $value
|
||||
|
||||
Reference in New Issue
Block a user