| 1 | <?php |
||
| 11 | class GenericEventBuilder |
||
| 12 | { |
||
| 13 | /** @var DateTime */ |
||
| 14 | private $emittedAt; |
||
| 15 | |||
| 16 | /** @var string */ |
||
| 17 | private $name; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | private $source; |
||
| 21 | |||
| 22 | /** @var array|object */ |
||
| 23 | private $subject; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $name |
||
| 27 | */ |
||
| 28 | public function setMandatoryName($name) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $source |
||
| 35 | */ |
||
| 36 | public function setMandatorySource($source) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param array|object $subject |
||
| 43 | */ |
||
| 44 | public function setMandatorySubject($subject) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param DateTime $emittedAt |
||
| 51 | */ |
||
| 52 | public function setOptionalEmittedAt(DateTime $emittedAt) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return GenericEvent |
||
| 59 | * @throws RuntimeException |
||
| 60 | */ |
||
| 61 | public function build() |
||
| 76 | |||
| 77 | private function reset() |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @throws RuntimeException |
||
| 87 | */ |
||
| 88 | private function throwRuntimeExceptionIfNotAllMandatoryPropertiesAreSet() |
||
| 102 | } |
||
| 103 |