Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| ContactSegmentEntity | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| getRulesArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| hasRules | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isActive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Modules\ContactModule\Entities; |
| 4 | |
| 5 | use CodeIgniter\Entity\Entity; |
| 6 | |
| 7 | class ContactSegmentEntity extends Entity |
| 8 | { |
| 9 | protected $dates = ['created_at', 'updated_at']; |
| 10 | |
| 11 | protected $casts = [ |
| 12 | 'id' => 'int', |
| 13 | 'rules' => 'json', |
| 14 | 'contacts_count' => 'int', |
| 15 | ]; |
| 16 | |
| 17 | /** |
| 18 | * ========================= |
| 19 | * RULE HELPERS |
| 20 | * ========================= |
| 21 | */ |
| 22 | |
| 23 | public function getRulesArray(): array |
| 24 | { |
| 25 | return $this->attributes['rules'] ?? []; |
| 26 | } |
| 27 | |
| 28 | public function hasRules(): bool |
| 29 | { |
| 30 | return !empty($this->attributes['rules']); |
| 31 | } |
| 32 | |
| 33 | public function isActive(): bool |
| 34 | { |
| 35 | return ($this->attributes['status'] ?? null) === 'active'; |
| 36 | } |
| 37 | } |