Passed
Push — master ( 866c3b...50a671 )
by y
08:13
created
src/User/TaskList.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
         'workspace' => Workspace::class
31 31
     ];
32 32
 
33
-    final public function __toString (): string {
33
+    final public function __toString(): string {
34 34
         return "user_task_lists/{$this->getGid()}";
35 35
     }
36 36
 
37
-    public function getCacheKeys () {
37
+    public function getCacheKeys() {
38 38
         $keys = parent::getCacheKeys();
39 39
 
40 40
         /** @see User::getTaskList() */
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     /**
49 49
      * @return Task[]
50 50
      */
51
-    public function getIncompleteTasks () {
51
+    public function getIncompleteTasks() {
52 52
         return $this->getTasks(['completed_since' => 'now']);
53 53
     }
54 54
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return ArrayIterator|Task[]
59 59
      */
60
-    public function getIterator () {
60
+    public function getIterator() {
61 61
         return new ArrayIterator($this->getTasks());
62 62
     }
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param array $filter
70 70
      * @return Task[]
71 71
      */
72
-    public function getTasks (array $filter = []) {
72
+    public function getTasks(array $filter = []) {
73 73
         return $this->loadAll(Task::class, "{$this}/tasks", $filter);
74 74
     }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         'workspaces' => [Workspace::class]
29 29
     ];
30 30
 
31
-    final public function __toString (): string {
31
+    final public function __toString(): string {
32 32
         return "users/{$this->getGid()}";
33 33
     }
34 34
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param Workspace $workspace
37 37
      * @return $this
38 38
      */
39
-    public function addToWorkspace (Workspace $workspace) {
39
+    public function addToWorkspace(Workspace $workspace) {
40 40
         return $this->_addWithPost("{$workspace}/addUser", [
41 41
             'user' => $this->getGid()
42 42
         ], 'workspaces', [$workspace]);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     /**
46 46
      * @return string[]
47 47
      */
48
-    public function getCacheKeys () {
48
+    public function getCacheKeys() {
49 49
         $keys = parent::getCacheKeys();
50 50
 
51 51
         // only include email as a key if it's loaded
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @return Workspace
64 64
      */
65
-    public function getDefaultWorkspace () {
65
+    public function getDefaultWorkspace() {
66 66
         return $this->getWorkspaces()[0];
67 67
     }
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param null|Workspace $workspace Falls back to the default workspace.
71 71
      * @return Portfolio[]
72 72
      */
73
-    public function getFavoritePortfolios (Workspace $workspace = null) {
73
+    public function getFavoritePortfolios(Workspace $workspace = null) {
74 74
         return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace);
75 75
     }
76 76
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param null|Workspace $workspace Falls back to the default workspace.
79 79
      * @return Project[]
80 80
      */
81
-    public function getFavoriteProjects (Workspace $workspace = null) {
81
+    public function getFavoriteProjects(Workspace $workspace = null) {
82 82
         return $this->getFavorites(Project::class, Project::TYPE, $workspace);
83 83
     }
84 84
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param null|Workspace $workspace Falls back to the default workspace.
87 87
      * @return Tag[]
88 88
      */
89
-    public function getFavoriteTags (Workspace $workspace = null) {
89
+    public function getFavoriteTags(Workspace $workspace = null) {
90 90
         return $this->getFavorites(Tag::class, Tag::TYPE, $workspace);
91 91
     }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @param null|Workspace $workspace Falls back to the default workspace.
95 95
      * @return Team[]
96 96
      */
97
-    public function getFavoriteTeams (Workspace $workspace = null) {
97
+    public function getFavoriteTeams(Workspace $workspace = null) {
98 98
         return $this->getFavorites(Team::class, Team::TYPE, $workspace);
99 99
     }
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param null|Workspace $workspace Falls back to the default workspace.
103 103
      * @return User[]
104 104
      */
105
-    public function getFavoriteUsers (Workspace $workspace = null) {
105
+    public function getFavoriteUsers(Workspace $workspace = null) {
106 106
         return $this->getFavorites(self::class, self::TYPE, $workspace);
107 107
     }
108 108
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param null|Workspace $workspace Falls back to the default workspace.
113 113
      * @return array
114 114
      */
115
-    protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) {
115
+    protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) {
116 116
         return $this->loadAll($class, "{$this}/favorites", [
117 117
             'resource_type' => $resourceType,
118 118
             'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid()
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * @param null|Workspace $workspace Falls back to the default workspace.
128 128
      * @return Task[]
129 129
      */
130
-    public function getIncompleteTasks (Workspace $workspace = null) {
130
+    public function getIncompleteTasks(Workspace $workspace = null) {
131 131
         $filter = ['completed_since' => 'now'];
132 132
         if ($workspace) {
133 133
             $filter['workspace'] = $workspace->getGid();
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param null|Workspace $workspace
140 140
      * @return Portfolio[]
141 141
      */
142
-    public function getPortfolios (Workspace $workspace = null) {
142
+    public function getPortfolios(Workspace $workspace = null) {
143 143
         return $this->loadAll(Portfolio::class, "portfolios", [
144 144
             'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid(),
145 145
             'owner' => $this->getGid()
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @param null|Workspace $workspace Falls back to the default workspace.
151 151
      * @return TaskList
152 152
      */
153
-    public function getTaskList (Workspace $workspace = null) {
153
+    public function getTaskList(Workspace $workspace = null) {
154 154
         return $this->load(TaskList::class, "{$this}/user_task_list", [
155 155
             'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid()
156 156
         ]);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @param string[] $filter `workspace` falls back to the default.
165 165
      * @return Task[]
166 166
      */
167
-    public function getTasks (array $filter = []) {
167
+    public function getTasks(array $filter = []) {
168 168
         $filter['assignee'] = $this->getGid();
169 169
         $filter += ['workspace' => $this->getDefaultWorkspace()->getGid()];
170 170
         return $this->loadAll(Task::class, 'tasks', $filter);
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
      * @param null|Workspace $organization Falls back to the default workspace.
179 179
      * @return Team[]
180 180
      */
181
-    public function getTeams (Workspace $organization = null) {
181
+    public function getTeams(Workspace $organization = null) {
182 182
         return $this->loadAll(Team::class, "{$this}/teams", [
183 183
             'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid()
184 184
         ]);
185 185
     }
186 186
 
187
-    public function getUrl (): string {
187
+    public function getUrl(): string {
188 188
         return "https://app.asana.com/0/{$this->getGid()}/list";
189 189
     }
190 190
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @param Workspace $workspace
193 193
      * @return $this
194 194
      */
195
-    public function removeFromWorkspace (Workspace $workspace) {
195
+    public function removeFromWorkspace(Workspace $workspace) {
196 196
         return $this->_removeWithPost("{$workspace}/removeUser", [
197 197
             'user' => $this->getGid()
198 198
         ], 'workspaces', [$workspace]);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @param array $apiFilter Given to the API to reduce network load.
204 204
      * @return Task[]
205 205
      */
206
-    public function selectTasks (callable $filter, array $apiFilter) {
206
+    public function selectTasks(callable $filter, array $apiFilter) {
207 207
         return $this->_select($this->getTasks($apiFilter), $filter);
208 208
     }
209 209
 }
210 210
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/SimpleCache.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @param PSR16 $psr
36 36
      */
37
-    public function __construct (PSR16 $psr) {
37
+    public function __construct(PSR16 $psr) {
38 38
         $this->psr = $psr;
39 39
         $this->ttl = new DateInterval('PT1H');
40 40
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param string $key
44 44
      * @throws InvalidArgumentException
45 45
      */
46
-    protected function _delete (string $key) {
46
+    protected function _delete(string $key) {
47 47
         $this->psr->delete('asana/' . $key);
48 48
     }
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @return null|string|AbstractEntity
53 53
      * @throws InvalidArgumentException
54 54
      */
55
-    protected function _get (string $key) {
55
+    protected function _get(string $key) {
56 56
         return $this->psr->get('asana/' . $key);
57 57
     }
58 58
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param mixed $value
62 62
      * @throws InvalidArgumentException
63 63
      */
64
-    protected function _set (string $key, $value) {
64
+    protected function _set(string $key, $value) {
65 65
         $this->psr->set('asana/' . $key, $value, $this->ttl);
66 66
     }
67 67
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @return bool
71 71
      * @throws InvalidArgumentException
72 72
      */
73
-    public function add (AbstractEntity $entity): bool {
73
+    public function add(AbstractEntity $entity): bool {
74 74
         if (parent::add($entity)) {
75 75
             $this->_set($entity->getGid(), $entity);
76 76
             return true;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string[] $keys
84 84
      * @throws InvalidArgumentException
85 85
      */
86
-    protected function addKeys (string $gid, array $keys): void {
86
+    protected function addKeys(string $gid, array $keys): void {
87 87
         parent::addKeys($gid, $keys);
88 88
         // stash gid refs
89 89
         foreach ($keys as $key) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @return null|AbstractEntity
101 101
      * @throws InvalidArgumentException
102 102
      */
103
-    public function get (string $key, $caller, Closure $factory) {
103
+    public function get(string $key, $caller, Closure $factory) {
104 104
         // POOL MISS && CACHE HIT
105 105
         if (!isset($this->gids[$key]) and $entity = $this->_get($key)) {
106 106
             if ($entity instanceof AbstractEntity) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     /**
124 124
      * @return DateInterval
125 125
      */
126
-    public function getTtl () {
126
+    public function getTtl() {
127 127
         return $this->ttl;
128 128
     }
129 129
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param AbstractEntity $entity
132 132
      * @throws InvalidArgumentException
133 133
      */
134
-    public function remove (AbstractEntity $entity): void {
134
+    public function remove(AbstractEntity $entity): void {
135 135
         parent::remove($entity);
136 136
         foreach ($entity->getCacheKeys() as $key) {
137 137
             $this->_delete($key);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param DateInterval $ttl
143 143
      * @return $this
144 144
      */
145
-    public function setTtl (DateInterval $ttl) {
145
+    public function setTtl(DateInterval $ttl) {
146 146
         $this->ttl = $ttl;
147 147
         return $this;
148 148
     }
Please login to merge, or discard this patch.
src/Base/Data.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param Api|Data $caller
48 48
      * @param array $data
49 49
      */
50
-    public function __construct ($caller, array $data = []) {
50
+    public function __construct($caller, array $data = []) {
51 51
         $this->api = $caller instanceof self ? $caller->api : $caller;
52 52
         $this->_setData($data);
53 53
     }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      * @param array $args
64 64
      * @return mixed
65 65
      */
66
-    public function __call (string $method, array $args) {
66
+    public function __call(string $method, array $args) {
67 67
         static $cache = [];
68
-        if (!$call =& $cache[$method]) {
68
+        if (!$call = & $cache[$method]) {
69 69
             preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call);
70 70
             $call[1] = '_' . $call[1];
71 71
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return $this->{$call[1]}($call[2], ...$args);
76 76
     }
77 77
 
78
-    public function __debugInfo (): array {
78
+    public function __debugInfo(): array {
79 79
         return $this->data;
80 80
     }
81 81
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @param $field
86 86
      * @return null|Data|mixed
87 87
      */
88
-    final public function __get ($field) {
88
+    final public function __get($field) {
89 89
         return $this->_get($field);
90 90
     }
91 91
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param $field
98 98
      * @return bool
99 99
      */
100
-    final public function __isset ($field) {
100
+    final public function __isset($field) {
101 101
         return true;
102 102
     }
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param string $field
110 110
      * @return mixed
111 111
      */
112
-    protected function _get (string $field) {
112
+    protected function _get(string $field) {
113 113
         return $this->data[$field] ?? null;
114 114
     }
115 115
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param string $field
124 124
      * @return bool
125 125
      */
126
-    protected function _has (string $field): bool {
126
+    protected function _has(string $field): bool {
127 127
         $value = $this->_get($field);
128 128
         if (isset($value)) {
129 129
             if (is_countable($value)) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param string $field
147 147
      * @return bool
148 148
      */
149
-    protected function _is (string $field): bool {
149
+    protected function _is(string $field): bool {
150 150
         return !empty($this->_get($field));
151 151
     }
152 152
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param callable $filter `fn( Data $object ): bool`
162 162
      * @return array
163 163
      */
164
-    protected function _select ($subject, callable $filter) {
164
+    protected function _select($subject, callable $filter) {
165 165
         if (!is_array($subject)) {
166 166
             $subject = $this->_get($subject) ?? [];
167 167
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param mixed $value
178 178
      * @return $this
179 179
      */
180
-    protected function _set (string $field, $value) {
180
+    protected function _set(string $field, $value) {
181 181
         $this->data[$field] = $value;
182 182
         $this->diff[$field] = true;
183 183
         return $this;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      *
189 189
      * @param array $data
190 190
      */
191
-    protected function _setData (array $data): void {
191
+    protected function _setData(array $data): void {
192 192
         $this->data = $this->diff = [];
193 193
         foreach ($data as $field => $value) {
194 194
             $this->_setMapped($field, $value);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param string $field
202 202
      * @param mixed $value
203 203
      */
204
-    protected function _setMapped (string $field, $value): void {
204
+    protected function _setMapped(string $field, $value): void {
205 205
         unset($this->diff[$field]);
206 206
 
207 207
         // use value as-is?
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param array $data
250 250
      * @return mixed|Data|AbstractEntity
251 251
      */
252
-    final protected function factory (string $class, array $data = []) {
252
+    final protected function factory(string $class, array $data = []) {
253 253
         return $this->api->factory($class, $this, $data);
254 254
     }
255 255
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      *
259 259
      * @return array
260 260
      */
261
-    public function getDiff (): array {
261
+    public function getDiff(): array {
262 262
         $convert = function($each) use (&$convert) {
263 263
             // convert existing entities to gids
264 264
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      * @param string null $field
285 285
      * @return bool
286 286
      */
287
-    final public function isDiff (string $field = null): bool {
287
+    final public function isDiff(string $field = null): bool {
288 288
         if ($field) {
289 289
             return isset($this->diff[$field]);
290 290
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
      * @see toArray()
296 296
      * @return array
297 297
      */
298
-    public function jsonSerialize (): array {
298
+    public function jsonSerialize(): array {
299 299
         return $this->toArray();
300 300
     }
301 301
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      * @param array $query
310 310
      * @return null|mixed|AbstractEntity
311 311
      */
312
-    final protected function load (string $class, string $path, array $query = []) {
312
+    final protected function load(string $class, string $path, array $query = []) {
313 313
         return $this->api->load($class, $this, $path, $query);
314 314
     }
315 315
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param int $pages
325 325
      * @return array|AbstractEntity[]
326 326
      */
327
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
327
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
328 328
         return $this->api->loadAll($class, $this, $path, $query, $pages);
329 329
     }
330 330
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      *
334 334
      * @return string
335 335
      */
336
-    public function serialize (): string {
336
+    public function serialize(): string {
337 337
         return json_encode($this);
338 338
     }
339 339
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      *
343 343
      * @return array
344 344
      */
345
-    public function toArray (): array {
345
+    public function toArray(): array {
346 346
         return array_map($dehydrate = function($each) use (&$dehydrate) {
347 347
             if ($each instanceof AbstractEntity and $each->hasGid()) {
348 348
                 return $each->getGid();
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      *
363 363
      * @param $serialized
364 364
      */
365
-    public function unserialize ($serialized): void {
365
+    public function unserialize($serialized): void {
366 366
         $this->api = Api::getDefault();
367 367
         $data = json_decode($serialized, true);
368 368
         $this->_setData($data);
Please login to merge, or discard this patch.
src/Base/AbstractEntity.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return string
23 23
      */
24
-    abstract public function __toString (): string;
24
+    abstract public function __toString(): string;
25 25
 
26 26
     /**
27 27
      * Maps lazy-loaded / reloadable mapped {@see Data} to their proper expanded field expression.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param AbstractEntity $entity
42 42
      * @internal
43 43
      */
44
-    public function __set (string $from, self $entity) {
44
+    public function __set(string $from, self $entity) {
45 45
         if ($from === Cache::class and $entity !== $this) {
46 46
             foreach ($entity->data as $field => $value) {
47 47
                 if (!isset($this->diff[$field])) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @return $this
60 60
      * @internal
61 61
      */
62
-    protected function _addWithPost (string $addPath, array $data, string $field, array $diff) {
62
+    protected function _addWithPost(string $addPath, array $data, string $field, array $diff) {
63 63
         if ($this->hasGid()) {
64 64
             return $this->_setWithPost($addPath, $data, $field);
65 65
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @internal
73 73
      */
74
-    protected function _cache (): void {
74
+    protected function _cache(): void {
75 75
         $this->api->getCache()->add($this);
76 76
     }
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @internal
82 82
      */
83
-    protected function _delete (): void {
83
+    protected function _delete(): void {
84 84
         $this->api->delete($this);
85 85
         $this->api->getCache()->remove($this);
86 86
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param string $field
92 92
      * @return mixed
93 93
      */
94
-    protected function _get (string $field) {
94
+    protected function _get(string $field) {
95 95
         if (!array_key_exists($field, $this->data) and isset($this->data['gid'])) {
96 96
             $this->reload($field);
97 97
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @return $this
107 107
      * @internal
108 108
      */
109
-    protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
109
+    protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
110 110
         if ($this->hasGid()) {
111 111
             return $this->_setWithPost($rmPath, $data, $field);
112 112
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @return $this
124 124
      * @internal
125 125
      */
126
-    protected function _save (string $dir = null) {
126
+    protected function _save(string $dir = null) {
127 127
         if (isset($dir)) {
128 128
             $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']);
129 129
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @return $this
150 150
      * @internal
151 151
      */
152
-    protected function _setWithPost (string $path, array $data, string $field, $value = null) {
152
+    protected function _setWithPost(string $path, array $data, string $field, $value = null) {
153 153
         if ($this->hasGid()) {
154 154
             /** @var array $remote */
155 155
             $remote = $this->api->post($path, $data, ['fields' => static::$optFields[$field] ?? $field]);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return string[]
169 169
      */
170
-    public function getCacheKeys () {
170
+    public function getCacheKeys() {
171 171
         return [$this->getGid(), (string)$this];
172 172
     }
173 173
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param string $field
179 179
      * @return $this
180 180
      */
181
-    public function reload (string $field = null) {
181
+    public function reload(string $field = null) {
182 182
         if (!$this->hasGid()) {
183 183
             throw new LogicException(static::class . " has no GID, it can't be reloaded.");
184 184
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -109,8 +109,7 @@  discard block
 block discarded – undo
109 109
     protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
110 110
         if ($this->hasGid()) {
111 111
             return $this->_setWithPost($rmPath, $data, $field);
112
-        }
113
-        elseif (is_array($diff)) {
112
+        } elseif (is_array($diff)) {
114 113
             return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff)));
115 114
         }
116 115
         return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff)));
@@ -126,11 +125,9 @@  discard block
 block discarded – undo
126 125
     protected function _save (string $dir = null) {
127 126
         if (isset($dir)) {
128 127
             $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']);
129
-        }
130
-        elseif ($this->isDiff()) {
128
+        } elseif ($this->isDiff()) {
131 129
             $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']);
132
-        }
133
-        else {
130
+        } else {
134 131
             return $this;
135 132
         }
136 133
         /** @var array $remote */
@@ -186,11 +183,9 @@  discard block
 block discarded – undo
186 183
             $optField = static::$optFields[$field] ?? $field;
187 184
             $value = $this->api->get($this, [], ['fields' => $optField])[$field] ?? null;
188 185
             $this->_setMapped($field, $value);
189
-        }
190
-        elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) {
186
+        } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) {
191 187
             $this->_setData($remote);
192
-        }
193
-        else { // deleted upstream.
188
+        } else { // deleted upstream.
194 189
             $this->api->getCache()->remove($this);
195 190
             throw new RuntimeException("{$this} was deleted upstream.");
196 191
         }
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->factory(OrganizationExport::class);
42 42
         return $export->create($this);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param int $limit 1-100
58 58
      * @return array|AbstractEntity[]
59 59
      */
60
-    protected function find (string $class, string $resourceType, string $text, int $limit = 20) {
60
+    protected function find(string $class, string $resourceType, string $text, int $limit = 20) {
61 61
         return $this->loadAll($class, "{$this}/typeahead", [
62 62
             'resource_type' => $resourceType,
63 63
             'query' => $text,
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param int $limit 1-100
73 73
      * @return CustomField[]
74 74
      */
75
-    public function findCustomFields (string $text, int $limit = 20) {
75
+    public function findCustomFields(string $text, int $limit = 20) {
76 76
         return $this->find(CustomField::class, CustomField::TYPE, $text, $limit);
77 77
     }
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param int $limit 1-100
84 84
      * @return Portfolio[]
85 85
      */
86
-    public function findPortfolios (string $text, int $limit = 20) {
86
+    public function findPortfolios(string $text, int $limit = 20) {
87 87
         return $this->find(Portfolio::class, Portfolio::TYPE, $text, $limit);
88 88
     }
89 89
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @param int $limit 1-100
95 95
      * @return Project[]
96 96
      */
97
-    public function findProjects (string $text, int $limit = 20) {
97
+    public function findProjects(string $text, int $limit = 20) {
98 98
         return $this->find(Project::class, Project::TYPE, $text, $limit);
99 99
     }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * @param int $limit 1-100
106 106
      * @return Tag[]
107 107
      */
108
-    public function findTags (string $text, int $limit = 20) {
108
+    public function findTags(string $text, int $limit = 20) {
109 109
         return $this->find(Tag::class, Tag::TYPE, $text, $limit);
110 110
     }
111 111
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
      * @param int $limit 1-100
117 117
      * @return Task[]
118 118
      */
119
-    public function findTasks (string $text, int $limit = 20) {
119
+    public function findTasks(string $text, int $limit = 20) {
120 120
         return $this->find(Task::class, Task::TYPE, $text, $limit);
121 121
     }
122 122
 
123 123
     /**
124 124
      * @return CustomField[]
125 125
      */
126
-    public function getCustomFields () {
126
+    public function getCustomFields() {
127 127
         return $this->loadAll(CustomField::class, "{$this}/custom_fields");
128 128
     }
129 129
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      *
135 135
      * @return Portfolio[]
136 136
      */
137
-    public function getPortfolios () {
137
+    public function getPortfolios() {
138 138
         return $this->loadAll(Portfolio::class, "portfolios", [
139 139
             'workspace' => $this->getGid(),
140 140
             'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required.
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @param array $filter
150 150
      * @return Project[]
151 151
      */
152
-    public function getProjects (array $filter = ['archived' => false]) {
152
+    public function getProjects(array $filter = ['archived' => false]) {
153 153
         $filter['workspace'] = $this->getGid();
154 154
         return $this->loadAll(Project::class, 'projects', $filter);
155 155
     }
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
     /**
158 158
      * @return Tag[]
159 159
      */
160
-    public function getTags () {
160
+    public function getTags() {
161 161
         return $this->loadAll(Tag::class, 'tags', ['workspace' => $this->getGid()]);
162 162
     }
163 163
 
164 164
     /**
165 165
      * @return Team[]
166 166
      */
167
-    public function getTeams () {
167
+    public function getTeams() {
168 168
         return $this->loadAll(Team::class, "organizations/{$this->getGid()}/teams");
169 169
     }
170 170
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param string $email
173 173
      * @return null|User
174 174
      */
175
-    public function getUserByEmail (string $email) {
175
+    public function getUserByEmail(string $email) {
176 176
         return $this->api->getCache()->get("users/{$email}", $this, function() use ($email) {
177 177
             foreach ($this->getUsers() as $user) {
178 178
                 if ($user->getEmail() === $email) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     /**
187 187
      * @return User[]
188 188
      */
189
-    public function getUsers () {
189
+    public function getUsers() {
190 190
         return $this->loadAll(User::class, "{$this}/users");
191 191
     }
192 192
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      *
196 196
      * @return ProjectWebhook[]|TaskWebhook[]
197 197
      */
198
-    public function getWebhooks () {
198
+    public function getWebhooks() {
199 199
         /** @var array $all */
200 200
         $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']);
201 201
         return array_map(function(array $each) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     /**
213 213
      * @return bool
214 214
      */
215
-    public function isOrganization (): bool {
215
+    public function isOrganization(): bool {
216 216
         return $this->_is('is_organization');
217 217
     }
218 218
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      *
222 222
      * @return CustomField
223 223
      */
224
-    public function newCustomField () {
224
+    public function newCustomField() {
225 225
         /** @var CustomField $field */
226 226
         $field = $this->factory(CustomField::class);
227 227
         return $field->setWorkspace($this);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      *
233 233
      * @return Portfolio
234 234
      */
235
-    public function newPortfolio () {
235
+    public function newPortfolio() {
236 236
         /** @var Portfolio $portfolio */
237 237
         $portfolio = $this->factory(Portfolio::class);
238 238
         return $portfolio->setWorkspace($this);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      *
244 244
      * @return Project
245 245
      */
246
-    public function newProject () {
246
+    public function newProject() {
247 247
         /** @var Project $project */
248 248
         $project = $this->factory(Project::class);
249 249
         return $project->setWorkspace($this);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      *
255 255
      * @return Tag
256 256
      */
257
-    public function newTag () {
257
+    public function newTag() {
258 258
         /** @var Tag $tag */
259 259
         $tag = $this->factory(Tag::class);
260 260
         return $tag->setWorkspace($this);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      *
266 266
      * @return Task
267 267
      */
268
-    public function newTask () {
268
+    public function newTask() {
269 269
         /** @var Task $task */
270 270
         $task = $this->factory(Task::class);
271 271
         return $task->setWorkspace($this);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      * @param callable $filter `fn( CustomField $field ): bool`
276 276
      * @return CustomField[]
277 277
      */
278
-    public function selectCustomFields (callable $filter) {
278
+    public function selectCustomFields(callable $filter) {
279 279
         return $this->_select($this->getCustomFields(), $filter);
280 280
     }
281 281
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * @param callable $filter `fn( Portfolio $portfolio ): bool`
284 284
      * @return Portfolio[]
285 285
      */
286
-    public function selectPortfolios (callable $filter) {
286
+    public function selectPortfolios(callable $filter) {
287 287
         return $this->_select($this->getPortfolios(), $filter);
288 288
     }
289 289
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      * @param callable $filter `fn( Project $project ): bool`
292 292
      * @return Project[]
293 293
      */
294
-    public function selectProjects (callable $filter) {
294
+    public function selectProjects(callable $filter) {
295 295
         return $this->_select($this->getProjects([]), $filter);
296 296
     }
297 297
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @param callable $filter `fn( Tag $tag ): bool`
300 300
      * @return Tag[]
301 301
      */
302
-    public function selectTags (callable $filter) {
302
+    public function selectTags(callable $filter) {
303 303
         return $this->_select($this->getTags(), $filter);
304 304
     }
305 305
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @param callable $filter `fn( Team $team ): bool`
308 308
      * @return Team[]
309 309
      */
310
-    public function selectTeams (callable $filter) {
310
+    public function selectTeams(callable $filter) {
311 311
         return $this->_select($this->getTeams(), $filter);
312 312
     }
313 313
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @param callable $filter
316 316
      * @return User[]
317 317
      */
318
-    public function selectUsers (callable $filter) {
318
+    public function selectUsers(callable $filter) {
319 319
         return $this->_select($this->getUsers(), $filter);
320 320
     }
321 321
 }
322 322
\ No newline at end of file
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
         'workspace' => Workspace::class
71 71
     ];
72 72
 
73
-    final public function __toString (): string {
73
+    final public function __toString(): string {
74 74
         return "projects/{$this->getGid()}";
75 75
     }
76 76
 
77
-    final protected function _getDir (): string {
77
+    final protected function _getDir(): string {
78 78
         return 'projects';
79 79
     }
80 80
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param User $user
84 84
      * @return $this
85 85
      */
86
-    public function addMember (User $user) {
86
+    public function addMember(User $user) {
87 87
         return $this->addMembers([$user]);
88 88
     }
89 89
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param User[] $users
93 93
      * @return $this
94 94
      */
95
-    public function addMembers (array $users) {
95
+    public function addMembers(array $users) {
96 96
         return $this->_addWithPost("{$this}/addMembers", [
97 97
             'members' => array_column($users, 'gid')
98 98
         ], 'members', $users);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @param string $target
104 104
      * @return ProjectWebhook
105 105
      */
106
-    public function addWebhook (string $target) {
106
+    public function addWebhook(string $target) {
107 107
         /** @var ProjectWebhook $webhook */
108 108
         $webhook = $this->factory(ProjectWebhook::class);
109 109
         return $webhook->create($this, $target);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param array $schedule
129 129
      * @return Job
130 130
      */
131
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
131
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
132 132
         $data = ['name' => $name];
133 133
         if ($team) {
134 134
             $data['team'] = $team->getGid();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @depends after-create
148 148
      * @return Section
149 149
      */
150
-    public function getDefaultSection () {
150
+    public function getDefaultSection() {
151 151
         return $this->loadAll(Section::class, "{$this}/sections", ['limit' => 1])[0];
152 152
     }
153 153
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param null|string $token
159 159
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
160 160
      */
161
-    public function getEvents (&$token) {
161
+    public function getEvents(&$token) {
162 162
         return $this->api->sync($this, $token);
163 163
     }
164 164
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @depends after-create
167 167
      * @return Section[]
168 168
      */
169
-    public function getSections () {
169
+    public function getSections() {
170 170
         return $this->loadAll(Section::class, "{$this}/sections");
171 171
     }
172 172
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @depends after-create
175 175
      * @return Status[]
176 176
      */
177
-    public function getStatuses () {
177
+    public function getStatuses() {
178 178
         return $this->loadAll(Status::class, "{$this}/project_statuses");
179 179
     }
180 180
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      * @param array $filter
188 188
      * @return Task[]
189 189
      */
190
-    public function getTasks (array $filter = []) {
190
+    public function getTasks(array $filter = []) {
191 191
         $filter['project'] = $this->getGid();
192 192
         return $this->loadAll(Task::class, "tasks", $filter);
193 193
     }
@@ -196,25 +196,25 @@  discard block
 block discarded – undo
196 196
      * @depends after-create
197 197
      * @return string
198 198
      */
199
-    public function getUrl (): string {
199
+    public function getUrl(): string {
200 200
         return "https://app.asana.com/0/{$this->getGid()}";
201 201
     }
202 202
 
203 203
     /**
204 204
      * @return ProjectWebhook[]
205 205
      */
206
-    public function getWebhooks () {
206
+    public function getWebhooks() {
207 207
         return $this->loadAll(ProjectWebhook::class, 'webhooks', [
208 208
             'workspace' => $this->getWorkspace()->getGid(),
209 209
             'resource' => $this->getGid()
210 210
         ]);
211 211
     }
212 212
 
213
-    public function isBoard (): bool {
213
+    public function isBoard(): bool {
214 214
         return $this->getLayout() === self::LAYOUT_BOARD;
215 215
     }
216 216
 
217
-    public function isList (): bool {
217
+    public function isList(): bool {
218 218
         return $this->getLayout() === self::LAYOUT_LIST;
219 219
     }
220 220
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      * @depends after-create
223 223
      * @return Section
224 224
      */
225
-    public function newSection () {
225
+    public function newSection() {
226 226
         return $this->factory(Section::class, ['project' => $this]);
227 227
     }
228 228
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      * @depends after-create
231 231
      * @return Status
232 232
      */
233
-    public function newStatus () {
233
+    public function newStatus() {
234 234
         return $this->factory(Status::class);
235 235
     }
236 236
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      * @depends after-create
241 241
      * @return Task
242 242
      */
243
-    public function newTask () {
243
+    public function newTask() {
244 244
         return $this->getDefaultSection()->newTask();
245 245
     }
246 246
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param User $user
250 250
      * @return $this
251 251
      */
252
-    public function removeMember (User $user) {
252
+    public function removeMember(User $user) {
253 253
         return $this->removeMembers([$user]);
254 254
     }
255 255
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @param User[] $users
259 259
      * @return $this
260 260
      */
261
-    public function removeMembers (array $users) {
261
+    public function removeMembers(array $users) {
262 262
         return $this->_removeWithPost("{$this}/removeMembers", [
263 263
             'members' => array_column($users, 'gid')
264 264
         ], 'members', $users);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @param callable $filter `fn( Section $section ): bool`
269 269
      * @return Section[]
270 270
      */
271
-    public function selectSections (callable $filter) {
271
+    public function selectSections(callable $filter) {
272 272
         return $this->_select($this->getSections(), $filter);
273 273
     }
274 274
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      * @param callable $filter `fn( Status $status ): bool`
277 277
      * @return Status[]
278 278
      */
279
-    public function selectStatuses (callable $filter) {
279
+    public function selectStatuses(callable $filter) {
280 280
         return $this->_select($this->getStatuses(), $filter);
281 281
     }
282 282
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * @param array $apiFilter Pre-filter given to the API to reduce network load.
286 286
      * @return Task[]
287 287
      */
288
-    public function selectTasks (callable $filter, array $apiFilter = []) {
288
+    public function selectTasks(callable $filter, array $apiFilter = []) {
289 289
         return $this->_select($this->getTasks($apiFilter), $filter);
290 290
     }
291 291
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @param null|Team $team
295 295
      * @return $this
296 296
      */
297
-    public function setTeam (?Team $team) {
297
+    public function setTeam(?Team $team) {
298 298
         if ($team and !$this->hasWorkspace()) {
299 299
             $this->setWorkspace($team->getOrganization());
300 300
         }
Please login to merge, or discard this patch.
src/Api.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @return Cache
55 55
      */
56
-    public static function getCache () {
56
+    public static function getCache() {
57 57
         return static::$cache ?? static::$cache = new Cache();
58 58
     }
59 59
 
60 60
     /**
61 61
      * @return Api
62 62
      */
63
-    public static function getDefault () {
63
+    public static function getDefault() {
64 64
         return self::$default;
65 65
     }
66 66
 
67 67
     /**
68 68
      * @return LoggerInterface
69 69
      */
70
-    public static function getLogger () {
70
+    public static function getLogger() {
71 71
         return static::$logger
72 72
             ?? static::$logger = new class implements LoggerInterface {
73 73
 
74
-                public function log (string $message, string $path, array $data = null): void {
74
+                public function log(string $message, string $path, array $data = null): void {
75 75
                     // stub
76 76
                 }
77 77
 
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @param Cache $cache
83 83
      */
84
-    public static function setCache (Cache $cache) {
84
+    public static function setCache(Cache $cache) {
85 85
         static::$cache = $cache;
86 86
     }
87 87
 
88 88
     /**
89 89
      * @param Api $default
90 90
      */
91
-    public static function setDefault (Api $default) {
91
+    public static function setDefault(Api $default) {
92 92
         self::$default = $default;
93 93
     }
94 94
 
95 95
     /**
96 96
      * @param LoggerInterface $logger
97 97
      */
98
-    public static function setLogger (LoggerInterface $logger) {
98
+    public static function setLogger(LoggerInterface $logger) {
99 99
         static::$logger = $logger;
100 100
     }
101 101
 
102 102
     /**
103 103
      * @param string $token
104 104
      */
105
-    public function __construct (string $token) {
105
+    public function __construct(string $token) {
106 106
         $this->token = $token;
107 107
         if (!static::$default) {
108 108
             static::$default = $this;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @return null|array
119 119
      * @internal
120 120
      */
121
-    protected function _exec (string $method, string $path, array $opts = []) {
121
+    protected function _exec(string $method, string $path, array $opts = []) {
122 122
         static::getLogger()->log($method, $path, $opts);
123 123
         /** @var resource $ch */
124 124
         $ch = curl_init();
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      * @return string
168 168
      * @internal
169 169
      */
170
-    protected function _getPath (string $path, array $query): string {
170
+    protected function _getPath(string $path, array $query): string {
171 171
         return $query ? $path . '?' . http_build_query($query) : $path;
172 172
     }
173 173
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
      * @return null|array
177 177
      * @internal
178 178
      */
179
-    protected function _jsonDecode (string $json) {
180
-        return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
179
+    protected function _jsonDecode(string $json) {
180
+        return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
181 181
     }
182 182
 
183 183
     /**
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
      * @return string
186 186
      * @internal
187 187
      */
188
-    protected function _jsonEncode (array $data): string {
189
-        return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
188
+    protected function _jsonEncode(array $data): string {
189
+        return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
190 190
     }
191 191
 
192 192
     /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      *
195 195
      * @param string $path
196 196
      */
197
-    public function delete (string $path): void {
197
+    public function delete(string $path): void {
198 198
         $this->_exec('DELETE', $path);
199 199
     }
200 200
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @param array $data
209 209
      * @return mixed|Data|AbstractEntity
210 210
      */
211
-    public function factory (string $class, $caller, array $data = []) {
211
+    public function factory(string $class, $caller, array $data = []) {
212 212
         return new $class($caller, $data);
213 213
     }
214 214
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @param array $options
221 221
      * @return null|array
222 222
      */
223
-    public function get (string $path, array $query = [], array $options = []) {
223
+    public function get(string $path, array $query = [], array $options = []) {
224 224
         foreach ($options as $name => $value) {
225 225
             $query["opt_{$name}"] = $value;
226 226
         }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      * @param string $gid
235 235
      * @return null|Attachment
236 236
      */
237
-    public function getAttachment (string $gid) {
237
+    public function getAttachment(string $gid) {
238 238
         return $this->load(Attachment::class, $this, "attachments/{$gid}");
239 239
     }
240 240
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param string $gid
245 245
      * @return null|CustomField
246 246
      */
247
-    public function getCustomField (string $gid) {
247
+    public function getCustomField(string $gid) {
248 248
         return $this->load(CustomField::class, $this, "custom_fields/{$gid}");
249 249
     }
250 250
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      *
255 255
      * @return Workspace
256 256
      */
257
-    public function getDefaultWorkspace () {
257
+    public function getDefaultWorkspace() {
258 258
         return $this->getMe()->getDefaultWorkspace();
259 259
     }
260 260
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      *
264 264
      * @return User
265 265
      */
266
-    public function getMe () {
266
+    public function getMe() {
267 267
         return $this->getUser('me');
268 268
     }
269 269
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      * @param string $gid
274 274
      * @return null|Portfolio
275 275
      */
276
-    public function getPortfolio (string $gid) {
276
+    public function getPortfolio(string $gid) {
277 277
         return $this->load(Portfolio::class, $this, "portfolios/{$gid}");
278 278
     }
279 279
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * @param string $gid
284 284
      * @return null|Project
285 285
      */
286
-    public function getProject (string $gid) {
286
+    public function getProject(string $gid) {
287 287
         return $this->load(Project::class, $this, "projects/{$gid}");
288 288
     }
289 289
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * @param string $gid
294 294
      * @return null|Section
295 295
      */
296
-    public function getSection (string $gid) {
296
+    public function getSection(string $gid) {
297 297
         return $this->load(Section::class, $this, "sections/{$gid}");
298 298
     }
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      * @param string $gid
304 304
      * @return null|Story
305 305
      */
306
-    public function getStory (string $gid) {
306
+    public function getStory(string $gid) {
307 307
         return $this->load(Story::class, $this, "stories/{$gid}");
308 308
     }
309 309
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      * @param string $gid
314 314
      * @return null|Tag
315 315
      */
316
-    public function getTag (string $gid) {
316
+    public function getTag(string $gid) {
317 317
         return $this->load(Tag::class, $this, "tags/{$gid}");
318 318
     }
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      * @param string $gid
324 324
      * @return null|Task
325 325
      */
326
-    public function getTask (string $gid) {
326
+    public function getTask(string $gid) {
327 327
         return $this->load(Task::class, $this, "tasks/{$gid}");
328 328
     }
329 329
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * @param string $gid
334 334
      * @return null|TaskList
335 335
      */
336
-    public function getTaskList (string $gid) {
336
+    public function getTaskList(string $gid) {
337 337
         return $this->load(TaskList::class, $this, "user_task_lists/{$gid}");
338 338
     }
339 339
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @param string $gid
344 344
      * @return null|Team
345 345
      */
346
-    public function getTeam (string $gid) {
346
+    public function getTeam(string $gid) {
347 347
         return $this->load(Team::class, $this, "teams/{$gid}");
348 348
     }
349 349
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      * @param string $gid
354 354
      * @return null|User
355 355
      */
356
-    public function getUser (string $gid) {
356
+    public function getUser(string $gid) {
357 357
         return $this->load(User::class, $this, "users/{$gid}");
358 358
     }
359 359
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param array $data
366 366
      * @return ProjectEvent|TaskEvent|StoryEvent
367 367
      */
368
-    public function getWebhookEvent (array $data) {
368
+    public function getWebhookEvent(array $data) {
369 369
         static $classes = [
370 370
             Project::TYPE => ProjectEvent::class,
371 371
             Task::TYPE => TaskEvent::class,
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
      * @param string $gid
381 381
      * @return null|Workspace
382 382
      */
383
-    public function getWorkspace (string $gid) {
383
+    public function getWorkspace(string $gid) {
384 384
         return $this->load(Workspace::class, $this, "workspaces/{$gid}");
385 385
     }
386 386
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      * @param string $name
391 391
      * @return null|Workspace
392 392
      */
393
-    public function getWorkspaceByName (string $name) {
393
+    public function getWorkspaceByName(string $name) {
394 394
         foreach ($this->getWorkspaces() as $workspace) {
395 395
             if ($workspace->getName() === $name) {
396 396
                 return $workspace;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      *
405 405
      * @return Workspace[]
406 406
      */
407
-    public function getWorkspaces () {
407
+    public function getWorkspaces() {
408 408
         return $this->getMe()->getWorkspaces();
409 409
     }
410 410
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      * @param array $query
420 420
      * @return null|mixed|AbstractEntity
421 421
      */
422
-    public function load (string $class, $caller, string $path, array $query = []) {
422
+    public function load(string $class, $caller, string $path, array $query = []) {
423 423
         $key = $this->_getPath($path, $query);
424 424
         return $this->getCache()->get($key, $caller, function($caller) use ($class, $path, $query) {
425 425
             $data = $this->get($path, $query, ['expand' => 'this']);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      * @param int $pages If positive, stops after this many pages have been fetched.
440 440
      * @return array|AbstractEntity[]
441 441
      */
442
-    public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) {
442
+    public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) {
443 443
         $query['opt_expand'] = 'this';
444 444
         $query += ['limit' => 100];
445 445
         $path = $this->_getPath($path, $query);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
      * @param array $options
466 466
      * @return null|array
467 467
      */
468
-    public function post (string $path, array $data = [], array $options = []) {
468
+    public function post(string $path, array $data = [], array $options = []) {
469 469
         $response = $this->_exec('POST', $path, [
470 470
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
471 471
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data])
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
      * @param array $options
482 482
      * @return null|array
483 483
      */
484
-    public function put (string $path, array $data = [], array $options = []) {
484
+    public function put(string $path, array $data = [], array $options = []) {
485 485
         $response = $this->_exec('PUT', $path, [
486 486
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
487 487
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data])
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @param null|string $token
501 501
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
502 502
      */
503
-    public function sync ($entity, ?string &$token) {
503
+    public function sync($entity, ?string &$token) {
504 504
         try {
505 505
             $response = $this->_exec('GET', $this->_getPath('events', [
506 506
                 'resource' => $entity->getGid(),
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      * @param string $file
536 536
      * @return null|array
537 537
      */
538
-    public function upload (string $path, string $file) {
538
+    public function upload(string $path, string $file) {
539 539
         $response = $this->_exec('POST', $path, [
540 540
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
541 541
         ]);
Please login to merge, or discard this patch.
src/Task.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
         'memberships' => 'memberships.(project|section)'
96 96
     ];
97 97
 
98
-    final public function __toString (): string {
98
+    final public function __toString(): string {
99 99
         return "tasks/{$this->getGid()}";
100 100
     }
101 101
 
102
-    final protected function _getDir (): string {
102
+    final protected function _getDir(): string {
103 103
         return 'tasks';
104 104
     }
105 105
 
106
-    protected function _save (string $dir = null) {
106
+    protected function _save(string $dir = null) {
107 107
         parent::_save($dir);
108 108
         // use isset() to avoid has() fetch.
109 109
         if (isset($this->data['custom_fields'])) {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         return $this;
116 116
     }
117 117
 
118
-    protected function _setData (array $data): void {
118
+    protected function _setData(array $data): void {
119 119
         unset($data['hearted']); // deprecated for likes
120 120
         unset($data['hearts']); // deprecated for likes
121 121
         unset($data['projects']); // redundant, memberships are used instead
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param string $file
130 130
      * @return Attachment
131 131
      */
132
-    public function addAttachment (string $file) {
132
+    public function addAttachment(string $file) {
133 133
         /** @var Attachment $attachment */
134 134
         $attachment = $this->factory(Attachment::class, ['parent' => $this]);
135 135
         return $attachment->upload($file);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @param string $text
142 142
      * @return Story
143 143
      */
144
-    public function addComment (string $text) {
144
+    public function addComment(string $text) {
145 145
         return $this->newComment()->setText($text)->create();
146 146
     }
147 147
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param Task[] $tasks
153 153
      * @return $this
154 154
      */
155
-    public function addDependencies (array $tasks) {
155
+    public function addDependencies(array $tasks) {
156 156
         $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]);
157 157
         return $this;
158 158
     }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @param Task $task
165 165
      * @return $this
166 166
      */
167
-    public function addDependency (Task $task) {
167
+    public function addDependency(Task $task) {
168 168
         return $this->addDependencies([$task]);
169 169
     }
170 170
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @param Task $task
176 176
      * @return $this
177 177
      */
178
-    public function addDependent (Task $task) {
178
+    public function addDependent(Task $task) {
179 179
         return $this->addDependents([$task]);
180 180
     }
181 181
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      * @param Task[] $tasks
187 187
      * @return $this
188 188
      */
189
-    public function addDependents (array $tasks) {
189
+    public function addDependents(array $tasks) {
190 190
         $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]);
191 191
         return $this;
192 192
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @param User $user
198 198
      * @return $this
199 199
      */
200
-    public function addFollower (User $user) {
200
+    public function addFollower(User $user) {
201 201
         return $this->addFollowers([$user]);
202 202
     }
203 203
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      * @param User[] $users
210 210
      * @return $this
211 211
      */
212
-    public function addFollowers (array $users) {
212
+    public function addFollowers(array $users) {
213 213
         return $this->_addWithPost("{$this}/addFollowers", [
214 214
             'followers' => array_column($users, 'gid')
215 215
         ], 'followers', $users);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      * @param Tag $tag
224 224
      * @return $this
225 225
      */
226
-    public function addTag (Tag $tag) {
226
+    public function addTag(Tag $tag) {
227 227
         return $this->_addWithPost("{$this}/addTag", [
228 228
             'tag' => $tag->getGid()
229 229
         ], 'tags', [$tag]);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      * @param Section|null $section
239 239
      * @return $this
240 240
      */
241
-    public function addToProject (Project $project, Section $section = null) {
241
+    public function addToProject(Project $project, Section $section = null) {
242 242
         /** @var Membership $membership */
243 243
         $membership = $this->factory(Membership::class)
244 244
             ->_set('project', $project)
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * @param string $target
254 254
      * @return TaskWebhook
255 255
      */
256
-    public function addWebhook (string $target) {
256
+    public function addWebhook(string $target) {
257 257
         /** @var TaskWebhook $webhook */
258 258
         $webhook = $this->factory(TaskWebhook::class);
259 259
         return $webhook->create($this, $target);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      * @param string[] $include
270 270
      * @return Job
271 271
      */
272
-    public function duplicate (string $name, array $include) {
272
+    public function duplicate(string $name, array $include) {
273 273
         /** @var array $remote */
274 274
         $remote = $this->api->post("{$this}/duplicate", [
275 275
             'name' => $name,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      * @depends after-create
285 285
      * @return Attachment[]
286 286
      */
287
-    public function getAttachments () {
287
+    public function getAttachments() {
288 288
         return $this->loadAll(Attachment::class, "{$this}/attachments");
289 289
     }
290 290
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @depends after-create
295 295
      * @return Story[]
296 296
      */
297
-    public function getComments () {
297
+    public function getComments() {
298 298
         return $this->selectStories(function(Story $story) {
299 299
             return $story->isComment();
300 300
         });
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @depends after-create
307 307
      * @return Task[]
308 308
      */
309
-    public function getDependencies () {
309
+    public function getDependencies() {
310 310
         return $this->loadAll(self::class, "{$this}/dependencies");
311 311
     }
312 312
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @depends after-create
317 317
      * @return Task[]
318 318
      */
319
-    public function getDependents () {
319
+    public function getDependents() {
320 320
         return $this->loadAll(self::class, "{$this}/dependents");
321 321
     }
322 322
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      * @param null|string $token
328 328
      * @return TaskEvent[]|StoryEvent[]
329 329
      */
330
-    public function getEvents (&$token) {
330
+    public function getEvents(&$token) {
331 331
         return $this->api->sync($this, $token);
332 332
     }
333 333
 
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
      *
340 340
      * @return External
341 341
      */
342
-    public function getExternal () {
342
+    public function getExternal() {
343 343
         return $this->_get('external') ?? $this->data['external'] = $this->factory(External::class);
344 344
     }
345 345
 
346 346
     /**
347 347
      * @return Project[]
348 348
      */
349
-    public function getProjects () {
349
+    public function getProjects() {
350 350
         return array_map(function(Membership $membership) {
351 351
             return $membership->getProject();
352 352
         }, $this->getMemberships());
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      * @depends after-create
359 359
      * @return Story[]
360 360
      */
361
-    public function getStories () {
361
+    public function getStories() {
362 362
         return $this->loadAll(Story::class, "{$this}/stories");
363 363
     }
364 364
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
      * @depends after-create
369 369
      * @return Task[]
370 370
      */
371
-    public function getSubTasks () {
371
+    public function getSubTasks() {
372 372
         return $this->loadAll(self::class, "{$this}/subtasks");
373 373
     }
374 374
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      * @depends after-create
379 379
      * @return string
380 380
      */
381
-    public function getUrl (): string {
381
+    public function getUrl(): string {
382 382
         return "https://app.asana.com/0/0/{$this->getGid()}";
383 383
     }
384 384
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @depends after-create
389 389
      * @return TaskWebhook[]
390 390
      */
391
-    public function getWebhooks () {
391
+    public function getWebhooks() {
392 392
         return $this->loadAll(TaskWebhook::class, 'webhooks', [
393 393
             'workspace' => $this->getWorkspace()->getGid(),
394 394
             'resource' => $this->getGid()
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     /**
399 399
      * @return bool
400 400
      */
401
-    public function isRenderedAsSeparator (): bool {
401
+    public function isRenderedAsSeparator(): bool {
402 402
         return $this->_is('is_rendered_as_separator');
403 403
     }
404 404
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      * @depends after-create
409 409
      * @return Story
410 410
      */
411
-    public function newComment () {
411
+    public function newComment() {
412 412
         /** @var Story $comment */
413 413
         $comment = $this->factory(Story::class, ['resource_subtype' => Story::TYPE_COMMENT_ADDED]);
414 414
         return $comment->_set('task', $this);
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
      * @depends after-create
421 421
      * @return Task
422 422
      */
423
-    public function newSubTask () {
423
+    public function newSubTask() {
424 424
         /** @var Task $sub */
425 425
         $sub = $this->factory(self::class);
426 426
         return $sub->setParent($this);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
      * @param Task[] $tasks
434 434
      * @return $this
435 435
      */
436
-    public function removeDependencies (array $tasks) {
436
+    public function removeDependencies(array $tasks) {
437 437
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
438 438
         return $this;
439 439
     }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      * @param Task $task
446 446
      * @return $this
447 447
      */
448
-    public function removeDependency (Task $task) {
448
+    public function removeDependency(Task $task) {
449 449
         return $this->removeDependencies([$task]);
450 450
     }
451 451
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      * @param Task $task
457 457
      * @return $this
458 458
      */
459
-    public function removeDependent (Task $task) {
459
+    public function removeDependent(Task $task) {
460 460
         return $this->removeDependents([$task]);
461 461
     }
462 462
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
      * @param Task[] $tasks
468 468
      * @return $this
469 469
      */
470
-    public function removeDependents (array $tasks) {
470
+    public function removeDependents(array $tasks) {
471 471
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
472 472
         return $this;
473 473
     }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      * @param User $user
479 479
      * @return $this
480 480
      */
481
-    public function removeFollower (User $user) {
481
+    public function removeFollower(User $user) {
482 482
         return $this->removeFollowers([$user]);
483 483
     }
484 484
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      * @param User[] $users
491 491
      * @return $this
492 492
      */
493
-    public function removeFollowers (array $users) {
493
+    public function removeFollowers(array $users) {
494 494
         return $this->_removeWithPost("{$this}/removeFollowers", [
495 495
             'followers' => array_column($users, 'gid')
496 496
         ], 'followers', $users);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      * @param Project $project
505 505
      * @return $this
506 506
      */
507
-    public function removeFromProject (Project $project) {
507
+    public function removeFromProject(Project $project) {
508 508
         return $this->_removeWithPost("{$this}/removeProject", [
509 509
             'project' => $project->getGid()
510 510
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
      * @param Tag $tag
521 521
      * @return $this
522 522
      */
523
-    public function removeTag (Tag $tag) {
523
+    public function removeTag(Tag $tag) {
524 524
         return $this->_removeWithPost("{$this}/removeTag", [
525 525
             'tag' => $tag->getGid()
526 526
         ], 'tags', [$tag]);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param callable $filter `fn( Attachment $attachment): bool`
531 531
      * @return Attachment[]
532 532
      */
533
-    public function selectAttachments (callable $filter) {
533
+    public function selectAttachments(callable $filter) {
534 534
         return $this->_select($this->getAttachments(), $filter);
535 535
     }
536 536
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
      * @param callable $filter `fn( Story $comment ): bool`
539 539
      * @return Story[]
540 540
      */
541
-    public function selectComments (callable $filter) {
541
+    public function selectComments(callable $filter) {
542 542
         return $this->_select($this->getComments(), $filter);
543 543
     }
544 544
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
      * @param callable $filter `fn( Task $dependency ): bool`
547 547
      * @return Task[]
548 548
      */
549
-    public function selectDependencies (callable $filter) {
549
+    public function selectDependencies(callable $filter) {
550 550
         return $this->_select($this->getDependencies(), $filter);
551 551
     }
552 552
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      * @param callable $filter `fn( Task $dependent ): bool`
555 555
      * @return Task[]
556 556
      */
557
-    public function selectDependents (callable $filter) {
557
+    public function selectDependents(callable $filter) {
558 558
         return $this->_select($this->getDependents(), $filter);
559 559
     }
560 560
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
      * @param callable $filter `fn( Project $project ): bool`
563 563
      * @return Project[]
564 564
      */
565
-    public function selectProjects (callable $filter) {
565
+    public function selectProjects(callable $filter) {
566 566
         return $this->_select($this->getProjects(), $filter);
567 567
     }
568 568
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      * @param callable $filter `fn( Story $story ): bool`
571 571
      * @return Story[]
572 572
      */
573
-    public function selectStories (callable $filter) {
573
+    public function selectStories(callable $filter) {
574 574
         return $this->_select($this->getStories(), $filter);
575 575
     }
576 576
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
      * @param callable $filter `fn( Task $subtask ): bool`
579 579
      * @return Task[]
580 580
      */
581
-    public function selectSubTasks (callable $filter) {
581
+    public function selectSubTasks(callable $filter) {
582 582
         return $this->_select($this->getSubTasks(), $filter);
583 583
     }
584 584
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      * @param null|Task $parent
590 590
      * @return $this
591 591
      */
592
-    public function setParent (?self $parent) {
592
+    public function setParent(?self $parent) {
593 593
         return $this->_setWithPost("{$this}/setParent", [
594 594
             'parent' => $parent
595 595
         ], 'parent', $parent);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      * @param bool $flag
600 600
      * @return $this
601 601
      */
602
-    public function setRenderedAsSeparator (bool $flag) {
602
+    public function setRenderedAsSeparator(bool $flag) {
603 603
         return $this->_set('is_rendered_as_separator', $flag);
604 604
     }
605 605
 
Please login to merge, or discard this patch.