Passed
Push — master ( f474ea...718b20 )
by y
07:39
created
src/User.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         'workspaces' => [Workspace::class]
30 30
     ];
31 31
 
32
-    final public function __toString (): string {
32
+    final public function __toString(): string {
33 33
         return "users/{$this->getGid()}";
34 34
     }
35 35
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param Workspace $workspace
38 38
      * @return $this
39 39
      */
40
-    public function addToWorkspace (Workspace $workspace) {
40
+    public function addToWorkspace(Workspace $workspace) {
41 41
         return $this->_addWithPost("{$workspace}/addUser", [
42 42
             'user' => $this->getGid()
43 43
         ], 'workspaces', [$workspace]);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return Workspace
51 51
      */
52
-    public function getDefaultWorkspace () {
52
+    public function getDefaultWorkspace() {
53 53
         return $this->getWorkspaces()[0];
54 54
     }
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param null|Workspace $workspace Falls back to the default workspace.
58 58
      * @return Portfolio[]
59 59
      */
60
-    public function getFavoritePortfolios (Workspace $workspace = null) {
60
+    public function getFavoritePortfolios(Workspace $workspace = null) {
61 61
         return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace);
62 62
     }
63 63
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param null|Workspace $workspace Falls back to the default workspace.
66 66
      * @return Project[]
67 67
      */
68
-    public function getFavoriteProjects (Workspace $workspace = null) {
68
+    public function getFavoriteProjects(Workspace $workspace = null) {
69 69
         return $this->getFavorites(Project::class, Project::TYPE, $workspace);
70 70
     }
71 71
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param null|Workspace $workspace Falls back to the default workspace.
74 74
      * @return Tag[]
75 75
      */
76
-    public function getFavoriteTags (Workspace $workspace = null) {
76
+    public function getFavoriteTags(Workspace $workspace = null) {
77 77
         return $this->getFavorites(Tag::class, Tag::TYPE, $workspace);
78 78
     }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param null|Workspace $workspace Falls back to the default workspace.
82 82
      * @return Team[]
83 83
      */
84
-    public function getFavoriteTeams (Workspace $workspace = null) {
84
+    public function getFavoriteTeams(Workspace $workspace = null) {
85 85
         return $this->getFavorites(Team::class, Team::TYPE, $workspace);
86 86
     }
87 87
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param null|Workspace $workspace Falls back to the default workspace.
90 90
      * @return User[]
91 91
      */
92
-    public function getFavoriteUsers (Workspace $workspace = null) {
92
+    public function getFavoriteUsers(Workspace $workspace = null) {
93 93
         return $this->getFavorites(self::class, self::TYPE, $workspace);
94 94
     }
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param null|Workspace $workspace Falls back to the default workspace.
100 100
      * @return array
101 101
      */
102
-    protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) {
102
+    protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) {
103 103
         return $this->api->loadAll($this, $class, "{$this}/favorites", [
104 104
             'resource_type' => $resourceType,
105 105
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid()
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     /**
110 110
      * @return string[]
111 111
      */
112
-    public function getPoolKeys () {
112
+    public function getPoolKeys() {
113 113
         $keys = parent::getPoolKeys();
114 114
 
115 115
         // include email as a key if it's loaded
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param null|Workspace $workspace
125 125
      * @return Portfolio[]
126 126
      */
127
-    public function getPortfolios (Workspace $workspace = null) {
127
+    public function getPortfolios(Workspace $workspace = null) {
128 128
         return $this->api->loadAll($this, Portfolio::class, "portfolios", [
129 129
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(),
130 130
             'owner' => $this->getGid()
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * @param null|Workspace $workspace Falls back to the default workspace.
136 136
      * @return TaskList
137 137
      */
138
-    public function getTaskList (Workspace $workspace = null) {
138
+    public function getTaskList(Workspace $workspace = null) {
139 139
         return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [
140 140
             'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid()
141 141
         ]);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @param string[] $filter `workspace` falls back to the default.
148 148
      * @return Task[]
149 149
      */
150
-    public function getTasks (array $filter = []) {
150
+    public function getTasks(array $filter = []) {
151 151
         $filter['assignee'] = $this->getGid();
152 152
         $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()];
153 153
         return $this->api->loadAll($this, Task::class, 'tasks', $filter);
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
      * @param null|Workspace $organization Falls back to the default workspace.
162 162
      * @return Team[]
163 163
      */
164
-    public function getTeams (Workspace $organization = null) {
164
+    public function getTeams(Workspace $organization = null) {
165 165
         return $this->api->loadAll($this, Team::class, "{$this}/teams", [
166 166
             'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid()
167 167
         ]);
168 168
     }
169 169
 
170
-    public function getUrl (): string {
170
+    public function getUrl(): string {
171 171
         return "https://app.asana.com/0/{$this->getGid()}/list";
172 172
     }
173 173
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @param Workspace $workspace
176 176
      * @return $this
177 177
      */
178
-    public function removeFromWorkspace (Workspace $workspace) {
178
+    public function removeFromWorkspace(Workspace $workspace) {
179 179
         return $this->_removeWithPost("{$workspace}/removeUser", [
180 180
             'user' => $this->getGid()
181 181
         ], 'workspaces', [$workspace]);
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private $defaultSection;
80 80
 
81
-    final public function __toString (): string {
81
+    final public function __toString(): string {
82 82
         return "projects/{$this->getGid()}";
83 83
     }
84 84
 
85
-    final protected function _getDir (): string {
85
+    final protected function _getDir(): string {
86 86
         return 'projects';
87 87
     }
88 88
 
89
-    protected function _setData (array $data): void {
89
+    protected function _setData(array $data): void {
90 90
         // this is always empty. fields are in the settings, values are in tasks.
91 91
         unset($data['custom_fields']);
92 92
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param User $user
102 102
      * @return $this
103 103
      */
104
-    public function addMember (User $user) {
104
+    public function addMember(User $user) {
105 105
         return $this->addMembers([$user]);
106 106
     }
107 107
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      * @param User[] $users
111 111
      * @return $this
112 112
      */
113
-    public function addMembers (array $users) {
113
+    public function addMembers(array $users) {
114 114
         return $this->_addWithPost("{$this}/addMembers", [
115 115
             'members' => array_column($users, 'gid')
116 116
         ], 'members', $users);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param string $target
122 122
      * @return ProjectWebhook
123 123
      */
124
-    public function addWebhook (string $target) {
124
+    public function addWebhook(string $target) {
125 125
         /** @var ProjectWebhook $webhook */
126 126
         $webhook = $this->api->factory($this, ProjectWebhook::class);
127 127
         return $webhook->create($this, $target);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param array $schedule
147 147
      * @return Job
148 148
      */
149
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
149
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
150 150
         $data = ['name' => $name];
151 151
         if ($team) {
152 152
             $data['team'] = $team->getGid();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @depends after-create
167 167
      * @return Section
168 168
      */
169
-    public function getDefaultSection () {
169
+    public function getDefaultSection() {
170 170
         return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0];
171 171
     }
172 172
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * @param null|string $token
180 180
      * @return Event[]
181 181
      */
182
-    public function getEvents (&$token) {
182
+    public function getEvents(&$token) {
183 183
         return $this->api->sync($this->getGid(), $token);
184 184
     }
185 185
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @param int $limit
192 192
      * @return Traversable|Section[]
193 193
      */
194
-    public function getIterator (int $limit = 0) {
194
+    public function getIterator(int $limit = 0) {
195 195
         return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]);
196 196
     }
197 197
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param int $limit
201 201
      * @return Section[]
202 202
      */
203
-    public function getSections (int $limit = 0) {
203
+    public function getSections(int $limit = 0) {
204 204
         return iterator_to_array($this->getIterator($limit));
205 205
     }
206 206
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @depends after-create
209 209
      * @return Status[]
210 210
      */
211
-    public function getStatuses () {
211
+    public function getStatuses() {
212 212
         return $this->api->loadAll($this, Status::class, "{$this}/project_statuses");
213 213
     }
214 214
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * @depends after-create
217 217
      * @return TaskCounts
218 218
      */
219
-    public function getTaskCounts () {
219
+    public function getTaskCounts() {
220 220
         /** @var array $remote */
221 221
         $remote = $this->api->get("{$this}/task_counts", [], TaskCounts::OPT);
222 222
         return $this->api->factory($this, TaskCounts::class, $remote);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      * @param array $filter
230 230
      * @return Task[]
231 231
      */
232
-    public function getTasks (array $filter = []) {
232
+    public function getTasks(array $filter = []) {
233 233
         $filter['project'] = $this->getGid();
234 234
         return $this->api->loadAll($this, Task::class, "tasks", $filter);
235 235
     }
@@ -238,25 +238,25 @@  discard block
 block discarded – undo
238 238
      * @depends after-create
239 239
      * @return string
240 240
      */
241
-    public function getUrl (): string {
241
+    public function getUrl(): string {
242 242
         return "https://app.asana.com/0/{$this->getGid()}";
243 243
     }
244 244
 
245 245
     /**
246 246
      * @return ProjectWebhook[]
247 247
      */
248
-    public function getWebhooks () {
248
+    public function getWebhooks() {
249 249
         return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [
250 250
             'workspace' => $this->getWorkspace()->getGid(),
251 251
             'resource' => $this->getGid()
252 252
         ]);
253 253
     }
254 254
 
255
-    public function isBoard (): bool {
255
+    public function isBoard(): bool {
256 256
         return $this->getLayout() === self::LAYOUT_BOARD;
257 257
     }
258 258
 
259
-    public function isList (): bool {
259
+    public function isList(): bool {
260 260
         return $this->getLayout() === self::LAYOUT_LIST;
261 261
     }
262 262
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @depends after-create
265 265
      * @return Section
266 266
      */
267
-    public function newSection () {
267
+    public function newSection() {
268 268
         return $this->api->factory($this, Section::class, ['project' => $this]);
269 269
     }
270 270
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @depends after-create
273 273
      * @return Status
274 274
      */
275
-    public function newStatus () {
275
+    public function newStatus() {
276 276
         return $this->api->factory($this, Status::class);
277 277
     }
278 278
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @depends after-create
283 283
      * @return Task
284 284
      */
285
-    public function newTask () {
285
+    public function newTask() {
286 286
         return $this->getDefaultSection()->newTask();
287 287
     }
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      * @param User $user
292 292
      * @return $this
293 293
      */
294
-    public function removeMember (User $user) {
294
+    public function removeMember(User $user) {
295 295
         return $this->removeMembers([$user]);
296 296
     }
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      * @param User[] $users
301 301
      * @return $this
302 302
      */
303
-    public function removeMembers (array $users) {
303
+    public function removeMembers(array $users) {
304 304
         return $this->_removeWithPost("{$this}/removeMembers", [
305 305
             'members' => array_column($users, 'gid')
306 306
         ], 'members', $users);
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      * @param callable $filter `fn( Section $section ): bool`
311 311
      * @return Section[]
312 312
      */
313
-    public function selectSections (callable $filter) {
313
+    public function selectSections(callable $filter) {
314 314
         return $this->_select($this->getSections(), $filter);
315 315
     }
316 316
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      * @param callable $filter `fn( Status $status ): bool`
319 319
      * @return Status[]
320 320
      */
321
-    public function selectStatuses (callable $filter) {
321
+    public function selectStatuses(callable $filter) {
322 322
         return $this->_select($this->getStatuses(), $filter);
323 323
     }
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      * @param array $apiFilter Pre-filter given to the API to reduce network load.
328 328
      * @return Task[]
329 329
      */
330
-    public function selectTasks (callable $filter, array $apiFilter = []) {
330
+    public function selectTasks(callable $filter, array $apiFilter = []) {
331 331
         return $this->_select($this->getTasks($apiFilter), $filter);
332 332
     }
333 333
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param null|Team $team
337 337
      * @return $this
338 338
      */
339
-    public function setTeam (?Team $team) {
339
+    public function setTeam(?Team $team) {
340 340
         if ($team and !$this->hasWorkspace()) {
341 341
             $this->setWorkspace($team->getOrganization());
342 342
         }
Please login to merge, or discard this patch.
src/Api/Laravel/Facade/Asana.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@
 block discarded – undo
48 48
     /**
49 49
      * @return Api
50 50
      */
51
-    final public static function getApi () {
51
+    final public static function getApi() {
52 52
         return static::getFacadeRoot();
53 53
     }
54 54
 
55 55
     /**
56 56
      * @return string
57 57
      */
58
-    public static function getFacadeAccessor () {
58
+    public static function getFacadeAccessor() {
59 59
         return AsanaServiceProvider::NAME;
60 60
     }
61 61
 
Please login to merge, or discard this patch.
src/Base/AbstractEntity.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @return string
34 34
      */
35
-    abstract public function __toString (): string;
35
+    abstract public function __toString(): string;
36 36
 
37 37
     /**
38 38
      * @param self $entity
39 39
      * @return bool
40 40
      * @internal pool
41 41
      */
42
-    final public function __merge (self $entity): bool {
42
+    final public function __merge(self $entity): bool {
43 43
         $old = $this->toArray();
44 44
         $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff));
45 45
         return $this->toArray() !== $old;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @return $this
54 54
      * @internal
55 55
      */
56
-    protected function _addWithPost (string $addPath, array $data, string $field, array $diff) {
56
+    protected function _addWithPost(string $addPath, array $data, string $field, array $diff) {
57 57
         if ($this->hasGid()) {
58 58
             return $this->_setWithPost($addPath, $data, $field);
59 59
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param string $field
67 67
      * @return mixed
68 68
      */
69
-    protected function _get (string $field) {
69
+    protected function _get(string $field) {
70 70
         if (!array_key_exists($field, $this->data) and $this->hasGid()) {
71 71
             $this->reload($field);
72 72
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @return $this
82 82
      * @internal
83 83
      */
84
-    protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
84
+    protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
85 85
         if ($this->hasGid()) {
86 86
             return $this->_setWithPost($rmPath, $data, $field);
87 87
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
92 92
     }
93 93
 
94
-    protected function _setData (array $data): void {
94
+    protected function _setData(array $data): void {
95 95
         // make sure the gid is consistently null|string across all entities.
96 96
         $data['gid'] = (string)$data['gid'];
97 97
         if (empty($data['gid'])) {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @return $this
115 115
      * @internal
116 116
      */
117
-    protected function _setWithPost (string $path, array $data, string $field, $value = null) {
117
+    protected function _setWithPost(string $path, array $data, string $field, $value = null) {
118 118
         if ($this->hasGid()) {
119 119
             /** @var array $remote */
120 120
             $remote = $this->api->post($path, $data, ['fields' => static::OPT_FIELDS[$field] ?? $field]);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * @return null|string
132 132
      */
133
-    final public function getGid (): ?string {
133
+    final public function getGid(): ?string {
134 134
         return $this->data['gid'];
135 135
     }
136 136
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      *
140 140
      * @return string[]
141 141
      */
142
-    public function getPoolKeys () {
142
+    public function getPoolKeys() {
143 143
         return [$this->getGid(), (string)$this];
144 144
     }
145 145
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @return string
150 150
      */
151
-    final public function getResourceType (): string {
151
+    final public function getResourceType(): string {
152 152
         return $this::TYPE;
153 153
     }
154 154
 
155 155
     /**
156 156
      * @return bool
157 157
      */
158
-    final public function hasGid (): bool {
158
+    final public function hasGid(): bool {
159 159
         return isset($this->data['gid']);
160 160
     }
161 161
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @param string $field
167 167
      * @return $this
168 168
      */
169
-    public function reload (string $field = null) {
169
+    public function reload(string $field = null) {
170 170
         if (!$this->hasGid()) { // guards against loading a remote dir.
171 171
             throw new LogicException(static::class . " has no GID, it can't be reloaded.");
172 172
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
     protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
85 85
         if ($this->hasGid()) {
86 86
             return $this->_setWithPost($rmPath, $data, $field);
87
-        }
88
-        elseif (is_array($diff)) {
87
+        } elseif (is_array($diff)) {
89 88
             return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff)));
90 89
         }
91 90
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
@@ -173,11 +172,9 @@  discard block
 block discarded – undo
173 172
         if (isset($field)) {
174 173
             $remote = $this->api->get($this, [], ['fields' => static::OPT_FIELDS[$field] ?? $field]);
175 174
             $this->_setMapped($field, $remote[$field] ?? null);
176
-        }
177
-        elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) {
175
+        } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) {
178 176
             $this->_setData($remote);
179
-        }
180
-        else { // deleted upstream.
177
+        } else { // deleted upstream.
181 178
             $this->api->getPool()->remove($this->getPoolKeys());
182 179
             throw new RuntimeException("{$this} was deleted upstream.");
183 180
         }
Please login to merge, or discard this patch.
src/Base/AbstractEntity/DeleteTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * `DELETE`
16 16
      */
17
-    public function delete (): void {
17
+    public function delete(): void {
18 18
         $this->api->delete($this);
19 19
         $this->api->getPool()->remove($this->getPoolKeys());
20 20
     }
Please login to merge, or discard this patch.
src/Base/AbstractEntity/UpdateTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      *
17 17
      * @return $this
18 18
      */
19
-    public function update () {
19
+    public function update() {
20 20
         if ($this->isDiff()) {
21 21
             /** @var array $remote */
22 22
             $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']);
Please login to merge, or discard this patch.
src/Base/AbstractEntity/CreateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
      *
17 17
      * @return string
18 18
      */
19
-    abstract protected function _getDir (): string;
19
+    abstract protected function _getDir(): string;
20 20
 
21 21
     /**
22 22
      * `POST` the new entity to Asana.
23 23
      *
24 24
      * @return $this
25 25
      */
26
-    public function create () {
26
+    public function create() {
27 27
         /** @var array $remote */
28 28
         $remote = $this->api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']);
29 29
         $this->_setData($remote);
Please login to merge, or discard this patch.
src/CustomField/FieldSettingsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @return CustomField[]
19 19
      */
20
-    public function getCustomFields () {
20
+    public function getCustomFields() {
21 21
         return array_column($this->getCustomFieldSettings(), 'custom_field');
22 22
     }
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param callable $filter `fn( CustomField $field ): bool`
26 26
      * @return CustomField[]
27 27
      */
28
-    public function selectCustomFields (callable $filter) {
28
+    public function selectCustomFields(callable $filter) {
29 29
         return $this->_select($this->getCustomFields(), $filter);
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/Task.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
         'memberships' => 'memberships.(project|section)'
102 102
     ];
103 103
 
104
-    final public function __toString (): string {
104
+    final public function __toString(): string {
105 105
         return "tasks/{$this->getGid()}";
106 106
     }
107 107
 
108
-    final protected function _getDir (): string {
108
+    final protected function _getDir(): string {
109 109
         return 'tasks';
110 110
     }
111 111
 
112
-    protected function _onSave (): void {
112
+    protected function _onSave(): void {
113 113
         // use isset() to avoid has() fetch.
114 114
         if (isset($this->data['custom_fields'])) {
115 115
             $this->getCustomFields()->diff = [];
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         }
120 120
     }
121 121
 
122
-    protected function _setData (array $data): void {
122
+    protected function _setData(array $data): void {
123 123
         // hearts were deprecated for likes
124 124
         unset($data['hearted'], $data['hearts'], $data['num_hearts']);
125 125
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param string $file
140 140
      * @return Attachment
141 141
      */
142
-    public function addAttachment (string $file) {
142
+    public function addAttachment(string $file) {
143 143
         /** @var Attachment $attachment */
144 144
         $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]);
145 145
         return $attachment->upload($file);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @param string $text
152 152
      * @return Story
153 153
      */
154
-    public function addComment (string $text) {
154
+    public function addComment(string $text) {
155 155
         return $this->newComment()->setText($text)->create();
156 156
     }
157 157
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param Task[] $tasks
163 163
      * @return $this
164 164
      */
165
-    public function addDependencies (array $tasks) {
165
+    public function addDependencies(array $tasks) {
166 166
         $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]);
167 167
         return $this;
168 168
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param Task $task
175 175
      * @return $this
176 176
      */
177
-    public function addDependency (Task $task) {
177
+    public function addDependency(Task $task) {
178 178
         return $this->addDependencies([$task]);
179 179
     }
180 180
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * @param Task $task
186 186
      * @return $this
187 187
      */
188
-    public function addDependent (Task $task) {
188
+    public function addDependent(Task $task) {
189 189
         return $this->addDependents([$task]);
190 190
     }
191 191
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param Task[] $tasks
197 197
      * @return $this
198 198
      */
199
-    public function addDependents (array $tasks) {
199
+    public function addDependents(array $tasks) {
200 200
         $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]);
201 201
         return $this;
202 202
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @param User $user
208 208
      * @return $this
209 209
      */
210
-    public function addFollower (User $user) {
210
+    public function addFollower(User $user) {
211 211
         return $this->addFollowers([$user]);
212 212
     }
213 213
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      * @param User[] $users
220 220
      * @return $this
221 221
      */
222
-    public function addFollowers (array $users) {
222
+    public function addFollowers(array $users) {
223 223
         return $this->_addWithPost("{$this}/addFollowers", [
224 224
             'followers' => array_column($users, 'gid')
225 225
         ], 'followers', $users);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param Tag $tag
234 234
      * @return $this
235 235
      */
236
-    public function addTag (Tag $tag) {
236
+    public function addTag(Tag $tag) {
237 237
         return $this->_addWithPost("{$this}/addTag", [
238 238
             'tag' => $tag->getGid()
239 239
         ], 'tags', [$tag]);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param Section $section
250 250
      * @return $this
251 251
      */
252
-    public function addToProject (Section $section) {
252
+    public function addToProject(Section $section) {
253 253
         /** @var Membership $membership */
254 254
         $membership = $this->api->factory($this, Membership::class)
255 255
             ->_set('project', $section->getProject())
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @param string $target
265 265
      * @return TaskWebhook
266 266
      */
267
-    public function addWebhook (string $target) {
267
+    public function addWebhook(string $target) {
268 268
         /** @var TaskWebhook $webhook */
269 269
         $webhook = $this->api->factory($this, TaskWebhook::class);
270 270
         return $webhook->create($this, $target);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     /**
274 274
      * @return $this
275 275
      */
276
-    public function create () {
276
+    public function create() {
277 277
         $this->_create();
278 278
         $this->_onSave();
279 279
         return $this;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @param string[] $include
290 290
      * @return Job
291 291
      */
292
-    public function duplicate (string $name, array $include) {
292
+    public function duplicate(string $name, array $include) {
293 293
         /** @var array $remote */
294 294
         $remote = $this->api->post("{$this}/duplicate", [
295 295
             'name' => $name,
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @depends after-create
305 305
      * @return Attachment[]
306 306
      */
307
-    public function getAttachments () {
307
+    public function getAttachments() {
308 308
         return $this->api->loadAll($this, Attachment::class, "{$this}/attachments");
309 309
     }
310 310
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      * @depends after-create
315 315
      * @return Story[]
316 316
      */
317
-    public function getComments () {
317
+    public function getComments() {
318 318
         return $this->selectStories(function(Story $story) {
319 319
             return $story->isComment();
320 320
         });
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      * @depends after-create
327 327
      * @return Task[]
328 328
      */
329
-    public function getDependencies () {
329
+    public function getDependencies() {
330 330
         return $this->api->loadAll($this, self::class, "{$this}/dependencies");
331 331
     }
332 332
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @depends after-create
337 337
      * @return Task[]
338 338
      */
339
-    public function getDependents () {
339
+    public function getDependents() {
340 340
         return $this->api->loadAll($this, self::class, "{$this}/dependents");
341 341
     }
342 342
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      * @param null|string $token
348 348
      * @return Event[]
349 349
      */
350
-    public function getEvents (&$token) {
350
+    public function getEvents(&$token) {
351 351
         return $this->api->sync($this->getGid(), $token);
352 352
     }
353 353
 
@@ -359,21 +359,21 @@  discard block
 block discarded – undo
359 359
      *
360 360
      * @return External
361 361
      */
362
-    public function getExternal () {
362
+    public function getExternal() {
363 363
         return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class);
364 364
     }
365 365
 
366 366
     /**
367 367
      * @return Project[]
368 368
      */
369
-    public function getProjects () {
369
+    public function getProjects() {
370 370
         return array_column($this->getMemberships(), 'project');
371 371
     }
372 372
 
373 373
     /**
374 374
      * @return Section[]
375 375
      */
376
-    public function getSections () {
376
+    public function getSections() {
377 377
         return array_column($this->getMemberships(), 'section');
378 378
     }
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * @depends after-create
384 384
      * @return Story[]
385 385
      */
386
-    public function getStories () {
386
+    public function getStories() {
387 387
         return $this->api->loadAll($this, Story::class, "{$this}/stories");
388 388
     }
389 389
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      * @depends after-create
394 394
      * @return Task[]
395 395
      */
396
-    public function getSubTasks () {
396
+    public function getSubTasks() {
397 397
         return $this->api->loadAll($this, self::class, "{$this}/subtasks");
398 398
     }
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * @depends after-create
404 404
      * @return string
405 405
      */
406
-    public function getUrl (): string {
406
+    public function getUrl(): string {
407 407
         return "https://app.asana.com/0/0/{$this->getGid()}";
408 408
     }
409 409
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      * @depends after-create
414 414
      * @return TaskWebhook[]
415 415
      */
416
-    public function getWebhooks () {
416
+    public function getWebhooks() {
417 417
         return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [
418 418
             'workspace' => $this->getWorkspace()->getGid(),
419 419
             'resource' => $this->getGid()
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     /**
424 424
      * @return bool
425 425
      */
426
-    public function isRenderedAsSeparator (): bool {
426
+    public function isRenderedAsSeparator(): bool {
427 427
         return $this->_is('is_rendered_as_separator');
428 428
     }
429 429
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
      * @depends after-create
434 434
      * @return Story
435 435
      */
436
-    public function newComment () {
436
+    public function newComment() {
437 437
         return $this->api->factory($this, Story::class, [
438 438
             'resource_subtype' => Story::TYPE_COMMENT_ADDED,
439 439
             'target' => $this
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      * @depends after-create
447 447
      * @return Task
448 448
      */
449
-    public function newSubTask () {
449
+    public function newSubTask() {
450 450
         /** @var Task $sub */
451 451
         $sub = $this->api->factory($this, self::class);
452 452
         return $sub->setParent($this);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      * @param Task[] $tasks
460 460
      * @return $this
461 461
      */
462
-    public function removeDependencies (array $tasks) {
462
+    public function removeDependencies(array $tasks) {
463 463
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
464 464
         return $this;
465 465
     }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
      * @param Task $task
472 472
      * @return $this
473 473
      */
474
-    public function removeDependency (Task $task) {
474
+    public function removeDependency(Task $task) {
475 475
         return $this->removeDependencies([$task]);
476 476
     }
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
      * @param Task $task
483 483
      * @return $this
484 484
      */
485
-    public function removeDependent (Task $task) {
485
+    public function removeDependent(Task $task) {
486 486
         return $this->removeDependents([$task]);
487 487
     }
488 488
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param Task[] $tasks
494 494
      * @return $this
495 495
      */
496
-    public function removeDependents (array $tasks) {
496
+    public function removeDependents(array $tasks) {
497 497
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
498 498
         return $this;
499 499
     }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      * @param User $user
505 505
      * @return $this
506 506
      */
507
-    public function removeFollower (User $user) {
507
+    public function removeFollower(User $user) {
508 508
         return $this->removeFollowers([$user]);
509 509
     }
510 510
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      * @param User[] $users
517 517
      * @return $this
518 518
      */
519
-    public function removeFollowers (array $users) {
519
+    public function removeFollowers(array $users) {
520 520
         return $this->_removeWithPost("{$this}/removeFollowers", [
521 521
             'followers' => array_column($users, 'gid')
522 522
         ], 'followers', $users);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param Project $project
531 531
      * @return $this
532 532
      */
533
-    public function removeFromProject (Project $project) {
533
+    public function removeFromProject(Project $project) {
534 534
         return $this->_removeWithPost("{$this}/removeProject", [
535 535
             'project' => $project->getGid()
536 536
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      * @param Tag $tag
547 547
      * @return $this
548 548
      */
549
-    public function removeTag (Tag $tag) {
549
+    public function removeTag(Tag $tag) {
550 550
         return $this->_removeWithPost("{$this}/removeTag", [
551 551
             'tag' => $tag->getGid()
552 552
         ], 'tags', [$tag]);
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param callable $filter `fn( Attachment $attachment): bool`
557 557
      * @return Attachment[]
558 558
      */
559
-    public function selectAttachments (callable $filter) {
559
+    public function selectAttachments(callable $filter) {
560 560
         return $this->_select($this->getAttachments(), $filter);
561 561
     }
562 562
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      * @param callable $filter `fn( Story $comment ): bool`
565 565
      * @return Story[]
566 566
      */
567
-    public function selectComments (callable $filter) {
567
+    public function selectComments(callable $filter) {
568 568
         return $this->_select($this->getComments(), $filter);
569 569
     }
570 570
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      * @param callable $filter `fn( Task $dependency ): bool`
573 573
      * @return Task[]
574 574
      */
575
-    public function selectDependencies (callable $filter) {
575
+    public function selectDependencies(callable $filter) {
576 576
         return $this->_select($this->getDependencies(), $filter);
577 577
     }
578 578
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      * @param callable $filter `fn( Task $dependent ): bool`
581 581
      * @return Task[]
582 582
      */
583
-    public function selectDependents (callable $filter) {
583
+    public function selectDependents(callable $filter) {
584 584
         return $this->_select($this->getDependents(), $filter);
585 585
     }
586 586
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
      * @param callable $filter `fn( Project $project ): bool`
589 589
      * @return Project[]
590 590
      */
591
-    public function selectProjects (callable $filter) {
591
+    public function selectProjects(callable $filter) {
592 592
         return $this->_select($this->getProjects(), $filter);
593 593
     }
594 594
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      * @param callable $filter `fn( Story $story ): bool`
597 597
      * @return Story[]
598 598
      */
599
-    public function selectStories (callable $filter) {
599
+    public function selectStories(callable $filter) {
600 600
         return $this->_select($this->getStories(), $filter);
601 601
     }
602 602
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
      * @param callable $filter `fn( Task $subtask ): bool`
605 605
      * @return Task[]
606 606
      */
607
-    public function selectSubTasks (callable $filter) {
607
+    public function selectSubTasks(callable $filter) {
608 608
         return $this->_select($this->getSubTasks(), $filter);
609 609
     }
610 610
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
      * @param null|string|DateTimeInterface $date
613 613
      * @return Task
614 614
      */
615
-    public function setDueOn ($date) {
615
+    public function setDueOn($date) {
616 616
         if ($date instanceof DateTimeInterface) {
617 617
             $date = $date->format('Y-m-d');
618 618
         }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
      * @param null|Task $parent
627 627
      * @return $this
628 628
      */
629
-    public function setParent (?self $parent) {
629
+    public function setParent(?self $parent) {
630 630
         return $this->_setWithPost("{$this}/setParent", [
631 631
             'parent' => $parent
632 632
         ], 'parent', $parent);
@@ -636,14 +636,14 @@  discard block
 block discarded – undo
636 636
      * @param bool $flag
637 637
      * @return $this
638 638
      */
639
-    public function setRenderedAsSeparator (bool $flag) {
639
+    public function setRenderedAsSeparator(bool $flag) {
640 640
         return $this->_set('is_rendered_as_separator', $flag);
641 641
     }
642 642
 
643 643
     /**
644 644
      * @return $this
645 645
      */
646
-    public function update () {
646
+    public function update() {
647 647
         $this->_update();
648 648
         $this->_onSave();
649 649
         return $this;
Please login to merge, or discard this patch.