Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 10 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
74 | View Code Duplication | public function jsonUnserialize(array $data) |
|
75 | { |
||
76 | if (!isset($this->data['attachments'])) { |
||
77 | return; |
||
78 | } |
||
79 | |||
80 | for ($i = 0; $i < count($this->data['attachments']); $i++) { |
||
|
|||
81 | $this->data['attachments'][$i] = Attachment::fromData($this->data['attachments'][$i]); |
||
82 | } |
||
83 | } |
||
84 | } |
||
85 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: