-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from proophsoftware/feature/init_immutable_record
Init method for immutable records
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Prooph\EventMachineTest\Data\Stubs; | ||
|
||
use Prooph\EventMachine\Data\ImmutableRecord; | ||
use Prooph\EventMachine\Data\ImmutableRecordLogic; | ||
|
||
final class TestDefaultPrice implements ImmutableRecord | ||
{ | ||
use ImmutableRecordLogic; | ||
|
||
/** | ||
* @var TestAmountVO | ||
*/ | ||
private $amount; | ||
|
||
/** | ||
* @var TestCurrencyVO | ||
*/ | ||
private $currency; | ||
|
||
private function init(): void | ||
{ | ||
$this->amount = TestAmountVO::fromFloat(9.99); | ||
$this->currency = TestCurrencyVO::fromString('EUR'); | ||
} | ||
|
||
/** | ||
* @return TestAmountVO | ||
*/ | ||
public function amount(): TestAmountVO | ||
{ | ||
return $this->amount; | ||
} | ||
|
||
/** | ||
* @return null|TestCurrencyVO | ||
*/ | ||
public function currency(): TestCurrencyVO | ||
{ | ||
return $this->currency; | ||
} | ||
|
||
|
||
} |