| @@ 86-98 (lines=13) @@ | ||
| 83 | * @return ArrayCollection |
|
| 84 | * @throws \Exception |
|
| 85 | */ |
|
| 86 | public function transformCollection($raw) |
|
| 87 | { |
|
| 88 | $collection = new ArrayCollection(); |
|
| 89 | if (is_object($raw) && isset($raw->albums)) { |
|
| 90 | foreach ($raw->albums->items as $album) { |
|
| 91 | $collection->add($this->transformSingle($album)); |
|
| 92 | } |
|
| 93 | ||
| 94 | return $collection; |
|
| 95 | } |
|
| 96 | ||
| 97 | throw new \Exception('Transform failed'); |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Transform to models |
|
| @@ 153-164 (lines=12) @@ | ||
| 150 | * @return ArrayCollection |
|
| 151 | * @throws \Exception |
|
| 152 | */ |
|
| 153 | public function transformCollection($raw) |
|
| 154 | { |
|
| 155 | $collection = new ArrayCollection(); |
|
| 156 | if (is_object($raw) && isset($raw->artists)) { |
|
| 157 | foreach ($raw->artists->items as $artist) { |
|
| 158 | $collection->add($this->transformSingle($artist)); |
|
| 159 | } |
|
| 160 | ||
| 161 | return $collection; |
|
| 162 | } |
|
| 163 | throw new \Exception('Transform failed'); |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * @param $raw |
|
| @@ 84-96 (lines=13) @@ | ||
| 81 | * @return ArrayCollection |
|
| 82 | * @throws \Exception |
|
| 83 | */ |
|
| 84 | public function transformCollection($raw) |
|
| 85 | { |
|
| 86 | $collection = new ArrayCollection(); |
|
| 87 | if (is_object($raw) && isset($raw->tracks)) { |
|
| 88 | foreach ($raw->tracks->items as $track) { |
|
| 89 | $collection->add($this->transformSingle($track)); |
|
| 90 | } |
|
| 91 | ||
| 92 | return $collection; |
|
| 93 | } |
|
| 94 | ||
| 95 | throw new TransformationException('Expected object'); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * @param $raw |
|