| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | trait HasExpiredFlagHelpers |
||
| 17 | { |
||
| 18 | public function initializeHasExpiredFlagHelpers(): void |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * If entity is expired. |
||
| 25 | * |
||
| 26 | * @return bool |
||
| 27 | */ |
||
| 28 | public function isExpired(): bool |
||
| 29 | { |
||
| 30 | return $this->getAttributeValue('is_expired'); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * If entity is opened. |
||
| 35 | * |
||
| 36 | * @return bool |
||
| 37 | */ |
||
| 38 | public function isUnexpired(): bool |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Mark entity as expired. |
||
| 45 | * |
||
| 46 | * @return void |
||
| 47 | */ |
||
| 48 | public function expire(): void |
||
| 49 | { |
||
| 50 | $this->setAttribute('is_expired', true); |
||
| 51 | $this->save(); |
||
| 52 | |||
| 53 | $this->fireModelEvent('expired', false); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Mark entity as opened. |
||
| 58 | * |
||
| 59 | * @return void |
||
| 60 | */ |
||
| 61 | public function unexpire(): void |
||
| 67 | } |
||
| 68 | } |
||
| 69 |