Conditions | 5 |
Paths | 2 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
77 | private function getAllInfo() |
||
78 | { |
||
79 | $data = []; |
||
80 | $offset = 0; |
||
81 | while (true) { |
||
82 | $url = $this->_myAnimeListUrl.'/'.$this->_type.'list/'.$this->_user.'/load.json?offset='.$offset.'&status='.$this->_status; |
||
83 | |||
84 | $content = json_decode(file_get_contents($url), true); |
||
85 | |||
86 | if ($content) { |
||
87 | for ($i = 0; $i < count($content); $i++) { |
||
|
|||
88 | if (!empty($content[$i]['anime_image_path'])) { |
||
89 | $content[$i]['anime_image_path'] = Helper::imageUrlCleaner($content[$i]['anime_image_path']); |
||
90 | } else { |
||
91 | $content[$i]['manga_image_path'] = Helper::imageUrlCleaner($content[$i]['manga_image_path']); |
||
92 | } |
||
93 | } |
||
94 | |||
95 | $data = array_merge($data, $content); |
||
96 | |||
97 | $offset += 300; |
||
98 | } else { |
||
99 | break; |
||
100 | } |
||
101 | } |
||
102 | |||
103 | return $data; |
||
104 | } |
||
106 |
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: