also looking at this
Bulk folders
#31
3 files
+80
-14
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -116,10 +116,21 @@ class Favorite | ||
| 116 | 116 | */ |
| 117 | 117 | public function delete($id) |
| 118 | 118 | { |
| 119 | if (! is_int($id)) { | |
| 120 | throw new InvalidFormatException(); | |
| 119 | $ids = is_array($id) ? $id : func_get_args(); | |
| 120 | ||
| 121 | foreach ($ids as $id) { | |
| 122 | if (! is_int($id)) { | |
| 123 | throw new InvalidFormatException(); | |
| 124 | } | |
| 121 | 125 | } |
| 122 | 126 | |
| 127 | if (count($ids) > 1) { | |
| 128 | return $this->client->request('POST', 'bulk/favorites/delete', ['favorite_ids' => $ids]); | |
| 129 | } | |
| 130 | ||
| 131 | // If count is equal to 1 get the first element | |
| 132 | $id = $ids[0]; | |
| 133 | ||
| 123 | 134 | return $this->client->request('DELETE', "favorites/{$id}"); |
| 124 | 135 | } |
| 125 | 136 | } |
| @@ -127,10 +127,21 @@ class Tag | ||
| 127 | 127 | */ |
| 128 | 128 | public function delete($id) |
| 129 | 129 | { |
| 130 | if (! is_int($id)) { | |
| 131 | throw new InvalidFormatException(); | |
| 130 | $ids = is_array($id) ? $id : func_get_args(); | |
| 131 | ||
| 132 | foreach ($ids as $id) { | |
| 133 | if (! is_int($id)) { | |
| 134 | throw new InvalidFormatException(); | |
| 135 | } | |
| 132 | 136 | } |
| 133 | 137 | |
| 138 | if (count($ids) > 1) { | |
| 139 | return $this->client->request('POST', 'bulk/tags/delete', ['tag_ids' => $ids]); | |
| 140 | } | |
| 141 | ||
| 142 | // If count is equal to 1 get the first element | |
| 143 | $id = $ids[0]; | |
| 144 | ||
| 134 | 145 | return $this->client->request('DELETE', "tags/{$id}"); |
| 135 | 146 | } |
| 136 | 147 | |