Passed
Push — master ( e5878d...3c0c31 )
by y
01:52
created
src/Task/Attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         'parent' => Task::class
33 33
     ];
34 34
 
35
-    final public function __toString (): string {
35
+    final public function __toString(): string {
36 36
         return "attachments/{$this->getGid()}";
37 37
     }
38 38
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param string $file
45 45
      * @return $this
46 46
      */
47
-    public function upload (string $file) {
47
+    public function upload(string $file) {
48 48
         // api returns compact version. reload.
49 49
         /** @var array $remote */
50 50
         $remote = $this->api->upload($file, "{$this->getParent()}/attachments");
Please login to merge, or discard this patch.
src/Event.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
  */
43 43
 class Event extends Data {
44 44
 
45
-    const ACTION_CHANGED = 'changed';       // no parent
46
-    const ACTION_ADDED = 'added';           // relational, no change
47
-    const ACTION_REMOVED = 'removed';       // relational, no change
48
-    const ACTION_DELETED = 'deleted';       // no parent or change
49
-    const ACTION_UNDELETED = 'undeleted';   // no parent or change
45
+    const ACTION_CHANGED = 'changed'; // no parent
46
+    const ACTION_ADDED = 'added'; // relational, no change
47
+    const ACTION_REMOVED = 'removed'; // relational, no change
48
+    const ACTION_DELETED = 'deleted'; // no parent or change
49
+    const ACTION_UNDELETED = 'undeleted'; // no parent or change
50 50
 
51 51
     const GRAPH = [
52 52
         User::TYPE => User::class,
@@ -71,35 +71,35 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * @return bool
73 73
      */
74
-    final public function wasAddition (): bool {
74
+    final public function wasAddition(): bool {
75 75
         return $this->getAction() === self::ACTION_ADDED;
76 76
     }
77 77
 
78 78
     /**
79 79
      * @return bool
80 80
      */
81
-    final public function wasChange (): bool {
81
+    final public function wasChange(): bool {
82 82
         return $this->getAction() === self::ACTION_CHANGED;
83 83
     }
84 84
 
85 85
     /**
86 86
      * @return bool
87 87
      */
88
-    final public function wasDeletion (): bool {
88
+    final public function wasDeletion(): bool {
89 89
         return $this->getAction() === self::ACTION_DELETED;
90 90
     }
91 91
 
92 92
     /**
93 93
      * @return bool
94 94
      */
95
-    final public function wasRemoval (): bool {
95
+    final public function wasRemoval(): bool {
96 96
         return $this->getAction() === self::ACTION_REMOVED;
97 97
     }
98 98
 
99 99
     /**
100 100
      * @return bool
101 101
      */
102
-    final public function wasUndeletion (): bool {
102
+    final public function wasUndeletion(): bool {
103 103
         return $this->getAction() === self::ACTION_UNDELETED;
104 104
     }
105 105
 
Please login to merge, or discard this patch.
src/Event/Change.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         'new_value*' => Event::GRAPH
31 31
     ];
32 32
 
33
-    protected function _setMapped (string $field, $value): void {
33
+    protected function _setMapped(string $field, $value): void {
34 34
         if (!is_array($value)) {
35 35
             $this->data[$field] = $value;
36 36
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * @return null|number|string|User|Project|Section|Task|FieldEntry|Attachment|Story|Like
44 44
      */
45
-    public function getValue () {
45
+    public function getValue() {
46 46
         $key = [
47 47
             'added' => 'added_value',
48 48
             'removed' => 'removed_value',
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
     protected function _setMapped (string $field, $value): void {
34 34
         if (!is_array($value)) {
35 35
             $this->data[$field] = $value;
36
-        }
37
-        else {
36
+        } else {
38 37
             parent::_setMapped($field, $value);
39 38
         }
40 39
     }
Please login to merge, or discard this patch.
src/Workspace.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     const TYPE = 'workspace';
29 29
 
30
-    final public function __toString (): string {
30
+    final public function __toString(): string {
31 31
         return "workspaces/{$this->getGid()}";
32 32
     }
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return OrganizationExport
38 38
      */
39
-    public function export () {
39
+    public function export() {
40 40
         /** @var OrganizationExport $export */
41 41
         $export = $this->api->factory($this, OrganizationExport::class);
42 42
         return $export->create($this);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param int $limit 1-100
57 57
      * @return array|AbstractEntity[]
58 58
      */
59
-    protected function find (string $class, string $text, int $limit = 20) {
59
+    protected function find(string $class, string $text, int $limit = 20) {
60 60
         return $this->api->loadAll($this, $class, "{$this}/typeahead", [
61 61
             'resource_type' => $class::TYPE,
62 62
             'query' => $text,
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param int $limit 1-100
72 72
      * @return CustomField[]
73 73
      */
74
-    public function findCustomFields (string $text, int $limit = 20) {
74
+    public function findCustomFields(string $text, int $limit = 20) {
75 75
         return $this->find(CustomField::class, $text, $limit);
76 76
     }
77 77
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param int $limit 1-100
83 83
      * @return Portfolio[]
84 84
      */
85
-    public function findPortfolios (string $text, int $limit = 20) {
85
+    public function findPortfolios(string $text, int $limit = 20) {
86 86
         return $this->find(Portfolio::class, $text, $limit);
87 87
     }
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * @param int $limit 1-100
94 94
      * @return Project[]
95 95
      */
96
-    public function findProjects (string $text, int $limit = 20) {
96
+    public function findProjects(string $text, int $limit = 20) {
97 97
         return $this->find(Project::class, $text, $limit);
98 98
     }
99 99
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param int $limit 1-100
105 105
      * @return Tag[]
106 106
      */
107
-    public function findTags (string $text, int $limit = 20) {
107
+    public function findTags(string $text, int $limit = 20) {
108 108
         return $this->find(Tag::class, $text, $limit);
109 109
     }
110 110
 
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
      * @param int $limit 1-100
116 116
      * @return Task[]
117 117
      */
118
-    public function findTasks (string $text, int $limit = 20) {
118
+    public function findTasks(string $text, int $limit = 20) {
119 119
         return $this->find(Task::class, $text, $limit);
120 120
     }
121 121
 
122 122
     /**
123 123
      * @return CustomField[]
124 124
      */
125
-    public function getCustomFields () {
125
+    public function getCustomFields() {
126 126
         return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields");
127 127
     }
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return Portfolio[]
135 135
      */
136
-    public function getPortfolios () {
136
+    public function getPortfolios() {
137 137
         return $this->api->loadAll($this, Portfolio::class, "portfolios", [
138 138
             'workspace' => $this->getGid(),
139 139
             'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required.
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param array $filter
147 147
      * @return Project[]
148 148
      */
149
-    public function getProjects (array $filter = Project::FILTER_ACTIVE) {
149
+    public function getProjects(array $filter = Project::FILTER_ACTIVE) {
150 150
         $filter['workspace'] = $this->getGid();
151 151
         return $this->api->loadAll($this, Project::class, 'projects', $filter);
152 152
     }
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
     /**
155 155
      * @return Tag[]
156 156
      */
157
-    public function getTags () {
157
+    public function getTags() {
158 158
         return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]);
159 159
     }
160 160
 
161 161
     /**
162 162
      * @return Team[]
163 163
      */
164
-    public function getTeams () {
164
+    public function getTeams() {
165 165
         return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams");
166 166
     }
167 167
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param string $email
170 170
      * @return null|User
171 171
      */
172
-    public function getUserByEmail (string $email) {
172
+    public function getUserByEmail(string $email) {
173 173
         return $this->api->getPool()->get("users/{$email}", $this, function() use ($email) {
174 174
             foreach ($this->getUsers() as $user) {
175 175
                 if ($user->getEmail() === $email) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     /**
184 184
      * @return User[]
185 185
      */
186
-    public function getUsers () {
186
+    public function getUsers() {
187 187
         return $this->api->loadAll($this, User::class, "{$this}/users");
188 188
     }
189 189
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      *
193 193
      * @return ProjectWebhook[]|TaskWebhook[]
194 194
      */
195
-    public function getWebhooks () {
195
+    public function getWebhooks() {
196 196
         /** @var array $all */
197 197
         $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']);
198 198
         return array_map(function(array $each) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     /**
210 210
      * @return bool
211 211
      */
212
-    public function isOrganization (): bool {
212
+    public function isOrganization(): bool {
213 213
         return $this->_is('is_organization');
214 214
     }
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      *
219 219
      * @return CustomField
220 220
      */
221
-    public function newCustomField () {
221
+    public function newCustomField() {
222 222
         /** @var CustomField $field */
223 223
         $field = $this->api->factory($this, CustomField::class);
224 224
         return $field->setWorkspace($this);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @return Portfolio
231 231
      */
232
-    public function newPortfolio () {
232
+    public function newPortfolio() {
233 233
         /** @var Portfolio $portfolio */
234 234
         $portfolio = $this->api->factory($this, Portfolio::class);
235 235
         return $portfolio->setWorkspace($this);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      *
241 241
      * @return Project
242 242
      */
243
-    public function newProject () {
243
+    public function newProject() {
244 244
         /** @var Project $project */
245 245
         $project = $this->api->factory($this, Project::class);
246 246
         return $project->setWorkspace($this);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      *
252 252
      * @return Tag
253 253
      */
254
-    public function newTag () {
254
+    public function newTag() {
255 255
         /** @var Tag $tag */
256 256
         $tag = $this->api->factory($this, Tag::class);
257 257
         return $tag->setWorkspace($this);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      *
263 263
      * @return Task
264 264
      */
265
-    public function newTask () {
265
+    public function newTask() {
266 266
         /** @var Task $task */
267 267
         $task = $this->api->factory($this, Task::class);
268 268
         return $task->setWorkspace($this);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param callable $filter `fn( CustomField $field ): bool`
273 273
      * @return CustomField[]
274 274
      */
275
-    public function selectCustomFields (callable $filter) {
275
+    public function selectCustomFields(callable $filter) {
276 276
         return $this->_select($this->getCustomFields(), $filter);
277 277
     }
278 278
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * @param callable $filter `fn( Portfolio $portfolio ): bool`
281 281
      * @return Portfolio[]
282 282
      */
283
-    public function selectPortfolios (callable $filter) {
283
+    public function selectPortfolios(callable $filter) {
284 284
         return $this->_select($this->getPortfolios(), $filter);
285 285
     }
286 286
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      * @param callable $filter `fn( Project $project ): bool`
289 289
      * @return Project[]
290 290
      */
291
-    public function selectProjects (callable $filter) {
291
+    public function selectProjects(callable $filter) {
292 292
         return $this->_select($this->getProjects([]), $filter);
293 293
     }
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      * @param callable $filter `fn( Tag $tag ): bool`
297 297
      * @return Tag[]
298 298
      */
299
-    public function selectTags (callable $filter) {
299
+    public function selectTags(callable $filter) {
300 300
         return $this->_select($this->getTags(), $filter);
301 301
     }
302 302
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param callable $filter `fn( Team $team ): bool`
305 305
      * @return Team[]
306 306
      */
307
-    public function selectTeams (callable $filter) {
307
+    public function selectTeams(callable $filter) {
308 308
         return $this->_select($this->getTeams(), $filter);
309 309
     }
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param callable $filter
313 313
      * @return User[]
314 314
      */
315
-    public function selectUsers (callable $filter) {
315
+    public function selectUsers(callable $filter) {
316 316
         return $this->_select($this->getUsers(), $filter);
317 317
     }
318 318
 }
319 319
\ No newline at end of file
Please login to merge, or discard this patch.
src/User/TaskList.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         'workspace' => Workspace::class
32 32
     ];
33 33
 
34
-    final public function __toString (): string {
34
+    final public function __toString(): string {
35 35
         return "user_task_lists/{$this->getGid()}";
36 36
     }
37 37
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
      * @param array $filter
40 40
      * @return Traversable|Task[]
41 41
      */
42
-    public function getIterator (array $filter = []) {
42
+    public function getIterator(array $filter = []) {
43 43
         return $this->api->loadEach($this, Task::class, "{$this}/tasks");
44 44
     }
45 45
 
46
-    public function getPoolKeys () {
46
+    public function getPoolKeys() {
47 47
         $keys = parent::getPoolKeys();
48 48
 
49 49
         /** @see User::getTaskList() */
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param array $filter
61 61
      * @return Task[]
62 62
      */
63
-    public function getTasks (array $filter = []) {
63
+    public function getTasks(array $filter = []) {
64 64
         return iterator_to_array($this->getIterator($filter));
65 65
     }
66 66
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param array $apiFilter Given to the API to reduce network load.
70 70
      * @return Task[]
71 71
      */
72
-    public function selectTasks (callable $filter, array $apiFilter) {
72
+    public function selectTasks(callable $filter, array $apiFilter) {
73 73
         return $this->_select($this->getIterator($apiFilter), $filter);
74 74
     }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/CustomField.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
         'enum_options' => [EnumOption::class],
41 41
     ];
42 42
 
43
-    final public function __toString (): string {
43
+    final public function __toString(): string {
44 44
         return "custom_fields/{$this->getGid()}";
45 45
     }
46 46
 
47
-    final protected function _getDir (): string {
47
+    final protected function _getDir(): string {
48 48
         return 'custom_fields';
49 49
     }
50 50
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $name
57 57
      * @return EnumOption
58 58
      */
59
-    public function addEnumOption (string $name) {
59
+    public function addEnumOption(string $name) {
60 60
         /** @var EnumOption $option */
61 61
         $option = $this->api->factory($this, EnumOption::class);
62 62
         $option->setName($name);
@@ -72,35 +72,35 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @return bool
74 74
      */
75
-    public function hasNotificationsEnabled (): bool {
75
+    public function hasNotificationsEnabled(): bool {
76 76
         return $this->_is('has_notifications_enabled');
77 77
     }
78 78
 
79 79
     /**
80 80
      * @return bool
81 81
      */
82
-    final public function isEnum (): bool {
82
+    final public function isEnum(): bool {
83 83
         return $this->getResourceSubtype() === self::TYPE_ENUM;
84 84
     }
85 85
 
86 86
     /**
87 87
      * @return bool
88 88
      */
89
-    public function isGlobalToWorkspace (): bool {
89
+    public function isGlobalToWorkspace(): bool {
90 90
         return $this->_is('is_global_to_workspace');
91 91
     }
92 92
 
93 93
     /**
94 94
      * @return bool
95 95
      */
96
-    final public function isNumber (): bool {
96
+    final public function isNumber(): bool {
97 97
         return $this->getResourceSubtype() === self::TYPE_NUMBER;
98 98
     }
99 99
 
100 100
     /**
101 101
      * @return bool
102 102
      */
103
-    final public function isText (): bool {
103
+    final public function isText(): bool {
104 104
         return $this->getResourceSubtype() === self::TYPE_TEXT;
105 105
     }
106 106
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param bool $flag
109 109
      * @return $this
110 110
      */
111
-    public function setGlobalToWorkspace (bool $flag) {
111
+    public function setGlobalToWorkspace(bool $flag) {
112 112
         return $this->_set('is_global_to_workspace', $flag);
113 113
     }
114 114
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param bool $flag
117 117
      * @return $this
118 118
      */
119
-    public function setNotificationsEnabled (bool $flag) {
119
+    public function setNotificationsEnabled(bool $flag) {
120 120
         return $this->_set('has_notifications_enabled', $flag);
121 121
     }
122 122
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int`
125 125
      * @return $this
126 126
      */
127
-    public function sortEnumOptions (callable $cmp) {
127
+    public function sortEnumOptions(callable $cmp) {
128 128
         if ($options = $this->getEnumOptions()) {
129 129
             $prev = $options[0]; // first option on remote
130 130
             usort($options, $cmp);
Please login to merge, or discard this patch.
src/Project/Status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
      * @param Project $project
52 52
      * @param array $data
53 53
      */
54
-    public function __construct (Project $project, array $data = []) {
54
+    public function __construct(Project $project, array $data = []) {
55 55
         parent::__construct($project, $data);
56 56
         $this->project = $project;
57 57
     }
58 58
 
59
-    final public function __toString (): string {
59
+    final public function __toString(): string {
60 60
         return "project_statuses/{$this->getGid()}";
61 61
     }
62 62
 
63
-    final protected function _getDir (): string {
63
+    final protected function _getDir(): string {
64 64
         return "{$this->project}/project_statuses";
65 65
     }
66 66
 
67
-    protected function _setData (array $data): void {
67
+    protected function _setData(array $data): void {
68 68
         // redundant, prefer created_by
69 69
         unset($data['author']);
70 70
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @return Project
76 76
      */
77
-    public function getProject () {
77
+    public function getProject() {
78 78
         return $this->project;
79 79
     }
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
src/Project/Section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         'project' => Project::class
31 31
     ];
32 32
 
33
-    final public function __toString (): string {
33
+    final public function __toString(): string {
34 34
         return "sections/{$this->getGid()}";
35 35
     }
36 36
 
37
-    final protected function _getDir (): string {
37
+    final protected function _getDir(): string {
38 38
         return "{$this->getProject()}/sections";
39 39
     }
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param array $filter
43 43
      * @return Traversable|Task[]
44 44
      */
45
-    public function getIterator (array $filter = []) {
45
+    public function getIterator(array $filter = []) {
46 46
         $filter['section'] = $this->getGid();
47 47
         return $this->api->loadEach($this, Task::class, 'tasks', $filter);
48 48
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param array $filter
52 52
      * @return Task[]
53 53
      */
54
-    public function getTasks (array $filter = []) {
54
+    public function getTasks(array $filter = []) {
55 55
         return iterator_to_array($this->getIterator($filter));
56 56
     }
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @depends after-create
62 62
      * @return Task
63 63
      */
64
-    public function newTask () {
64
+    public function newTask() {
65 65
         /** @var Task $task */
66 66
         $task = $this->api->factory($this, Task::class);
67 67
         return $task->addToProject($this);
Please login to merge, or discard this patch.
src/Api.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $token
49 49
      * @param Pool|null $pool
50 50
      */
51
-    public function __construct (string $token, Pool $pool = null) {
51
+    public function __construct(string $token, Pool $pool = null) {
52 52
         $this->token = $token;
53 53
         $this->pool = $pool ?? new Pool();
54 54
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @return null|array
63 63
      * @internal
64 64
      */
65
-    protected function _exec (string $method, string $path, array $curlOpts = []) {
65
+    protected function _exec(string $method, string $path, array $curlOpts = []) {
66 66
         $log = $this->getLog();
67 67
         $log->log(LOG_DEBUG, "{$method} {$path}", $curlOpts);
68 68
         /** @var resource $ch */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @return string
114 114
      * @internal
115 115
      */
116
-    protected function _getPath (string $path, array $query): string {
116
+    protected function _getPath(string $path, array $query): string {
117 117
         if ($query) {
118 118
             return $path . '?' . http_build_query($query);
119 119
         }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      * @return array
126 126
      * @internal
127 127
      */
128
-    protected function _jsonDecode (string $json) {
129
-        return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
128
+    protected function _jsonDecode(string $json) {
129
+        return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
130 130
     }
131 131
 
132 132
     /**
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      * @return string
135 135
      * @internal
136 136
      */
137
-    protected function _jsonEncode (array $data): string {
138
-        return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
137
+    protected function _jsonEncode(array $data): string {
138
+        return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
139 139
     }
140 140
 
141 141
     /**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @param string $path
145 145
      */
146
-    public function delete (string $path): void {
146
+    public function delete(string $path): void {
147 147
         $this->_exec('DELETE', $path);
148 148
     }
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param array $data
158 158
      * @return mixed|Data|AbstractEntity
159 159
      */
160
-    public function factory ($caller, string $class, array $data = []) {
160
+    public function factory($caller, string $class, array $data = []) {
161 161
         return new $class($caller, $data);
162 162
     }
163 163
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param array $opt
170 170
      * @return null|array
171 171
      */
172
-    public function get (string $path, array $query = [], array $opt = []) {
172
+    public function get(string $path, array $query = [], array $opt = []) {
173 173
         foreach ($opt as $name => $value) {
174 174
             $query["opt_{$name}"] = $value;
175 175
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param string $gid
184 184
      * @return null|Attachment
185 185
      */
186
-    public function getAttachment (string $gid) {
186
+    public function getAttachment(string $gid) {
187 187
         return $this->load($this, Attachment::class, "attachments/{$gid}");
188 188
     }
189 189
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param string $gid
194 194
      * @return null|CustomField
195 195
      */
196
-    public function getCustomField (string $gid) {
196
+    public function getCustomField(string $gid) {
197 197
         return $this->load($this, CustomField::class, "custom_fields/{$gid}");
198 198
     }
199 199
 
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
      *
204 204
      * @return Workspace
205 205
      */
206
-    public function getDefaultWorkspace () {
206
+    public function getDefaultWorkspace() {
207 207
         return $this->getMe()->getDefaultWorkspace();
208 208
     }
209 209
 
210 210
     /**
211 211
      * @return LoggerInterface
212 212
      */
213
-    public function getLog () {
213
+    public function getLog() {
214 214
         return $this->log ?? $this->log = new NullLogger();
215 215
     }
216 216
 
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return User
221 221
      */
222
-    public function getMe () {
222
+    public function getMe() {
223 223
         return $this->me ?? $this->me = $this->getUser('me');
224 224
     }
225 225
 
226 226
     /**
227 227
      * @return Pool
228 228
      */
229
-    final public function getPool () {
229
+    final public function getPool() {
230 230
         return $this->pool;
231 231
     }
232 232
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * @param string $gid
237 237
      * @return null|Portfolio
238 238
      */
239
-    public function getPortfolio (string $gid) {
239
+    public function getPortfolio(string $gid) {
240 240
         return $this->load($this, Portfolio::class, "portfolios/{$gid}");
241 241
     }
242 242
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      * @param string $gid
247 247
      * @return null|Project
248 248
      */
249
-    public function getProject (string $gid) {
249
+    public function getProject(string $gid) {
250 250
         return $this->load($this, Project::class, "projects/{$gid}");
251 251
     }
252 252
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @param string $gid
257 257
      * @return null|Section
258 258
      */
259
-    public function getSection (string $gid) {
259
+    public function getSection(string $gid) {
260 260
         return $this->load($this, Section::class, "sections/{$gid}");
261 261
     }
262 262
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * @param string $gid
267 267
      * @return null|Story
268 268
      */
269
-    public function getStory (string $gid) {
269
+    public function getStory(string $gid) {
270 270
         return $this->load($this, Story::class, "stories/{$gid}");
271 271
     }
272 272
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      * @param string $gid
277 277
      * @return null|Tag
278 278
      */
279
-    public function getTag (string $gid) {
279
+    public function getTag(string $gid) {
280 280
         return $this->load($this, Tag::class, "tags/{$gid}");
281 281
     }
282 282
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param string $gid
287 287
      * @return null|Task
288 288
      */
289
-    public function getTask (string $gid) {
289
+    public function getTask(string $gid) {
290 290
         return $this->load($this, Task::class, "tasks/{$gid}");
291 291
     }
292 292
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      * @param string $gid
297 297
      * @return null|TaskList
298 298
      */
299
-    public function getTaskList (string $gid) {
299
+    public function getTaskList(string $gid) {
300 300
         return $this->load($this, TaskList::class, "user_task_lists/{$gid}");
301 301
     }
302 302
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @param string $gid
307 307
      * @return null|Team
308 308
      */
309
-    public function getTeam (string $gid) {
309
+    public function getTeam(string $gid) {
310 310
         return $this->load($this, Team::class, "teams/{$gid}");
311 311
     }
312 312
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @param string $gid
317 317
      * @return null|User
318 318
      */
319
-    public function getUser (string $gid) {
319
+    public function getUser(string $gid) {
320 320
         return $this->load($this, User::class, "users/{$gid}");
321 321
     }
322 322
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param string $gid
325 325
      * @return ProjectWebhook|TaskWebhook
326 326
      */
327
-    public function getWebhook (string $gid) {
327
+    public function getWebhook(string $gid) {
328 328
         return $this->pool->get($gid, $this, function() use ($gid) {
329 329
             static $classes = [
330 330
                 Project::TYPE => ProjectWebhook::class,
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      * @param array $data
346 346
      * @return Event
347 347
      */
348
-    public function getWebhookEvent (array $data) {
348
+    public function getWebhookEvent(array $data) {
349 349
         return $this->factory($this, Event::class, $data);
350 350
     }
351 351
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      * @param string $gid
356 356
      * @return null|Workspace
357 357
      */
358
-    public function getWorkspace (string $gid) {
358
+    public function getWorkspace(string $gid) {
359 359
         return $this->load($this, Workspace::class, "workspaces/{$gid}");
360 360
     }
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param string $name
366 366
      * @return null|Workspace
367 367
      */
368
-    public function getWorkspaceByName (string $name) {
368
+    public function getWorkspaceByName(string $name) {
369 369
         foreach ($this->getWorkspaces() as $workspace) {
370 370
             if ($workspace->getName() === $name) {
371 371
                 return $workspace;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      *
380 380
      * @return Workspace[]
381 381
      */
382
-    public function getWorkspaces () {
382
+    public function getWorkspaces() {
383 383
         return $this->getMe()->getWorkspaces();
384 384
     }
385 385
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      * @param array $query
393 393
      * @return null|mixed|AbstractEntity
394 394
      */
395
-    public function load ($caller, string $class, string $path, array $query = []) {
395
+    public function load($caller, string $class, string $path, array $query = []) {
396 396
         $key = $this->_getPath($path, $query);
397 397
         return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) {
398 398
             if ($data = $this->get($path, $query, ['expand' => 'this'])) {
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      * @param array $query
412 412
      * @return array|AbstractEntity[]
413 413
      */
414
-    public function loadAll ($caller, string $class, string $path, array $query = []) {
414
+    public function loadAll($caller, string $class, string $path, array $query = []) {
415 415
         return iterator_to_array($this->loadEach(...func_get_args()));
416 416
     }
417 417
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @param array $query `limit` can exceed `100` here. Empty `limit` for all pages.
427 427
      * @return Generator|AbstractEntity[]
428 428
      */
429
-    public function loadEach ($caller, string $class, string $path, array $query = []) {
429
+    public function loadEach($caller, string $class, string $path, array $query = []) {
430 430
         $query['opt_expand'] = 'this';
431 431
         if (!$i = $query['limit'] ?? 0) {
432 432
             $i = PHP_INT_MAX;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
      * @param array $opt
451 451
      * @return null|array
452 452
      */
453
-    public function post (string $path, array $data = [], array $opt = []) {
453
+    public function post(string $path, array $data = [], array $opt = []) {
454 454
         $response = $this->_exec('POST', $path, [
455 455
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
456 456
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $opt, 'data' => $data])
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param array $opt
467 467
      * @return null|array
468 468
      */
469
-    public function put (string $path, array $data = [], array $opt = []) {
469
+    public function put(string $path, array $data = [], array $opt = []) {
470 470
         $response = $this->_exec('PUT', $path, [
471 471
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
472 472
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $opt, 'data' => $data])
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
     /**
478 478
      * @param LoggerInterface $log
479 479
      */
480
-    public function setLog (LoggerInterface $log) {
480
+    public function setLog(LoggerInterface $log) {
481 481
         $this->log = $log;
482 482
     }
483 483
 
484 484
     /**
485 485
      * @param Pool $pool
486 486
      */
487
-    public function setPool (Pool $pool) {
487
+    public function setPool(Pool $pool) {
488 488
         $this->pool = $pool;
489 489
     }
490 490
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @param null|string $token Updated to the new token.
502 502
      * @return Event[]
503 503
      */
504
-    public function sync (string $gid, ?string &$token) {
504
+    public function sync(string $gid, ?string &$token) {
505 505
         try {
506 506
             /** @var array $remote Asana throws 400 for missing entities here. */
507 507
             $remote = $this->_exec('GET', $this->_getPath('events', [
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
      * @param string $to
542 542
      * @return null|array
543 543
      */
544
-    public function upload (string $file, string $to) {
544
+    public function upload(string $file, string $to) {
545 545
         $response = $this->_exec('POST', $to, [
546 546
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
547 547
         ]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -509,8 +509,7 @@
 block discarded – undo
509 509
                 'sync' => $token,
510 510
                 'opt_expand' => 'this'
511 511
             ]));
512
-        }
513
-        catch (AsanaError $error) {
512
+        } catch (AsanaError $error) {
514 513
             if ($error->getCode() === 412) {
515 514
                 $remote = $this->_jsonDecode($error->getMessage());
516 515
                 if (!isset($token)) {
Please login to merge, or discard this patch.