| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | class ValueObjectExample |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public $scalarValue = "lorem ipsum"; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | public $lorem = "ipsum"; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | public $dolor = 123; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var mixed|null |
||
| 35 | */ |
||
| 36 | public $sit; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var mixed|null |
||
| 40 | */ |
||
| 41 | private $amet; |
||
| 42 | |||
| 43 | public function __construct(string $scalarValue, string $lorem = "ipsum", int $dolor = 123) |
||
| 44 | { |
||
| 45 | $this->scalarValue = $scalarValue; |
||
| 46 | $this->lorem = $lorem; |
||
| 47 | $this->dolor = $dolor; |
||
| 48 | } |
||
| 49 | |||
| 50 | public static function createFromJson(string $json) |
||
| 51 | { |
||
| 52 | [$scalarValue, $lorem, $dolor] = json_decode($json, true); |
||
| 53 | |||
| 54 | return new self($scalarValue, $lorem, $dolor); |
||
| 55 | } |
||
| 56 | |||
| 57 | public function serializeJson() |
||
| 58 | { |
||
| 59 | return [$this->scalarValue, $this->lorem, $this->dolor]; |
||
| 60 | } |
||
| 61 | |||
| 62 | public function setAmet($amet) |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getAmet() |
||
| 68 | { |
||
| 73 |