@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * @return string |
|
| 58 | + * @return \OAuth\Common\Token\TokenInterface |
|
| 59 | 59 | */ |
| 60 | 60 | public function getAccessToken() |
| 61 | 61 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * @return string |
|
| 66 | + * @return boolean |
|
| 67 | 67 | */ |
| 68 | 68 | public function hasAccessToken() |
| 69 | 69 | { |
@@ -89,6 +89,11 @@ discard block |
||
| 89 | 89 | return $this->get($this->getBaseUrl() . '/' . $id, $this->type); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | + /** |
|
| 93 | + * @param string $url |
|
| 94 | + * @param string $attribute |
|
| 95 | + * @param integer $value |
|
| 96 | + */ |
|
| 92 | 97 | protected function getItemsForAttribute($url, $attribute, $value, $type) |
| 93 | 98 | { |
| 94 | 99 | $data[$attribute] = $value; |
@@ -97,6 +102,9 @@ discard block |
||
| 97 | 102 | ]); |
| 98 | 103 | } |
| 99 | 104 | |
| 105 | + /** |
|
| 106 | + * @param string $url |
|
| 107 | + */ |
|
| 100 | 108 | protected function getItemsForAttributes($url, $data, $type) |
| 101 | 109 | { |
| 102 | 110 | return $this->get($url, $type, [ |
@@ -71,22 +71,22 @@ |
||
| 71 | 71 | |
| 72 | 72 | public function update(IdentifiableInterface $entity, array $options = []) |
| 73 | 73 | { |
| 74 | - return $this->client->put($this->getBaseUrl() . '/' . $entity->getId(), $entity, $options); |
|
| 74 | + return $this->client->put($this->getBaseUrl().'/'.$entity->getId(), $entity, $options); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function patch($id, $data, $type, array $options = []) |
| 78 | 78 | { |
| 79 | - return $this->client->patch($this->getBaseUrl() . '/' . $id, $data, $type, $options); |
|
| 79 | + return $this->client->patch($this->getBaseUrl().'/'.$id, $data, $type, $options); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function delete(IdentifiableInterface $entity, array $options = []) |
| 83 | 83 | { |
| 84 | - return $this->client->delete($this->getBaseUrl() . '/' . $entity->getId(), $entity, $options); |
|
| 84 | + return $this->client->delete($this->getBaseUrl().'/'.$entity->getId(), $entity, $options); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function getID($id) |
| 88 | 88 | { |
| 89 | - return $this->get($this->getBaseUrl() . '/' . $id, $this->type); |
|
| 89 | + return $this->get($this->getBaseUrl().'/'.$id, $this->type); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | protected function getItemsForAttribute($url, $attribute, $value, $type) |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | public function get($resource, $type, $options = []) |
| 61 | 61 | { |
| 62 | 62 | $options['future'] = true; |
| 63 | - return $this->client->get($resource, $options)->then(function (Response $reponse) { |
|
| 63 | + return $this->client->get($resource, $options)->then(function(Response $reponse) { |
|
| 64 | 64 | return $reponse->getBody()->getContents(); |
| 65 | - })->then(function ($content) use ($type) { |
|
| 65 | + })->then(function($content) use ($type) { |
|
| 66 | 66 | return $this->deserialize($content, $type); |
| 67 | 67 | }); |
| 68 | 68 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $options['headers'] = [ |
| 76 | 76 | 'Content-Type' => 'application/json' |
| 77 | 77 | ]; |
| 78 | - return $this->client->post($resource, $options)->then(function (Response $reponse) { |
|
| 78 | + return $this->client->post($resource, $options)->then(function(Response $reponse) { |
|
| 79 | 79 | return $reponse->getBody()->getContents(); |
| 80 | - })->then(function ($content) use ($type) { |
|
| 80 | + })->then(function($content) use ($type) { |
|
| 81 | 81 | return $this->deserialize($content, $type); |
| 82 | 82 | }); |
| 83 | 83 | } |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | $options['headers'] = [ |
| 90 | 90 | 'Content-Type' => 'application/json' |
| 91 | 91 | ]; |
| 92 | - return $this->client->put($resource, $options)->then(function (Response $reponse) { |
|
| 92 | + return $this->client->put($resource, $options)->then(function(Response $reponse) { |
|
| 93 | 93 | return $reponse->getBody()->getContents(); |
| 94 | - })->then(function ($content) use ($type) { |
|
| 94 | + })->then(function($content) use ($type) { |
|
| 95 | 95 | return $this->deserialize($content, $type); |
| 96 | 96 | }); |
| 97 | 97 | } |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | $options['headers'] = [ |
| 104 | 104 | 'Content-Type' => 'application/json' |
| 105 | 105 | ]; |
| 106 | - return $this->client->patch($resource, $options)->then(function (Response $reponse) { |
|
| 106 | + return $this->client->patch($resource, $options)->then(function(Response $reponse) { |
|
| 107 | 107 | return $reponse->getBody()->getContents(); |
| 108 | - })->then(function ($content) use ($type) { |
|
| 108 | + })->then(function($content) use ($type) { |
|
| 109 | 109 | return $this->deserialize($content, $type); |
| 110 | 110 | }); |
| 111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function delete($resource, $type, $options = []) |
| 114 | 114 | { |
| 115 | 115 | $options['future'] = true; |
| 116 | - return $this->client->delete($resource, $options)->then(function (Response $reponse) { |
|
| 116 | + return $this->client->delete($resource, $options)->then(function(Response $reponse) { |
|
| 117 | 117 | return $reponse->json(); |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | if (null === $data || !is_array($data)) { |
| 34 | 34 | throw new TokenResponseException('Unable to parse response.'); |
| 35 | 35 | } elseif (isset($data['error'])) { |
| 36 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 36 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 37 | 37 | } |
| 38 | 38 | $token = new StdOAuth2Token(); |
| 39 | 39 | $token->setAccessToken($data['access_token']); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function mine() |
| 27 | 27 | { |
| 28 | 28 | if ($this->client instanceof AsyncGuzzleAdapter) { |
| 29 | - return $this->userService->current()->then(function ($user) { |
|
| 29 | + return $this->userService->current()->then(function($user) { |
|
| 30 | 30 | return $this->forUser($user); |
| 31 | 31 | }); |
| 32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function acceptMember(Membership $membership, $muted = false) |
| 47 | 47 | { |
| 48 | - return $this->post($this->getBaseUrl() . '/' . $membership->getId(), [ |
|
| 48 | + return $this->post($this->getBaseUrl().'/'.$membership->getId(), [ |
|
| 49 | 49 | 'json' => [ |
| 50 | 50 | 'revision' => $membership->getRevision(), |
| 51 | 51 | 'state' => 'accepted', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function allWithSubtasks(WList $list) |
| 42 | 42 | { |
| 43 | 43 | $tasks = new ArrayList($this->all($list)); |
| 44 | - $tasksWithSubtaks = $tasks->map(function (Task $task) { |
|
| 44 | + $tasksWithSubtaks = $tasks->map(function(Task $task) { |
|
| 45 | 45 | return $task->setSubtasks($this->subtaskService->forTask($task)); |
| 46 | 46 | }); |
| 47 | 47 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | foreach ($lists as $list) { |
| 57 | 57 | $tasks = new ArrayList($this->forList($list)); |
| 58 | - $listTasks = $tasks->filter(function (Task $task) use ($date) { |
|
| 58 | + $listTasks = $tasks->filter(function(Task $task) use ($date) { |
|
| 59 | 59 | if ($task->getDueDate()) { |
| 60 | 60 | $taskDate = Carbon::instance($task->getDueDate()); |
| 61 | 61 | return $taskDate->toDateString() === $date->toDateString(); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | foreach ($lists as $list) { |
| 82 | 82 | $tasks = new ArrayList($this->forList($list)); |
| 83 | - $listTasks = $tasks->filter(function (Task $task) use ($today) { |
|
| 83 | + $listTasks = $tasks->filter(function(Task $task) use ($today) { |
|
| 84 | 84 | if ($task->getDueDate()) { |
| 85 | 85 | $date = Carbon::instance($task->getDueDate()); |
| 86 | 86 | return $date->gt($today); |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | public function accepted() |
| 29 | 29 | { |
| 30 | 30 | $myMemberships = $this->membershipService->mine(); |
| 31 | - $acceptedMemberships = $myMemberships->filter(function (Membership $membership) { |
|
| 31 | + $acceptedMemberships = $myMemberships->filter(function(Membership $membership) { |
|
| 32 | 32 | return $membership->getState() === 'accepted'; |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - $acceptedIDs = $acceptedMemberships->map(function (Membership $acceptedMembership) { |
|
| 35 | + $acceptedIDs = $acceptedMemberships->map(function(Membership $acceptedMembership) { |
|
| 36 | 36 | return $acceptedMembership->getListId(); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | 39 | $allLists = $this->all(); |
| 40 | - $myLists = $allLists->filter(function (WList $list) use ($acceptedIDs) { |
|
| 40 | + $myLists = $allLists->filter(function(WList $list) use ($acceptedIDs) { |
|
| 41 | 41 | return $acceptedIDs->indexOf($list->getId()); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function makePublic(WList $data) |
| 48 | 48 | { |
| 49 | - return $this->patch($this->getBaseUrl() . '/' . $data->getId(), $this->type, [ |
|
| 49 | + return $this->patch($this->getBaseUrl().'/'.$data->getId(), $this->type, [ |
|
| 50 | 50 | 'public' => true |
| 51 | 51 | ]); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function makePrivate(WList $data) |
| 55 | 55 | { |
| 56 | - return $this->patch($this->getBaseUrl() . '/' . $data->getId(), $this->type, [ |
|
| 56 | + return $this->patch($this->getBaseUrl().'/'.$data->getId(), $this->type, [ |
|
| 57 | 57 | 'public' => false |
| 58 | 58 | ]); |
| 59 | 59 | } |