| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 8.7414 |
| Changes | 0 | ||
| 1 | <?php |
||
| 62 | 1 | protected function addPhotoFields(array& $fields) |
|
| 63 | { |
||
| 64 | 1 | $count = count($this->photos); |
|
| 65 | 1 | if (!$count) { |
|
| 66 | 1 | return; |
|
| 67 | } |
||
| 68 | |||
| 69 | $index = 0; |
||
| 70 | foreach ($this->photos as $photo) { |
||
| 71 | if (!is_readable($photo)) { |
||
| 72 | throw new Exception("Photo file {$photo} is not readable"); |
||
| 73 | } |
||
| 74 | |||
| 75 | $fields[] = (new Field(AuctionFids::FID_PHOTO + $index, file_get_contents($photo), Field::VALUE_IMAGE))->toArray(); |
||
| 76 | $index++; |
||
| 77 | } |
||
| 78 | } |
||
| 79 | |||
| 81 |