@@ 73-85 (lines=13) @@ | ||
70 | * @return ArrayCollection |
|
71 | * @throws \Exception |
|
72 | */ |
|
73 | public function transformCollection($raw) |
|
74 | { |
|
75 | $collection = new ArrayCollection(); |
|
76 | if (is_object($raw) && isset($raw->albums)) { |
|
77 | foreach ($raw->albums->items as $album) { |
|
78 | $collection->add($this->transformSingle($album)); |
|
79 | } |
|
80 | ||
81 | return $collection; |
|
82 | } |
|
83 | ||
84 | throw new \Exception('Transform failed'); |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Transform to models |
@@ 137-148 (lines=12) @@ | ||
134 | * @return ArrayCollection |
|
135 | * @throws \Exception |
|
136 | */ |
|
137 | public function transformCollection($raw) |
|
138 | { |
|
139 | $collection = new ArrayCollection(); |
|
140 | if (is_object($raw) && isset($raw->artists)) { |
|
141 | foreach ($raw->artists->items as $artist) { |
|
142 | $collection->add($this->transformSingle($artist)); |
|
143 | } |
|
144 | ||
145 | return $collection; |
|
146 | } |
|
147 | throw new \Exception('Transform failed'); |
|
148 | } |
|
149 | ||
150 | /** |
|
151 | * @param $raw |
@@ 71-83 (lines=13) @@ | ||
68 | * @return ArrayCollection |
|
69 | * @throws \Exception |
|
70 | */ |
|
71 | public function transformCollection($raw) |
|
72 | { |
|
73 | $collection = new ArrayCollection(); |
|
74 | if (is_object($raw) && isset($raw->tracks)) { |
|
75 | foreach ($raw->tracks->items as $track) { |
|
76 | $collection->add($this->transformSingle($track)); |
|
77 | } |
|
78 | ||
79 | return $collection; |
|
80 | } |
|
81 | ||
82 | throw new TransformationException('Expected object'); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * @param $raw |