Passed
Push — master ( 4471d4...4f4c9b )
by y
01:39
created
src/Base/AbstractEntity.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @return bool
37 37
      * @internal pool
38 38
      */
39
-    final public function __merge (self $entity): bool {
39
+    final public function __merge(self $entity): bool {
40 40
         $old = $this->toArray();
41 41
         $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff));
42 42
         return $this->toArray() !== $old;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @return string
49 49
      */
50
-    final public function __toString (): string {
50
+    final public function __toString(): string {
51 51
         return static::DIR . '/' . $this->getGid();
52 52
     }
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param string $field
58 58
      * @return mixed
59 59
      */
60
-    protected function _get (string $field) {
60
+    protected function _get(string $field) {
61 61
         if (!array_key_exists($field, $this->data) and $this->hasGid()) {
62 62
             $this->_reload($field);
63 63
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     /**
68 68
      * @param string $field
69 69
      */
70
-    protected function _reload (string $field): void {
70
+    protected function _reload(string $field): void {
71 71
         assert($this->hasGid());
72 72
         $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]);
73 73
         if (!array_key_exists($field, $remote)) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $this->api->getPool()->add($this);
78 78
     }
79 79
 
80
-    protected function _setData (array $data): void {
80
+    protected function _setData(array $data): void {
81 81
         // meaningless once the entity is being created. it's constant.
82 82
         unset($data['resource_type'], $data['type']);
83 83
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     /**
88 88
      * @return null|string
89 89
      */
90
-    final public function getGid (): ?string {
90
+    final public function getGid(): ?string {
91 91
         return $this->data['gid'] ?? null;
92 92
     }
93 93
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return string[]
98 98
      */
99
-    public function getPoolKeys () {
99
+    public function getPoolKeys() {
100 100
         return [$this->getGid(), (string)$this];
101 101
     }
102 102
 
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return string
107 107
      */
108
-    final public function getResourceType (): string {
108
+    final public function getResourceType(): string {
109 109
         return static::TYPE;
110 110
     }
111 111
 
112 112
     /**
113 113
      * @return bool
114 114
      */
115
-    final public function hasGid (): bool {
115
+    final public function hasGid(): bool {
116 116
         return isset($this->data['gid']);
117 117
     }
118 118
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @return $this
123 123
      */
124
-    public function reload () {
124
+    public function reload() {
125 125
         assert($this->hasGid());
126 126
         $remote = $this->api->get($this, ['opt_expand' => 'this']);
127 127
         if (!isset($remote['gid'])) { // deleted?
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     private $defaultSection;
99 99
 
100
-    protected function _setData (array $data): void {
100
+    protected function _setData(array $data): void {
101 101
         // this is always empty. fields are in the settings, values are in tasks.
102 102
         unset($data['custom_fields']);
103 103
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param User $user
112 112
      * @return $this
113 113
      */
114
-    public function addFollower (User $user) {
114
+    public function addFollower(User $user) {
115 115
         return $this->addFollowers([$user]);
116 116
     }
117 117
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * @param User[] $users
120 120
      * @return $this
121 121
      */
122
-    public function addFollowers (array $users) {
122
+    public function addFollowers(array $users) {
123 123
         return $this->_addWithPost("{$this}/addFollowers", [
124 124
             'followers' => array_column($users, 'gid')
125 125
         ], 'followers', $users);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param User $user
130 130
      * @return $this
131 131
      */
132
-    public function addMember (User $user) {
132
+    public function addMember(User $user) {
133 133
         return $this->addMembers([$user]);
134 134
     }
135 135
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      * @param User[] $users
138 138
      * @return $this
139 139
      */
140
-    public function addMembers (array $users) {
140
+    public function addMembers(array $users) {
141 141
         return $this->_addWithPost("{$this}/addMembers", [
142 142
             'members' => array_column($users, 'gid')
143 143
         ], 'members', $users);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param array $schedule
162 162
      * @return Job
163 163
      */
164
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
164
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
165 165
         $data = ['name' => $name];
166 166
         if ($team) {
167 167
             $data['team'] = $team->getGid();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     /**
181 181
      * @return Section
182 182
      */
183
-    public function getDefaultSection () {
183
+    public function getDefaultSection() {
184 184
         return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0];
185 185
     }
186 186
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      * @param int $limit
193 193
      * @return Traversable|Section[]
194 194
      */
195
-    public function getIterator (int $limit = PHP_INT_MAX) {
195
+    public function getIterator(int $limit = PHP_INT_MAX) {
196 196
         return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]);
197 197
     }
198 198
 
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
      * @param int $limit
201 201
      * @return Section[]
202 202
      */
203
-    public function getSections (int $limit = PHP_INT_MAX) {
203
+    public function getSections(int $limit = PHP_INT_MAX) {
204 204
         return iterator_to_array($this->getIterator($limit));
205 205
     }
206 206
 
207 207
     /**
208 208
      * @return Status[]
209 209
      */
210
-    public function getStatuses () {
210
+    public function getStatuses() {
211 211
         return $this->api->loadAll($this, Status::class, "{$this}/project_statuses");
212 212
     }
213 213
 
214 214
     /**
215 215
      * @return TaskCounts
216 216
      */
217
-    public function getTaskCounts () {
217
+    public function getTaskCounts() {
218 218
         $remote = $this->api->get("{$this}/task_counts", [
219 219
             'opt_fields' => // opt_expand doesn't work.
220 220
                 'num_completed_milestones,'
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param array $filter
234 234
      * @return Task[]
235 235
      */
236
-    public function getTasks (array $filter = Task::GET_INCOMPLETE) {
236
+    public function getTasks(array $filter = Task::GET_INCOMPLETE) {
237 237
         $filter['project'] = $this->getGid();
238 238
         return $this->api->loadAll($this, Task::class, "tasks", $filter);
239 239
     }
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
     /**
242 242
      * @return string
243 243
      */
244
-    final public function getUrl (): string {
244
+    final public function getUrl(): string {
245 245
         return "https://app.asana.com/0/{$this->getGid()}";
246 246
     }
247 247
 
248 248
     /**
249 249
      * @return ProjectWebhook[]
250 250
      */
251
-    public function getWebhooks () {
251
+    public function getWebhooks() {
252 252
         return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [
253 253
             'workspace' => $this->getWorkspace()->getGid(),
254 254
             'resource' => $this->getGid()
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     /**
259 259
      * @return bool
260 260
      */
261
-    final public function isTemplate (): bool {
261
+    final public function isTemplate(): bool {
262 262
         return $this->_is('is_template');
263 263
     }
264 264
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      *
268 268
      * @return Section
269 269
      */
270
-    public function newSection () {
270
+    public function newSection() {
271 271
         return $this->api->factory($this, Section::class, ['project' => $this]);
272 272
     }
273 273
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * @return Status
278 278
      */
279
-    public function newStatus () {
279
+    public function newStatus() {
280 280
         return $this->api->factory($this, Status::class);
281 281
     }
282 282
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      *
286 286
      * @return Task
287 287
      */
288
-    public function newTask () {
288
+    public function newTask() {
289 289
         return $this->getDefaultSection()->newTask();
290 290
     }
291 291
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      *
295 295
      * @return ProjectWebhook
296 296
      */
297
-    public function newWebhook () {
297
+    public function newWebhook() {
298 298
         /** @var ProjectWebhook $webhook */
299 299
         $webhook = $this->api->factory($this, ProjectWebhook::class);
300 300
         return $webhook->setResource($this);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param User $user
305 305
      * @return $this
306 306
      */
307
-    public function removeFollower (User $user) {
307
+    public function removeFollower(User $user) {
308 308
         return $this->removeFollowers([$user]);
309 309
     }
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param User[] $users
313 313
      * @return $this
314 314
      */
315
-    public function removeFollowers (array $users) {
315
+    public function removeFollowers(array $users) {
316 316
         return $this->_removeWithPost("{$this}/removeFollowers", [
317 317
             'followers' => array_column($users, 'gid')
318 318
         ], 'followers', $users);
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @param User $user
323 323
      * @return $this
324 324
      */
325
-    public function removeMember (User $user) {
325
+    public function removeMember(User $user) {
326 326
         return $this->removeMembers([$user]);
327 327
     }
328 328
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param User[] $users
331 331
      * @return $this
332 332
      */
333
-    public function removeMembers (array $users) {
333
+    public function removeMembers(array $users) {
334 334
         return $this->_removeWithPost("{$this}/removeMembers", [
335 335
             'members' => array_column($users, 'gid')
336 336
         ], 'members', $users);
Please login to merge, or discard this patch.