| Conditions | 6 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 99 | public function __construct(array $param = []) |
||
| 100 | { |
||
| 101 | parent::__construct($param); |
||
| 102 | $this->rules = [ |
||
| 103 | 'name' => 'required', |
||
| 104 | 'email' => 'email', |
||
| 105 | 'phones' => [ |
||
| 106 | 'required', |
||
| 107 | function ($value) { |
||
| 108 | if (!is_array($value) || empty($value) || count($value) < 1) { |
||
| 109 | return false; |
||
| 110 | } |
||
| 111 | $i = 0; |
||
| 112 | foreach ($value as $item) { |
||
| 113 | if ($item instanceof Phone) { |
||
| 114 | /* @var $item Phone */ |
||
| 115 | $i += (int)$item->validate(); |
||
| 116 | } |
||
| 117 | } |
||
| 118 | return ($i === count($value)); |
||
| 119 | } |
||
| 124 |