| Total Complexity | 6 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Page |
||
| 11 | { |
||
| 12 | private $pageId; |
||
| 13 | private $dryState; |
||
| 14 | private $title; |
||
| 15 | private $type; |
||
| 16 | private $icon; |
||
| 17 | |||
| 18 | const TYPE_CULTURE = 'Culture'; |
||
| 19 | |||
| 20 | public function __construct( |
||
| 21 | int $pageId, |
||
| 22 | bool $dryState = false, |
||
| 23 | string $title = null, |
||
| 24 | string $type = null, |
||
| 25 | string $icon = null |
||
| 26 | ) |
||
| 27 | { |
||
| 28 | $this->pageId = $pageId; |
||
| 29 | $this->dryState = $dryState; |
||
| 30 | $this->title = $title; |
||
| 31 | $this->type = $type; |
||
| 32 | $this->icon = $icon; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function pageId():int |
||
| 38 | } |
||
| 39 | |||
| 40 | public function setOnDryState() |
||
| 41 | { |
||
| 42 | $this->dryState = true; |
||
| 43 | app(PageRepository::class)->save($this); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function createCharacteristicAssociated():Characteristic |
||
| 47 | { |
||
| 48 | $type = $this->type === self::TYPE_CULTURE ? Characteristic::FARMING_TYPE : Characteristic::CROPPING_SYSTEM; |
||
| 49 | $characteristic = new Characteristic( |
||
| 50 | Uuid::uuid4(), |
||
| 51 | $type, |
||
| 52 | $this->title, |
||
|
|
|||
| 53 | false, |
||
| 54 | $this->pageId |
||
| 55 | ); |
||
| 56 | $characteristic->create($this->icon); |
||
| 57 | return $characteristic; |
||
| 58 | } |
||
| 59 | |||
| 60 | public function toArray() |
||
| 64 | ]; |
||
| 65 | } |
||
| 66 | } |
||
| 67 |