Passed
Push — master ( 321f29...c517f3 )
by y
01:59
created
src/Portfolio.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
         'workspace' => Workspace::class
53 53
     ];
54 54
 
55
-    final public function __toString (): string {
55
+    final public function __toString(): string {
56 56
         return "portfolios/{$this->getGid()}";
57 57
     }
58 58
 
59
-    final protected function _getDir (): string {
59
+    final protected function _getDir(): string {
60 60
         return 'portfolios';
61 61
     }
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param Project $item
66 66
      * @return $this
67 67
      */
68
-    public function addItem (Project $item) {
68
+    public function addItem(Project $item) {
69 69
         $this->api->post("{$this}/addItem", ['item' => $item->getGid()]);
70 70
         return $this;
71 71
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @param User $user
75 75
      * @return $this
76 76
      */
77
-    public function addMember (User $user) {
77
+    public function addMember(User $user) {
78 78
         return $this->addMembers([$user]);
79 79
     }
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param User[] $users
83 83
      * @return $this
84 84
      */
85
-    public function addMembers (array $users) {
85
+    public function addMembers(array $users) {
86 86
         return $this->_addWithPost("{$this}/addMembers", [
87 87
             'members' => array_column($users, 'gid')
88 88
         ], 'members', $users);
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
      * @depends after-create
93 93
      * @return Project[]
94 94
      */
95
-    public function getItems () {
95
+    public function getItems() {
96 96
         return iterator_to_array($this);
97 97
     }
98 98
 
99 99
     /**
100 100
      * @return Traversable|Project[]
101 101
      */
102
-    public function getIterator () {
102
+    public function getIterator() {
103 103
         return $this->api->loadEach($this, Project::class, "{$this}/items");
104 104
     }
105 105
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param Project $item
109 109
      * @return $this
110 110
      */
111
-    public function removeItem (Project $item) {
111
+    public function removeItem(Project $item) {
112 112
         $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]);
113 113
         return $this;
114 114
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      * @param User $user
118 118
      * @return $this
119 119
      */
120
-    public function removeMember (User $user) {
120
+    public function removeMember(User $user) {
121 121
         return $this->removeMembers([$user]);
122 122
     }
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      * @param User[] $users
126 126
      * @return $this
127 127
      */
128
-    public function removeMembers (array $users) {
128
+    public function removeMembers(array $users) {
129 129
         return $this->_removeWithPost("{$this}/removeMembers", [
130 130
             'members' => array_column($users, 'gid')
131 131
         ], 'members', $users);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * @param callable $filter `fn( Project $project ): bool`
136 136
      * @return Project[]
137 137
      */
138
-    public function selectItems (callable $filter) {
138
+    public function selectItems(callable $filter) {
139 139
         return $this->_select($this, $filter);
140 140
     }
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
src/Team.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         'organization' => Workspace::class
25 25
     ];
26 26
 
27
-    final public function __toString (): string {
27
+    final public function __toString(): string {
28 28
         return "teams/{$this->getGid()}";
29 29
     }
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param User $user
33 33
      * @return $this
34 34
      */
35
-    public function addUser (User $user) {
35
+    public function addUser(User $user) {
36 36
         $this->api->post("{$this}/addUser", ['user' => $user->getGid()]);
37 37
         return $this;
38 38
     }
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
      * @param array $filter
46 46
      * @return Project[]
47 47
      */
48
-    public function getProjects (array $filter = Project::FILTER_ACTIVE) {
48
+    public function getProjects(array $filter = Project::FILTER_ACTIVE) {
49 49
         return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter);
50 50
     }
51 51
 
52
-    public function getUrl (): string {
52
+    public function getUrl(): string {
53 53
         return "https://app.asana.com/0/{$this->getGid()}/overview";
54 54
     }
55 55
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return User[]
62 62
      */
63
-    public function getUsers () {
63
+    public function getUsers() {
64 64
         return $this->api->loadAll($this, User::class, "{$this}/users");
65 65
     }
66 66
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param User $user
69 69
      * @return $this
70 70
      */
71
-    public function removeUser (User $user) {
71
+    public function removeUser(User $user) {
72 72
         $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]);
73 73
         return $this;
74 74
     }
Please login to merge, or discard this patch.
src/Tag.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,25 +33,25 @@
 block discarded – undo
33 33
         'workspace' => Workspace::class
34 34
     ];
35 35
 
36
-    final public function __toString (): string {
36
+    final public function __toString(): string {
37 37
         return "tags/{$this->getGid()}";
38 38
     }
39 39
 
40
-    final protected function _getDir (): string {
40
+    final protected function _getDir(): string {
41 41
         return 'tags';
42 42
     }
43 43
 
44 44
     /**
45 45
      * @return Traversable|Task[]
46 46
      */
47
-    public function getIterator () {
47
+    public function getIterator() {
48 48
         return $this->api->loadEach($this, Task::class, "{$this}/tasks");
49 49
     }
50 50
 
51 51
     /**
52 52
      * @return Task[]
53 53
      */
54
-    public function getTasks () {
54
+    public function getTasks() {
55 55
         return iterator_to_array($this);
56 56
     }
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
src/Task/Attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         'parent' => Task::class
33 33
     ];
34 34
 
35
-    final public function __toString (): string {
35
+    final public function __toString(): string {
36 36
         return "attachments/{$this->getGid()}";
37 37
     }
38 38
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param string $file
45 45
      * @return $this
46 46
      */
47
-    public function upload (string $file) {
47
+    public function upload(string $file) {
48 48
         // api returns compact version. reload.
49 49
         /** @var array $remote */
50 50
         $remote = $this->api->upload($file, "{$this->getParent()}/attachments");
Please login to merge, or discard this patch.
src/CustomField.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
         'enum_options' => [EnumOption::class],
41 41
     ];
42 42
 
43
-    final public function __toString (): string {
43
+    final public function __toString(): string {
44 44
         return "custom_fields/{$this->getGid()}";
45 45
     }
46 46
 
47
-    final protected function _getDir (): string {
47
+    final protected function _getDir(): string {
48 48
         return 'custom_fields';
49 49
     }
50 50
 
51
-    protected function _setData (array $data): void {
51
+    protected function _setData(array $data): void {
52 52
         // deprecated for resource_subtype. also removing to conceptually separate from FieldValue
53 53
         unset($data['type']);
54 54
         parent::_setData($data);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param string $name
63 63
      * @return EnumOption
64 64
      */
65
-    public function addEnumOption (string $name) {
65
+    public function addEnumOption(string $name) {
66 66
         /** @var EnumOption $option */
67 67
         $option = $this->api->factory($this, EnumOption::class);
68 68
         $option->setName($name);
@@ -78,35 +78,35 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * @return bool
80 80
      */
81
-    public function hasNotificationsEnabled (): bool {
81
+    public function hasNotificationsEnabled(): bool {
82 82
         return $this->_is('has_notifications_enabled');
83 83
     }
84 84
 
85 85
     /**
86 86
      * @return bool
87 87
      */
88
-    final public function isEnum (): bool {
88
+    final public function isEnum(): bool {
89 89
         return $this->getResourceSubtype() === self::TYPE_ENUM;
90 90
     }
91 91
 
92 92
     /**
93 93
      * @return bool
94 94
      */
95
-    public function isGlobalToWorkspace (): bool {
95
+    public function isGlobalToWorkspace(): bool {
96 96
         return $this->_is('is_global_to_workspace');
97 97
     }
98 98
 
99 99
     /**
100 100
      * @return bool
101 101
      */
102
-    final public function isNumber (): bool {
102
+    final public function isNumber(): bool {
103 103
         return $this->getResourceSubtype() === self::TYPE_NUMBER;
104 104
     }
105 105
 
106 106
     /**
107 107
      * @return bool
108 108
      */
109
-    final public function isText (): bool {
109
+    final public function isText(): bool {
110 110
         return $this->getResourceSubtype() === self::TYPE_TEXT;
111 111
     }
112 112
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param bool $flag
115 115
      * @return $this
116 116
      */
117
-    public function setGlobalToWorkspace (bool $flag) {
117
+    public function setGlobalToWorkspace(bool $flag) {
118 118
         return $this->_set('is_global_to_workspace', $flag);
119 119
     }
120 120
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param bool $flag
123 123
      * @return $this
124 124
      */
125
-    public function setNotificationsEnabled (bool $flag) {
125
+    public function setNotificationsEnabled(bool $flag) {
126 126
         return $this->_set('has_notifications_enabled', $flag);
127 127
     }
128 128
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int`
131 131
      * @return $this
132 132
      */
133
-    public function sortEnumOptions (callable $cmp) {
133
+    public function sortEnumOptions(callable $cmp) {
134 134
         if ($options = $this->getEnumOptions()) {
135 135
             $prev = $options[0]; // first option on remote
136 136
             usort($options, $cmp);
Please login to merge, or discard this patch.
src/Project/Section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         'project' => Project::class
31 31
     ];
32 32
 
33
-    final public function __toString (): string {
33
+    final public function __toString(): string {
34 34
         return "sections/{$this->getGid()}";
35 35
     }
36 36
 
37
-    final protected function _getDir (): string {
37
+    final protected function _getDir(): string {
38 38
         return "{$this->getProject()}/sections";
39 39
     }
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param array $filter
43 43
      * @return Traversable|Task[]
44 44
      */
45
-    public function getIterator (array $filter = []) {
45
+    public function getIterator(array $filter = []) {
46 46
         $filter['section'] = $this->getGid();
47 47
         return $this->api->loadEach($this, Task::class, 'tasks', $filter);
48 48
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param array $filter
52 52
      * @return Task[]
53 53
      */
54
-    public function getTasks (array $filter = []) {
54
+    public function getTasks(array $filter = []) {
55 55
         return iterator_to_array($this->getIterator($filter));
56 56
     }
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @depends after-create
62 62
      * @return Task
63 63
      */
64
-    public function newTask () {
64
+    public function newTask() {
65 65
         /** @var Task $task */
66 66
         $task = $this->api->factory($this, Task::class);
67 67
         return $task->addToProject($this->getProject(), $this);
Please login to merge, or discard this patch.
src/Workspace.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     const TYPE = 'workspace';
29 29
 
30
-    final public function __toString (): string {
30
+    final public function __toString(): string {
31 31
         return "workspaces/{$this->getGid()}";
32 32
     }
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return OrganizationExport
38 38
      */
39
-    public function export () {
39
+    public function export() {
40 40
         /** @var OrganizationExport $export */
41 41
         $export = $this->api->factory($this, OrganizationExport::class);
42 42
         return $export->create($this);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param int $limit 1-100
57 57
      * @return array|AbstractEntity[]
58 58
      */
59
-    protected function find (string $class, string $text, int $limit = 20) {
59
+    protected function find(string $class, string $text, int $limit = 20) {
60 60
         return $this->api->loadAll($this, $class, "{$this}/typeahead", [
61 61
             'resource_type' => $class::TYPE,
62 62
             'query' => $text,
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param int $limit 1-100
72 72
      * @return CustomField[]
73 73
      */
74
-    public function findCustomFields (string $text, int $limit = 20) {
74
+    public function findCustomFields(string $text, int $limit = 20) {
75 75
         return $this->find(CustomField::class, $text, $limit);
76 76
     }
77 77
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param int $limit 1-100
83 83
      * @return Portfolio[]
84 84
      */
85
-    public function findPortfolios (string $text, int $limit = 20) {
85
+    public function findPortfolios(string $text, int $limit = 20) {
86 86
         return $this->find(Portfolio::class, $text, $limit);
87 87
     }
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * @param int $limit 1-100
94 94
      * @return Project[]
95 95
      */
96
-    public function findProjects (string $text, int $limit = 20) {
96
+    public function findProjects(string $text, int $limit = 20) {
97 97
         return $this->find(Project::class, $text, $limit);
98 98
     }
99 99
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param int $limit 1-100
105 105
      * @return Tag[]
106 106
      */
107
-    public function findTags (string $text, int $limit = 20) {
107
+    public function findTags(string $text, int $limit = 20) {
108 108
         return $this->find(Tag::class, $text, $limit);
109 109
     }
110 110
 
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
      * @param int $limit 1-100
116 116
      * @return Task[]
117 117
      */
118
-    public function findTasks (string $text, int $limit = 20) {
118
+    public function findTasks(string $text, int $limit = 20) {
119 119
         return $this->find(Task::class, $text, $limit);
120 120
     }
121 121
 
122 122
     /**
123 123
      * @return CustomField[]
124 124
      */
125
-    public function getCustomFields () {
125
+    public function getCustomFields() {
126 126
         return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields");
127 127
     }
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return Portfolio[]
135 135
      */
136
-    public function getPortfolios () {
136
+    public function getPortfolios() {
137 137
         return $this->api->loadAll($this, Portfolio::class, "portfolios", [
138 138
             'workspace' => $this->getGid(),
139 139
             'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required.
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @param array $filter
147 147
      * @return Project[]
148 148
      */
149
-    public function getProjects (array $filter = Project::FILTER_ACTIVE) {
149
+    public function getProjects(array $filter = Project::FILTER_ACTIVE) {
150 150
         $filter['workspace'] = $this->getGid();
151 151
         return $this->api->loadAll($this, Project::class, 'projects', $filter);
152 152
     }
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
     /**
155 155
      * @return Tag[]
156 156
      */
157
-    public function getTags () {
157
+    public function getTags() {
158 158
         return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]);
159 159
     }
160 160
 
161 161
     /**
162 162
      * @return Team[]
163 163
      */
164
-    public function getTeams () {
164
+    public function getTeams() {
165 165
         return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams");
166 166
     }
167 167
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param string $email
170 170
      * @return null|User
171 171
      */
172
-    public function getUserByEmail (string $email) {
172
+    public function getUserByEmail(string $email) {
173 173
         return $this->api->getCache()->get("users/{$email}", $this, function() use ($email) {
174 174
             foreach ($this->getUsers() as $user) {
175 175
                 if ($user->getEmail() === $email) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     /**
184 184
      * @return User[]
185 185
      */
186
-    public function getUsers () {
186
+    public function getUsers() {
187 187
         return $this->api->loadAll($this, User::class, "{$this}/users");
188 188
     }
189 189
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      *
193 193
      * @return ProjectWebhook[]|TaskWebhook[]
194 194
      */
195
-    public function getWebhooks () {
195
+    public function getWebhooks() {
196 196
         /** @var array $all */
197 197
         $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']);
198 198
         return array_map(function(array $each) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     /**
210 210
      * @return bool
211 211
      */
212
-    public function isOrganization (): bool {
212
+    public function isOrganization(): bool {
213 213
         return $this->_is('is_organization');
214 214
     }
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      *
219 219
      * @return CustomField
220 220
      */
221
-    public function newCustomField () {
221
+    public function newCustomField() {
222 222
         /** @var CustomField $field */
223 223
         $field = $this->api->factory($this, CustomField::class);
224 224
         return $field->setWorkspace($this);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @return Portfolio
231 231
      */
232
-    public function newPortfolio () {
232
+    public function newPortfolio() {
233 233
         /** @var Portfolio $portfolio */
234 234
         $portfolio = $this->api->factory($this, Portfolio::class);
235 235
         return $portfolio->setWorkspace($this);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      *
241 241
      * @return Project
242 242
      */
243
-    public function newProject () {
243
+    public function newProject() {
244 244
         /** @var Project $project */
245 245
         $project = $this->api->factory($this, Project::class);
246 246
         return $project->setWorkspace($this);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      *
252 252
      * @return Tag
253 253
      */
254
-    public function newTag () {
254
+    public function newTag() {
255 255
         /** @var Tag $tag */
256 256
         $tag = $this->api->factory($this, Tag::class);
257 257
         return $tag->setWorkspace($this);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      *
263 263
      * @return Task
264 264
      */
265
-    public function newTask () {
265
+    public function newTask() {
266 266
         /** @var Task $task */
267 267
         $task = $this->api->factory($this, Task::class);
268 268
         return $task->setWorkspace($this);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param callable $filter `fn( CustomField $field ): bool`
273 273
      * @return CustomField[]
274 274
      */
275
-    public function selectCustomFields (callable $filter) {
275
+    public function selectCustomFields(callable $filter) {
276 276
         return $this->_select($this->getCustomFields(), $filter);
277 277
     }
278 278
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * @param callable $filter `fn( Portfolio $portfolio ): bool`
281 281
      * @return Portfolio[]
282 282
      */
283
-    public function selectPortfolios (callable $filter) {
283
+    public function selectPortfolios(callable $filter) {
284 284
         return $this->_select($this->getPortfolios(), $filter);
285 285
     }
286 286
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      * @param callable $filter `fn( Project $project ): bool`
289 289
      * @return Project[]
290 290
      */
291
-    public function selectProjects (callable $filter) {
291
+    public function selectProjects(callable $filter) {
292 292
         return $this->_select($this->getProjects([]), $filter);
293 293
     }
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      * @param callable $filter `fn( Tag $tag ): bool`
297 297
      * @return Tag[]
298 298
      */
299
-    public function selectTags (callable $filter) {
299
+    public function selectTags(callable $filter) {
300 300
         return $this->_select($this->getTags(), $filter);
301 301
     }
302 302
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param callable $filter `fn( Team $team ): bool`
305 305
      * @return Team[]
306 306
      */
307
-    public function selectTeams (callable $filter) {
307
+    public function selectTeams(callable $filter) {
308 308
         return $this->_select($this->getTeams(), $filter);
309 309
     }
310 310
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * @param callable $filter
313 313
      * @return User[]
314 314
      */
315
-    public function selectUsers (callable $filter) {
315
+    public function selectUsers(callable $filter) {
316 316
         return $this->_select($this->getUsers(), $filter);
317 317
     }
318 318
 }
319 319
\ No newline at end of file
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
      */
78 78
     private $defaultSection;
79 79
 
80
-    final public function __toString (): string {
80
+    final public function __toString(): string {
81 81
         return "projects/{$this->getGid()}";
82 82
     }
83 83
 
84
-    final protected function _getDir (): string {
84
+    final protected function _getDir(): string {
85 85
         return 'projects';
86 86
     }
87 87
 
88
-    protected function _setData (array $data): void {
88
+    protected function _setData(array $data): void {
89 89
         // this is always empty. fields are in the settings, values are in tasks.
90 90
         unset($data['custom_fields']);
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param User $user
101 101
      * @return $this
102 102
      */
103
-    public function addMember (User $user) {
103
+    public function addMember(User $user) {
104 104
         return $this->addMembers([$user]);
105 105
     }
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param User[] $users
110 110
      * @return $this
111 111
      */
112
-    public function addMembers (array $users) {
112
+    public function addMembers(array $users) {
113 113
         return $this->_addWithPost("{$this}/addMembers", [
114 114
             'members' => array_column($users, 'gid')
115 115
         ], 'members', $users);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @param string $target
121 121
      * @return ProjectWebhook
122 122
      */
123
-    public function addWebhook (string $target) {
123
+    public function addWebhook(string $target) {
124 124
         /** @var ProjectWebhook $webhook */
125 125
         $webhook = $this->api->factory($this, ProjectWebhook::class);
126 126
         return $webhook->create($this, $target);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      * @param array $schedule
146 146
      * @return Job
147 147
      */
148
-    public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) {
148
+    public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) {
149 149
         $data = ['name' => $name];
150 150
         if ($team) {
151 151
             $data['team'] = $team->getGid();
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @depends after-create
165 165
      * @return Section
166 166
      */
167
-    public function getDefaultSection () {
167
+    public function getDefaultSection() {
168 168
         return $this->defaultSection ??
169 169
             $this->defaultSection = $this->api->loadAll($this, Section::class, "{$this}/sections", ['limit' => 1])[0];
170 170
     }
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
      * @param null|string $token
177 177
      * @return Event[]
178 178
      */
179
-    public function getEvents (&$token) {
179
+    public function getEvents(&$token) {
180 180
         return $this->api->sync($this, $token);
181 181
     }
182 182
 
183 183
     /**
184 184
      * @return Traversable|Section[]
185 185
      */
186
-    public function getIterator () {
186
+    public function getIterator() {
187 187
         return $this->api->loadEach($this, Section::class, "{$this}/sections");
188 188
     }
189 189
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @depends after-create
192 192
      * @return Section[]
193 193
      */
194
-    public function getSections () {
194
+    public function getSections() {
195 195
         return iterator_to_array($this);
196 196
     }
197 197
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      * @depends after-create
200 200
      * @return Status[]
201 201
      */
202
-    public function getStatuses () {
202
+    public function getStatuses() {
203 203
         return $this->api->loadAll($this, Status::class, "{$this}/project_statuses");
204 204
     }
205 205
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      * @param array $filter
211 211
      * @return Task[]
212 212
      */
213
-    public function getTasks (array $filter = []) {
213
+    public function getTasks(array $filter = []) {
214 214
         $filter['project'] = $this->getGid();
215 215
         return $this->api->loadAll($this, Task::class, "tasks", $filter);
216 216
     }
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
      * @depends after-create
220 220
      * @return string
221 221
      */
222
-    public function getUrl (): string {
222
+    public function getUrl(): string {
223 223
         return "https://app.asana.com/0/{$this->getGid()}";
224 224
     }
225 225
 
226 226
     /**
227 227
      * @return ProjectWebhook[]
228 228
      */
229
-    public function getWebhooks () {
229
+    public function getWebhooks() {
230 230
         return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [
231 231
             'workspace' => $this->getWorkspace()->getGid(),
232 232
             'resource' => $this->getGid()
233 233
         ]);
234 234
     }
235 235
 
236
-    public function isBoard (): bool {
236
+    public function isBoard(): bool {
237 237
         return $this->getLayout() === self::LAYOUT_BOARD;
238 238
     }
239 239
 
240
-    public function isList (): bool {
240
+    public function isList(): bool {
241 241
         return $this->getLayout() === self::LAYOUT_LIST;
242 242
     }
243 243
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @depends after-create
246 246
      * @return Section
247 247
      */
248
-    public function newSection () {
248
+    public function newSection() {
249 249
         return $this->api->factory($this, Section::class, ['project' => $this]);
250 250
     }
251 251
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * @depends after-create
254 254
      * @return Status
255 255
      */
256
-    public function newStatus () {
256
+    public function newStatus() {
257 257
         return $this->api->factory($this, Status::class);
258 258
     }
259 259
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      * @depends after-create
264 264
      * @return Task
265 265
      */
266
-    public function newTask () {
266
+    public function newTask() {
267 267
         return $this->getDefaultSection()->newTask();
268 268
     }
269 269
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param User $user
273 273
      * @return $this
274 274
      */
275
-    public function removeMember (User $user) {
275
+    public function removeMember(User $user) {
276 276
         return $this->removeMembers([$user]);
277 277
     }
278 278
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @param User[] $users
282 282
      * @return $this
283 283
      */
284
-    public function removeMembers (array $users) {
284
+    public function removeMembers(array $users) {
285 285
         return $this->_removeWithPost("{$this}/removeMembers", [
286 286
             'members' => array_column($users, 'gid')
287 287
         ], 'members', $users);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      * @param callable $filter `fn( Section $section ): bool`
292 292
      * @return Section[]
293 293
      */
294
-    public function selectSections (callable $filter) {
294
+    public function selectSections(callable $filter) {
295 295
         return $this->_select($this->getSections(), $filter);
296 296
     }
297 297
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @param callable $filter `fn( Status $status ): bool`
300 300
      * @return Status[]
301 301
      */
302
-    public function selectStatuses (callable $filter) {
302
+    public function selectStatuses(callable $filter) {
303 303
         return $this->_select($this->getStatuses(), $filter);
304 304
     }
305 305
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * @param array $apiFilter Pre-filter given to the API to reduce network load.
309 309
      * @return Task[]
310 310
      */
311
-    public function selectTasks (callable $filter, array $apiFilter = []) {
311
+    public function selectTasks(callable $filter, array $apiFilter = []) {
312 312
         return $this->_select($this->getTasks($apiFilter), $filter);
313 313
     }
314 314
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @param null|Team $team
318 318
      * @return $this
319 319
      */
320
-    public function setTeam (?Team $team) {
320
+    public function setTeam(?Team $team) {
321 321
         if ($team and !$this->hasWorkspace()) {
322 322
             $this->setWorkspace($team->getOrganization());
323 323
         }
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
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
         'memberships' => 'memberships.(project|section)'
99 99
     ];
100 100
 
101
-    final public function __toString (): string {
101
+    final public function __toString(): string {
102 102
         return "tasks/{$this->getGid()}";
103 103
     }
104 104
 
105
-    final protected function _getDir (): string {
105
+    final protected function _getDir(): string {
106 106
         return 'tasks';
107 107
     }
108 108
 
109
-    protected function _save (string $dir = null) {
109
+    protected function _save(string $dir = null) {
110 110
         parent::_save($dir);
111 111
         // use isset() to avoid has() fetch.
112 112
         if (isset($this->data['custom_fields'])) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         return $this;
119 119
     }
120 120
 
121
-    protected function _setData (array $data): void {
121
+    protected function _setData(array $data): void {
122 122
         // hearts were deprecated for likes
123 123
         unset($data['hearted'], $data['hearts'], $data['num_hearts']);
124 124
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @param string $file
139 139
      * @return Attachment
140 140
      */
141
-    public function addAttachment (string $file) {
141
+    public function addAttachment(string $file) {
142 142
         /** @var Attachment $attachment */
143 143
         $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]);
144 144
         return $attachment->upload($file);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @param string $text
151 151
      * @return Story
152 152
      */
153
-    public function addComment (string $text) {
153
+    public function addComment(string $text) {
154 154
         return $this->newComment()->setText($text)->create();
155 155
     }
156 156
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param Task[] $tasks
162 162
      * @return $this
163 163
      */
164
-    public function addDependencies (array $tasks) {
164
+    public function addDependencies(array $tasks) {
165 165
         $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]);
166 166
         return $this;
167 167
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @param Task $task
174 174
      * @return $this
175 175
      */
176
-    public function addDependency (Task $task) {
176
+    public function addDependency(Task $task) {
177 177
         return $this->addDependencies([$task]);
178 178
     }
179 179
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param Task $task
185 185
      * @return $this
186 186
      */
187
-    public function addDependent (Task $task) {
187
+    public function addDependent(Task $task) {
188 188
         return $this->addDependents([$task]);
189 189
     }
190 190
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      * @param Task[] $tasks
196 196
      * @return $this
197 197
      */
198
-    public function addDependents (array $tasks) {
198
+    public function addDependents(array $tasks) {
199 199
         $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]);
200 200
         return $this;
201 201
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      * @param User $user
207 207
      * @return $this
208 208
      */
209
-    public function addFollower (User $user) {
209
+    public function addFollower(User $user) {
210 210
         return $this->addFollowers([$user]);
211 211
     }
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param User[] $users
219 219
      * @return $this
220 220
      */
221
-    public function addFollowers (array $users) {
221
+    public function addFollowers(array $users) {
222 222
         return $this->_addWithPost("{$this}/addFollowers", [
223 223
             'followers' => array_column($users, 'gid')
224 224
         ], 'followers', $users);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @param Tag $tag
233 233
      * @return $this
234 234
      */
235
-    public function addTag (Tag $tag) {
235
+    public function addTag(Tag $tag) {
236 236
         return $this->_addWithPost("{$this}/addTag", [
237 237
             'tag' => $tag->getGid()
238 238
         ], 'tags', [$tag]);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param Section|null $section
248 248
      * @return $this
249 249
      */
250
-    public function addToProject (Project $project, Section $section = null) {
250
+    public function addToProject(Project $project, Section $section = null) {
251 251
         /** @var Membership $membership */
252 252
         $membership = $this->api->factory($this, Membership::class)
253 253
             ->_set('project', $project)
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @param string $target
263 263
      * @return TaskWebhook
264 264
      */
265
-    public function addWebhook (string $target) {
265
+    public function addWebhook(string $target) {
266 266
         /** @var TaskWebhook $webhook */
267 267
         $webhook = $this->api->factory($this, TaskWebhook::class);
268 268
         return $webhook->create($this, $target);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @param string[] $include
279 279
      * @return Job
280 280
      */
281
-    public function duplicate (string $name, array $include) {
281
+    public function duplicate(string $name, array $include) {
282 282
         /** @var array $remote */
283 283
         $remote = $this->api->post("{$this}/duplicate", [
284 284
             'name' => $name,
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * @depends after-create
294 294
      * @return Attachment[]
295 295
      */
296
-    public function getAttachments () {
296
+    public function getAttachments() {
297 297
         return $this->api->loadAll($this, Attachment::class, "{$this}/attachments");
298 298
     }
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      * @depends after-create
304 304
      * @return Story[]
305 305
      */
306
-    public function getComments () {
306
+    public function getComments() {
307 307
         return $this->selectStories(function(Story $story) {
308 308
             return $story->isComment();
309 309
         });
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      * @depends after-create
316 316
      * @return Task[]
317 317
      */
318
-    public function getDependencies () {
318
+    public function getDependencies() {
319 319
         return $this->api->loadAll($this, self::class, "{$this}/dependencies");
320 320
     }
321 321
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      * @depends after-create
326 326
      * @return Task[]
327 327
      */
328
-    public function getDependents () {
328
+    public function getDependents() {
329 329
         return $this->api->loadAll($this, self::class, "{$this}/dependents");
330 330
     }
331 331
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param null|string $token
337 337
      * @return Event[]
338 338
      */
339
-    public function getEvents (&$token) {
339
+    public function getEvents(&$token) {
340 340
         return $this->api->sync($this, $token);
341 341
     }
342 342
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @return External
350 350
      */
351
-    public function getExternal () {
351
+    public function getExternal() {
352 352
         return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class);
353 353
     }
354 354
 
355 355
     /**
356 356
      * @return Project[]
357 357
      */
358
-    public function getProjects () {
358
+    public function getProjects() {
359 359
         return array_map(function(Membership $membership) {
360 360
             return $membership->getProject();
361 361
         }, $this->getMemberships());
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      * @depends after-create
368 368
      * @return Story[]
369 369
      */
370
-    public function getStories () {
370
+    public function getStories() {
371 371
         return $this->api->loadAll($this, Story::class, "{$this}/stories");
372 372
     }
373 373
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
      * @depends after-create
378 378
      * @return Task[]
379 379
      */
380
-    public function getSubTasks () {
380
+    public function getSubTasks() {
381 381
         return $this->api->loadAll($this, self::class, "{$this}/subtasks");
382 382
     }
383 383
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
      * @depends after-create
388 388
      * @return string
389 389
      */
390
-    public function getUrl (): string {
390
+    public function getUrl(): string {
391 391
         return "https://app.asana.com/0/0/{$this->getGid()}";
392 392
     }
393 393
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      * @depends after-create
398 398
      * @return TaskWebhook[]
399 399
      */
400
-    public function getWebhooks () {
400
+    public function getWebhooks() {
401 401
         return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [
402 402
             'workspace' => $this->getWorkspace()->getGid(),
403 403
             'resource' => $this->getGid()
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * @return bool
409 409
      */
410
-    public function isRenderedAsSeparator (): bool {
410
+    public function isRenderedAsSeparator(): bool {
411 411
         return $this->_is('is_rendered_as_separator');
412 412
     }
413 413
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      * @depends after-create
418 418
      * @return Story
419 419
      */
420
-    public function newComment () {
420
+    public function newComment() {
421 421
         return $this->api->factory($this, Story::class, [
422 422
             'resource_subtype' => Story::TYPE_COMMENT_ADDED,
423 423
             'target' => $this
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      * @depends after-create
431 431
      * @return Task
432 432
      */
433
-    public function newSubTask () {
433
+    public function newSubTask() {
434 434
         /** @var Task $sub */
435 435
         $sub = $this->api->factory($this, self::class);
436 436
         return $sub->setParent($this);
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      * @param Task[] $tasks
444 444
      * @return $this
445 445
      */
446
-    public function removeDependencies (array $tasks) {
446
+    public function removeDependencies(array $tasks) {
447 447
         $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]);
448 448
         return $this;
449 449
     }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      * @param Task $task
456 456
      * @return $this
457 457
      */
458
-    public function removeDependency (Task $task) {
458
+    public function removeDependency(Task $task) {
459 459
         return $this->removeDependencies([$task]);
460 460
     }
461 461
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param Task $task
467 467
      * @return $this
468 468
      */
469
-    public function removeDependent (Task $task) {
469
+    public function removeDependent(Task $task) {
470 470
         return $this->removeDependents([$task]);
471 471
     }
472 472
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      * @param Task[] $tasks
478 478
      * @return $this
479 479
      */
480
-    public function removeDependents (array $tasks) {
480
+    public function removeDependents(array $tasks) {
481 481
         $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]);
482 482
         return $this;
483 483
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
      * @param User $user
489 489
      * @return $this
490 490
      */
491
-    public function removeFollower (User $user) {
491
+    public function removeFollower(User $user) {
492 492
         return $this->removeFollowers([$user]);
493 493
     }
494 494
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @param User[] $users
501 501
      * @return $this
502 502
      */
503
-    public function removeFollowers (array $users) {
503
+    public function removeFollowers(array $users) {
504 504
         return $this->_removeWithPost("{$this}/removeFollowers", [
505 505
             'followers' => array_column($users, 'gid')
506 506
         ], 'followers', $users);
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      * @param Project $project
515 515
      * @return $this
516 516
      */
517
-    public function removeFromProject (Project $project) {
517
+    public function removeFromProject(Project $project) {
518 518
         return $this->_removeWithPost("{$this}/removeProject", [
519 519
             'project' => $project->getGid()
520 520
         ], 'memberships', function(Membership $membership) use ($project) {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param Tag $tag
531 531
      * @return $this
532 532
      */
533
-    public function removeTag (Tag $tag) {
533
+    public function removeTag(Tag $tag) {
534 534
         return $this->_removeWithPost("{$this}/removeTag", [
535 535
             'tag' => $tag->getGid()
536 536
         ], 'tags', [$tag]);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      * @param callable $filter `fn( Attachment $attachment): bool`
541 541
      * @return Attachment[]
542 542
      */
543
-    public function selectAttachments (callable $filter) {
543
+    public function selectAttachments(callable $filter) {
544 544
         return $this->_select($this->getAttachments(), $filter);
545 545
     }
546 546
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
      * @param callable $filter `fn( Story $comment ): bool`
549 549
      * @return Story[]
550 550
      */
551
-    public function selectComments (callable $filter) {
551
+    public function selectComments(callable $filter) {
552 552
         return $this->_select($this->getComments(), $filter);
553 553
     }
554 554
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param callable $filter `fn( Task $dependency ): bool`
557 557
      * @return Task[]
558 558
      */
559
-    public function selectDependencies (callable $filter) {
559
+    public function selectDependencies(callable $filter) {
560 560
         return $this->_select($this->getDependencies(), $filter);
561 561
     }
562 562
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      * @param callable $filter `fn( Task $dependent ): bool`
565 565
      * @return Task[]
566 566
      */
567
-    public function selectDependents (callable $filter) {
567
+    public function selectDependents(callable $filter) {
568 568
         return $this->_select($this->getDependents(), $filter);
569 569
     }
570 570
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      * @param callable $filter `fn( Project $project ): bool`
573 573
      * @return Project[]
574 574
      */
575
-    public function selectProjects (callable $filter) {
575
+    public function selectProjects(callable $filter) {
576 576
         return $this->_select($this->getProjects(), $filter);
577 577
     }
578 578
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      * @param callable $filter `fn( Story $story ): bool`
581 581
      * @return Story[]
582 582
      */
583
-    public function selectStories (callable $filter) {
583
+    public function selectStories(callable $filter) {
584 584
         return $this->_select($this->getStories(), $filter);
585 585
     }
586 586
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
      * @param callable $filter `fn( Task $subtask ): bool`
589 589
      * @return Task[]
590 590
      */
591
-    public function selectSubTasks (callable $filter) {
591
+    public function selectSubTasks(callable $filter) {
592 592
         return $this->_select($this->getSubTasks(), $filter);
593 593
     }
594 594
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      * @param null|Task $parent
600 600
      * @return $this
601 601
      */
602
-    public function setParent (?self $parent) {
602
+    public function setParent(?self $parent) {
603 603
         return $this->_setWithPost("{$this}/setParent", [
604 604
             'parent' => $parent
605 605
         ], 'parent', $parent);
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      * @param bool $flag
610 610
      * @return $this
611 611
      */
612
-    public function setRenderedAsSeparator (bool $flag) {
612
+    public function setRenderedAsSeparator(bool $flag) {
613 613
         return $this->_set('is_rendered_as_separator', $flag);
614 614
     }
615 615
 
Please login to merge, or discard this patch.