Passed
Push — master ( dba318...93b4f6 )
by y
01:38
created
src/Project/Section.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 
24 24
     const TYPE = 'section';
25 25
 
26
-    final public function __toString (): string {
26
+    final public function __toString(): string {
27 27
         return "sections/{$this->getGid()}";
28 28
     }
29 29
 
30
-    final protected function _getDir (): string {
30
+    final protected function _getDir(): string {
31 31
         return "{$this->getProject()}/sections";
32 32
     }
33 33
 
34
-    protected function _getMap (): array {
34
+    protected function _getMap(): array {
35 35
         return [
36 36
             'projects' => [Project::class]
37 37
         ];
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * @return Project
42 42
      */
43
-    public function getProject () {
43
+    public function getProject() {
44 44
         return $this->_get('projects')[0];
45 45
     }
46 46
 
47 47
     /**
48 48
      * @return Task[]
49 49
      */
50
-    public function getTasks () {
50
+    public function getTasks() {
51 51
         return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]);
52 52
     }
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @depends after-create
58 58
      * @return Task
59 59
      */
60
-    public function newTask () {
60
+    public function newTask() {
61 61
         /** @var Task $task */
62 62
         $task = $this->factory(Task::class);
63 63
         return $task->addToProject($this);
Please login to merge, or discard this patch.
src/Base/Data.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param Api|Data $caller
31 31
      * @param array $data
32 32
      */
33
-    public function __construct ($caller, array $data = []) {
33
+    public function __construct($caller, array $data = []) {
34 34
         $this->api = $caller instanceof self ? $caller->api : $caller;
35 35
         $this->_setData($data);
36 36
     }
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      * @param array $args
47 47
      * @return mixed
48 48
      */
49
-    public function __call (string $method, array $args) {
49
+    public function __call(string $method, array $args) {
50 50
         static $cache = [];
51
-        if (!$call =& $cache[$method]) {
51
+        if (!$call = & $cache[$method]) {
52 52
             preg_match('/^(get|has|is|set)(.+)$/', $method, $call);
53 53
             $call[1] = '_' . $call[1];
54 54
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         return $this->{$call[1]}($call[2], ...$args);
59 59
     }
60 60
 
61
-    public function __debugInfo (): array {
61
+    public function __debugInfo(): array {
62 62
         return $this->data;
63 63
     }
64 64
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param string $key
71 71
      * @return mixed
72 72
      */
73
-    protected function _get (string $key) {
73
+    protected function _get(string $key) {
74 74
         return $this->data[$key] ?? null;
75 75
     }
76 76
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return array
84 84
      */
85
-    protected function _getMap (): array {
85
+    protected function _getMap(): array {
86 86
         return [];
87 87
     }
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param null|self|array $value
92 92
      * @return null|Data|Data[]
93 93
      */
94
-    protected function _getMapped ($class, $value) {
94
+    protected function _getMapped($class, $value) {
95 95
         // use empty|Data|Data[] as-is
96 96
         if (!$value or $value instanceof self or current($value) instanceof self) {
97 97
             return $value;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @return array
126 126
      */
127
-    protected function _getPatch (): array {
127
+    protected function _getPatch(): array {
128 128
         $convert = function($each) use (&$convert) {
129 129
             // convert existing entities to gids
130 130
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @param string $key
155 155
      * @return bool
156 156
      */
157
-    protected function _has (string $key): bool {
157
+    protected function _has(string $key): bool {
158 158
         $value = $this->_get($key);
159 159
         if (isset($value)) {
160 160
             if (is_countable($value)) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param string $key
178 178
      * @return bool
179 179
      */
180
-    protected function _is (string $key): bool {
180
+    protected function _is(string $key): bool {
181 181
         return !empty($this->_get($key));
182 182
     }
183 183
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      * @param mixed $value
191 191
      * @return $this
192 192
      */
193
-    protected function _set (string $key, $value) {
193
+    protected function _set(string $key, $value) {
194 194
         $this->data[$key] = $value;
195 195
         $this->diff[$key] = true;
196 196
         return $this;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      * @param array $data
203 203
      * @return $this
204 204
      */
205
-    protected function _setData (array $data) {
205
+    protected function _setData(array $data) {
206 206
         $map = $this->_getMap();
207 207
         /** @var null|self|array $value */
208 208
         foreach (array_intersect_key($data, $map) as $key => $value) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @param array $data
221 221
      * @return mixed
222 222
      */
223
-    final protected function factory (string $class, array $data = []) {
223
+    final protected function factory(string $class, array $data = []) {
224 224
         return $this->api->factory($class, $this, $data);
225 225
     }
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @return bool
231 231
      */
232
-    final public function isDiff (): bool {
232
+    final public function isDiff(): bool {
233 233
         return (bool)$this->diff;
234 234
     }
235 235
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      * @see toArray()
238 238
      * @return array
239 239
      */
240
-    public function jsonSerialize (): array {
240
+    public function jsonSerialize(): array {
241 241
         return $this->toArray();
242 242
     }
243 243
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * @param array $query
252 252
      * @return null|mixed|AbstractEntity
253 253
      */
254
-    final protected function load (string $class, string $path, array $query = []) {
254
+    final protected function load(string $class, string $path, array $query = []) {
255 255
         return $this->api->load($class, $this, $path, $query);
256 256
     }
257 257
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * @param int $pages
267 267
      * @return array|AbstractEntity[]
268 268
      */
269
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
269
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
270 270
         return $this->api->loadAll($class, $this, $path, $query, $pages);
271 271
     }
272 272
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return string
279 279
      */
280
-    public function serialize (): string {
280
+    public function serialize(): string {
281 281
         return serialize($this->toArray());
282 282
     }
283 283
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      *
287 287
      * @return array
288 288
      */
289
-    public function toArray (): array {
289
+    public function toArray(): array {
290 290
         if (!$this->api) {
291 291
             return $this->data;
292 292
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      *
313 313
      * @param $serialized
314 314
      */
315
-    public function unserialize ($serialized): void {
315
+    public function unserialize($serialized): void {
316 316
         $this->data = unserialize($serialized);
317 317
     }
318 318
 }
319 319
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Laravel/Facade/Asana.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,21 +49,21 @@
 block discarded – undo
49 49
     /**
50 50
      * @return Api
51 51
      */
52
-    final public static function getApi () {
52
+    final public static function getApi() {
53 53
         return static::getFacadeRoot();
54 54
     }
55 55
 
56 56
     /**
57 57
      * @return string
58 58
      */
59
-    public static function getFacadeAccessor () {
59
+    public static function getFacadeAccessor() {
60 60
         return AsanaServiceProvider::NAME;
61 61
     }
62 62
 
63 63
     /**
64 64
      * @return Api
65 65
      */
66
-    public static function getFacadeRoot () {
66
+    public static function getFacadeRoot() {
67 67
         return parent::getFacadeRoot();
68 68
     }
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
     const TYPE = 'user';
25 25
 
26
-    final public function __toString (): string {
26
+    final public function __toString(): string {
27 27
         return "users/{$this->getGid()}";
28 28
     }
29 29
 
30
-    protected function _getMap (): array {
30
+    protected function _getMap(): array {
31 31
         return [
32 32
             'photo' => Photo::class,
33 33
             'workspaces' => [Workspace::class]
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param Workspace $workspace
39 39
      * @return $this
40 40
      */
41
-    public function addToWorkspace (Workspace $workspace) {
41
+    public function addToWorkspace(Workspace $workspace) {
42 42
         $this->api->post("{$workspace}/addUser", ['user' => $this->getGid()]);
43 43
         $this->_merge('workspaces', [$workspace]);
44 44
         return $this;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param Workspace $workspace
49 49
      * @return Portfolio[]
50 50
      */
51
-    public function getFavoritePortfolios (Workspace $workspace) {
51
+    public function getFavoritePortfolios(Workspace $workspace) {
52 52
         return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace);
53 53
     }
54 54
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param Workspace $workspace
57 57
      * @return Project[]
58 58
      */
59
-    public function getFavoriteProjects (Workspace $workspace) {
59
+    public function getFavoriteProjects(Workspace $workspace) {
60 60
         return $this->getFavorites(Project::class, Project::TYPE, $workspace);
61 61
     }
62 62
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param Workspace $workspace
65 65
      * @return Tag[]
66 66
      */
67
-    public function getFavoriteTags (Workspace $workspace) {
67
+    public function getFavoriteTags(Workspace $workspace) {
68 68
         return $this->getFavorites(Tag::class, Tag::TYPE, $workspace);
69 69
     }
70 70
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param Workspace $workspace
73 73
      * @return Team[]
74 74
      */
75
-    public function getFavoriteTeams (Workspace $workspace) {
75
+    public function getFavoriteTeams(Workspace $workspace) {
76 76
         return $this->getFavorites(Team::class, Team::TYPE, $workspace);
77 77
     }
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param Workspace $workspace
81 81
      * @return User[]
82 82
      */
83
-    public function getFavoriteUsers (Workspace $workspace) {
83
+    public function getFavoriteUsers(Workspace $workspace) {
84 84
         return $this->getFavorites(self::class, self::TYPE, $workspace);
85 85
     }
86 86
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param Workspace $workspace
91 91
      * @return array
92 92
      */
93
-    protected function getFavorites (string $class, string $resourceType, Workspace $workspace) {
93
+    protected function getFavorites(string $class, string $resourceType, Workspace $workspace) {
94 94
         return $this->loadAll($class, "{$this}/favorites", [
95 95
             'resource_type' => $resourceType,
96 96
             'workspace' => $workspace->getGid()
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * @param Workspace $workspace
106 106
      * @return Task[]
107 107
      */
108
-    public function getIncompleteTasks (Workspace $workspace) {
108
+    public function getIncompleteTasks(Workspace $workspace) {
109 109
         return $this->loadAll(Task::class, 'tasks', [
110 110
             'assignee' => $this->getGid(),
111 111
             'workspace' => $workspace->getGid(),
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      * @param Workspace $workspace
118 118
      * @return Portfolio[]
119 119
      */
120
-    public function getPortfolios (Workspace $workspace) {
120
+    public function getPortfolios(Workspace $workspace) {
121 121
         return $this->loadAll(Portfolio::class, "portfolios", [
122 122
             'workspace' => $workspace->getGid(),
123 123
             'owner' => $this->getGid()
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param Workspace $workspace
129 129
      * @return TaskList
130 130
      */
131
-    public function getTaskList (Workspace $workspace) {
131
+    public function getTaskList(Workspace $workspace) {
132 132
         return $this->load(TaskList::class, "{$this}/user_task_list", [
133 133
             'workspace' => $workspace->getGid()
134 134
         ]);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @param string[] $filter
144 144
      * @return Task[]
145 145
      */
146
-    public function getTasks (Workspace $workspace, array $filter = []) {
146
+    public function getTasks(Workspace $workspace, array $filter = []) {
147 147
         $filter['assignee'] = $this->getGid();
148 148
         $filter['workspace'] = $workspace->getGid();
149 149
         return $this->loadAll(Task::class, 'tasks', $filter);
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
      * @param Workspace $organization
154 154
      * @return Team[]
155 155
      */
156
-    public function getTeams (Workspace $organization) {
156
+    public function getTeams(Workspace $organization) {
157 157
         return $this->loadAll(Team::class, "{$this}/teams", [
158 158
             'organization' => $organization->getGid()
159 159
         ]);
160 160
     }
161 161
 
162
-    public function getUrl (): string {
162
+    public function getUrl(): string {
163 163
         return "https://app.asana.com/0/{$this->getGid()}/list";
164 164
     }
165 165
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      * @param Workspace $workspace
168 168
      * @return $this
169 169
      */
170
-    public function removeFromWorkspace (Workspace $workspace) {
170
+    public function removeFromWorkspace(Workspace $workspace) {
171 171
         $this->api->post("{$workspace}/removeUser", ['user' => $this->getGid()]);
172 172
         $this->_remove('workspaces', [$workspace]);
173 173
         return $this;
Please login to merge, or discard this patch.
src/Api.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * @param string $token
42 42
      */
43
-    public function __construct (string $token) {
43
+    public function __construct(string $token) {
44 44
         $this->token = $token;
45 45
         $this->cache = new Cache();
46 46
         $this->logger = new Logger();
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @param string $path
53 53
      */
54
-    public function delete (string $path): void {
54
+    public function delete(string $path): void {
55 55
         $this->exec('DELETE', $path);
56 56
     }
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @return null|array
63 63
      * @internal
64 64
      */
65
-    protected function exec (string $method, string $path, array $opts = null) {
65
+    protected function exec(string $method, string $path, array $opts = null) {
66 66
         $ch = curl_init();
67 67
         curl_setopt_array($ch, [
68 68
             CURLOPT_CUSTOMREQUEST => $method,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @param array $data
114 114
      * @return mixed
115 115
      */
116
-    public function factory (string $class, $caller, array $data = []) {
116
+    public function factory(string $class, $caller, array $data = []) {
117 117
         return new $class($caller, $data);
118 118
     }
119 119
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      * @param array $options
126 126
      * @return null|array
127 127
      */
128
-    public function get (string $path, array $query = [], array $options = []) {
128
+    public function get(string $path, array $query = [], array $options = []) {
129 129
         foreach ($options as $name => $value) {
130 130
             $query["opt_{$name}"] = $value;
131 131
         }
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
      * @param string $gid
140 140
      * @return null|Attachment
141 141
      */
142
-    public function getAttachment (string $gid) {
142
+    public function getAttachment(string $gid) {
143 143
         return $this->load(Attachment::class, $this, "attachments/{$gid}");
144 144
     }
145 145
 
146 146
     /**
147 147
      * @return Cache
148 148
      */
149
-    public function getCache () {
149
+    public function getCache() {
150 150
         return $this->cache;
151 151
     }
152 152
 
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
      * @param string $gid
157 157
      * @return null|CustomField
158 158
      */
159
-    public function getCustomField (string $gid) {
159
+    public function getCustomField(string $gid) {
160 160
         return $this->load(CustomField::class, $this, "custom_fields/{$gid}");
161 161
     }
162 162
 
163 163
     /**
164 164
      * @return LoggerInterface
165 165
      */
166
-    public function getLogger () {
166
+    public function getLogger() {
167 167
         return $this->logger;
168 168
     }
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @return User
174 174
      */
175
-    public function getMe () {
175
+    public function getMe() {
176 176
         return $this->getUser('me');
177 177
     }
178 178
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param array $query
184 184
      * @return string
185 185
      */
186
-    protected function getPath (string $path, array $query): string {
186
+    protected function getPath(string $path, array $query): string {
187 187
         return $query ? $path . '?' . http_build_query($query) : $path;
188 188
     }
189 189
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param string $gid
194 194
      * @return null|Portfolio
195 195
      */
196
-    public function getPortfolio (string $gid) {
196
+    public function getPortfolio(string $gid) {
197 197
         return $this->load(Portfolio::class, $this, "portfolios/{$gid}");
198 198
     }
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @param string $gid
204 204
      * @return null|Project
205 205
      */
206
-    public function getProject (string $gid) {
206
+    public function getProject(string $gid) {
207 207
         return $this->load(Project::class, $this, "projects/{$gid}");
208 208
     }
209 209
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      * @param string $gid
214 214
      * @return null|Section
215 215
      */
216
-    public function getSection (string $gid) {
216
+    public function getSection(string $gid) {
217 217
         return $this->load(Section::class, $this, "sections/{$gid}");
218 218
     }
219 219
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      * @param string $gid
224 224
      * @return null|Story
225 225
      */
226
-    public function getStory (string $gid) {
226
+    public function getStory(string $gid) {
227 227
         return $this->load(Story::class, $this, "stories/{$gid}");
228 228
     }
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      * @param string $gid
234 234
      * @return null|Tag
235 235
      */
236
-    public function getTag (string $gid) {
236
+    public function getTag(string $gid) {
237 237
         return $this->load(Tag::class, $this, "tags/{$gid}");
238 238
     }
239 239
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * @param string $gid
244 244
      * @return null|Task
245 245
      */
246
-    public function getTask (string $gid) {
246
+    public function getTask(string $gid) {
247 247
         return $this->load(Task::class, $this, "tasks/{$gid}");
248 248
     }
249 249
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * @param string $gid
254 254
      * @return null|Team
255 255
      */
256
-    public function getTeam (string $gid) {
256
+    public function getTeam(string $gid) {
257 257
         return $this->load(Team::class, $this, "teams/{$gid}");
258 258
     }
259 259
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      * @param string $gid
264 264
      * @return null|User
265 265
      */
266
-    public function getUser (string $gid) {
266
+    public function getUser(string $gid) {
267 267
         return $this->load(User::class, $this, "users/{$gid}");
268 268
     }
269 269
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      * @param array $data
276 276
      * @return ProjectEvent|TaskEvent|StoryEvent
277 277
      */
278
-    public function getWebhookEvent (array $data) {
278
+    public function getWebhookEvent(array $data) {
279 279
         static $classes = [
280 280
             Project::TYPE => ProjectEvent::class,
281 281
             Task::TYPE => TaskEvent::class,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      * @param string $gid
289 289
      * @return null|Workspace
290 290
      */
291
-    public function getWorkspace (string $gid) {
291
+    public function getWorkspace(string $gid) {
292 292
         return $this->load(Workspace::class, $this, "workspaces/{$gid}");
293 293
     }
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      * @param string $name
297 297
      * @return null|Workspace
298 298
      */
299
-    public function getWorkspaceByName (string $name) {
299
+    public function getWorkspaceByName(string $name) {
300 300
         foreach ($this->getMe()->getWorkspaces() as $workspace) {
301 301
             if ($workspace->getName() === $name) {
302 302
                 return $workspace;
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
      * @param string $json
310 310
      * @return null|array
311 311
      */
312
-    protected function jsonDecode (string $json) {
313
-        return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
312
+    protected function jsonDecode(string $json) {
313
+        return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
314 314
     }
315 315
 
316 316
     /**
317 317
      * @param array $data
318 318
      * @return string
319 319
      */
320
-    protected function jsonEncode (array $data): string {
321
-        return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
320
+    protected function jsonEncode(array $data): string {
321
+        return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
322 322
     }
323 323
 
324 324
     /**
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      * @param array $query
333 333
      * @return null|mixed|AbstractEntity
334 334
      */
335
-    public function load (string $class, $caller, string $path, array $query = []) {
335
+    public function load(string $class, $caller, string $path, array $query = []) {
336 336
         $key = $this->getPath($path, $query);
337 337
         return $this->cache->get($key, $caller, function($caller) use ($class, $path, $query) {
338 338
             $data = $this->get($path, $query, ['expand' => 'this']);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
      * @param int $pages If positive, stops after this many pages have been fetched.
353 353
      * @return array|AbstractEntity[]
354 354
      */
355
-    public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) {
355
+    public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) {
356 356
         $query['opt_expand'] = 'this';
357 357
         $query += ['limit' => 100];
358 358
         $path = $this->getPath($path, $query);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      * @param array $options
379 379
      * @return null|array
380 380
      */
381
-    public function post (string $path, array $data = [], array $options = []) {
381
+    public function post(string $path, array $data = [], array $options = []) {
382 382
         $response = $this->exec('POST', $path, [
383 383
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
384 384
             CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data])
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
      * @param array $options
395 395
      * @return null|array
396 396
      */
397
-    public function put (string $path, array $data = [], array $options = []) {
397
+    public function put(string $path, array $data = [], array $options = []) {
398 398
         $response = $this->exec('PUT', $path, [
399 399
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
400 400
             CURLOPT_POSTFIELDS => $this->jsonEncode(['options' => $options, 'data' => $data])
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      * @param Cache $cache
407 407
      * @return $this
408 408
      */
409
-    public function setCache (Cache $cache) {
409
+    public function setCache(Cache $cache) {
410 410
         $this->cache = $cache;
411 411
         return $this;
412 412
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      * @param LoggerInterface $logger
416 416
      * @return $this
417 417
      */
418
-    public function setLogger (LoggerInterface $logger) {
418
+    public function setLogger(LoggerInterface $logger) {
419 419
         $this->logger = $logger;
420 420
         return $this;
421 421
     }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
      * @param string $token
430 430
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
431 431
      */
432
-    public function sync ($entity, &$token) {
432
+    public function sync($entity, &$token) {
433 433
         try {
434 434
             $response = $this->exec('GET', $this->getPath('events', [
435 435
                 'resource' => $entity->getGid(),
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
      * @param string $file
462 462
      * @return null|array
463 463
      */
464
-    public function upload (string $path, string $file) {
464
+    public function upload(string $path, string $file) {
465 465
         $response = $this->exec('POST', $path, [
466 466
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
467 467
         ]);
Please login to merge, or discard this patch.
src/Workspace.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     const TYPE = 'workspace';
28 28
 
29
-    final public function __toString (): string {
29
+    final public function __toString(): string {
30 30
         return "workspaces/{$this->getGid()}";
31 31
     }
32 32
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return OrganizationExport
37 37
      */
38
-    public function export () {
38
+    public function export() {
39 39
         assert($this->isOrganization());
40 40
         /** @var OrganizationExport $export */
41 41
         $export = $this->factory(OrganizationExport::class);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param int $limit 1-100
54 54
      * @return array|AbstractEntity[]
55 55
      */
56
-    protected function find (string $class, string $resourceType, string $text, int $limit = 20) {
56
+    protected function find(string $class, string $resourceType, string $text, int $limit = 20) {
57 57
         return $this->loadAll($class, "{$this}/typeahead", [
58 58
             'resource_type' => $resourceType,
59 59
             'query' => $text,
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param int $limit 1-100
69 69
      * @return CustomField[]
70 70
      */
71
-    public function findCustomFields (string $text, int $limit = 20) {
71
+    public function findCustomFields(string $text, int $limit = 20) {
72 72
         return $this->find(CustomField::class, CustomField::TYPE, $text, $limit);
73 73
     }
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param int $limit 1-100
80 80
      * @return Portfolio[]
81 81
      */
82
-    public function findPortfolios (string $text, int $limit = 20) {
82
+    public function findPortfolios(string $text, int $limit = 20) {
83 83
         return $this->find(Portfolio::class, Portfolio::TYPE, $text, $limit);
84 84
     }
85 85
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param int $limit 1-100
91 91
      * @return Project[]
92 92
      */
93
-    public function findProjects (string $text, int $limit = 20) {
93
+    public function findProjects(string $text, int $limit = 20) {
94 94
         return $this->find(Project::class, Project::TYPE, $text, $limit);
95 95
     }
96 96
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param int $limit 1-100
102 102
      * @return Tag[]
103 103
      */
104
-    public function findTags (string $text, int $limit = 20) {
104
+    public function findTags(string $text, int $limit = 20) {
105 105
         return $this->find(Tag::class, Tag::TYPE, $text, $limit);
106 106
     }
107 107
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param int $limit 1-100
113 113
      * @return Task[]
114 114
      */
115
-    public function findTasks (string $text, int $limit = 20) {
115
+    public function findTasks(string $text, int $limit = 20) {
116 116
         return $this->find(Task::class, Task::TYPE, $text, $limit);
117 117
     }
118 118
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param int $limit 1-100
124 124
      * @return User[]
125 125
      */
126
-    public function findUsers (string $text, int $limit = 20) {
126
+    public function findUsers(string $text, int $limit = 20) {
127 127
         return $this->find(User::class, User::TYPE, $text, $limit);
128 128
     }
129 129
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param array $filter
132 132
      * @return Project[]
133 133
      */
134
-    public function getProjects (array $filter = []) {
134
+    public function getProjects(array $filter = []) {
135 135
         $filter['workspace'] = $this->getGid();
136 136
         return $this->loadAll(Project::class, 'projects', $filter);
137 137
     }
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
     /**
140 140
      * @return Tag[]
141 141
      */
142
-    public function getTags () {
142
+    public function getTags() {
143 143
         return $this->loadAll(Tag::class, 'tags', ['workspace' => $this->getGid()]);
144 144
     }
145 145
 
146 146
     /**
147 147
      * @return Team[]
148 148
      */
149
-    public function getTeams () {
149
+    public function getTeams() {
150 150
         return $this->loadAll(Team::class, "organizations/{$this->getGid()}/teams");
151 151
     }
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @param string $email
155 155
      * @return null|User
156 156
      */
157
-    public function getUserByEmail (string $email) {
157
+    public function getUserByEmail(string $email) {
158 158
         return $this->api->getCache()->get($email, $this, function() use ($email) {
159 159
             foreach ($this->getUsers() as $user) {
160 160
                 if ($user->getEmail() === $email) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     /**
169 169
      * @return User[]
170 170
      */
171
-    public function getUsers () {
171
+    public function getUsers() {
172 172
         return $this->loadAll(User::class, "{$this}/users");
173 173
     }
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      *
178 178
      * @return ProjectWebhook[]|TaskWebhook[]
179 179
      */
180
-    public function getWebhooks () {
180
+    public function getWebhooks() {
181 181
         $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']);
182 182
         return array_map(function(array $each) {
183 183
             return $this->api->getCache()->get($each['gid'], $this, function() use ($each) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     /**
194 194
      * @return bool
195 195
      */
196
-    public function isOrganization (): bool {
196
+    public function isOrganization(): bool {
197 197
         return $this->_is('is_organization');
198 198
     }
199 199
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      *
203 203
      * @return CustomField
204 204
      */
205
-    public function newCustomField () {
205
+    public function newCustomField() {
206 206
         /** @var CustomField $field */
207 207
         $field = $this->factory(CustomField::class);
208 208
         return $field->setWorkspace($this);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      *
214 214
      * @return Portfolio
215 215
      */
216
-    public function newPortfolio () {
216
+    public function newPortfolio() {
217 217
         /** @var Portfolio $portfolio */
218 218
         $portfolio = $this->factory(Portfolio::class);
219 219
         return $portfolio->setWorkspace($this);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      *
225 225
      * @return Project
226 226
      */
227
-    public function newProject () {
227
+    public function newProject() {
228 228
         /** @var Project $project */
229 229
         $project = $this->factory(Project::class);
230 230
         return $project->setWorkspace($this);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @return Tag
237 237
      */
238
-    public function newTag () {
238
+    public function newTag() {
239 239
         /** @var Tag $tag */
240 240
         $tag = $this->factory(Tag::class);
241 241
         return $tag->setWorkspace($this);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      *
247 247
      * @return Task
248 248
      */
249
-    public function newTask () {
249
+    public function newTask() {
250 250
         /** @var Task $task */
251 251
         $task = $this->factory(Task::class);
252 252
         return $task->setWorkspace($this);
Please login to merge, or discard this patch.
src/Task.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
     const ASSIGN_TODAY = 'today';
70 70
     const ASSIGN_UPCOMING = 'upcoming';
71 71
 
72
-    final public function __toString (): string {
72
+    final public function __toString(): string {
73 73
         return "tasks/{$this->getGid()}";
74 74
     }
75 75
 
76
-    final protected function _getDir (): string {
76
+    final protected function _getDir(): string {
77 77
         return 'tasks';
78 78
     }
79 79
 
80
-    protected function _getMap (): array {
80
+    protected function _getMap(): array {
81 81
         return [
82 82
             'assignee' => User::class,
83 83
             'custom_fields' => CustomValues::class,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @param string $file
99 99
      * @return Attachment
100 100
      */
101
-    public function addAttachment (string $file) {
101
+    public function addAttachment(string $file) {
102 102
         /** @var Attachment $attachment */
103 103
         $attachment = $this->factory(Attachment::class, ['parent' => $this]);
104 104
         return $attachment->upload($file);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param string $text
112 112
      * @return Story
113 113
      */
114
-    public function addComment (string $text) {
114
+    public function addComment(string $text) {
115 115
         return $this->newComment()->setText($text)->create();
116 116
     }
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param Task[] $tasks
123 123
      * @return $this
124 124
      */
125
-    public function addDependencies (array $tasks) {
125
+    public function addDependencies(array $tasks) {
126 126
         $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]);
127 127
         return $this;
128 128
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param Task $task
135 135
      * @return $this
136 136
      */
137
-    public function addDependency (Task $task) {
137
+    public function addDependency(Task $task) {
138 138
         return $this->addDependencies([$task]);
139 139
     }
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      * @param Task $task
146 146
      * @return $this
147 147
      */
148
-    public function addDependent (Task $task) {
148
+    public function addDependent(Task $task) {
149 149
         return $this->addDependents([$task]);
150 150
     }
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @param Task[] $tasks
157 157
      * @return $this
158 158
      */
159
-    public function addDependents (array $tasks) {
159
+    public function addDependents(array $tasks) {
160 160
         $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]);
161 161
         return $this;
162 162
     }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      * @param User $user
168 168
      * @return $this
169 169
      */
170
-    public function addFollower (User $user) {
170
+    public function addFollower(User $user) {
171 171
         return $this->addFollowers([$user]);
172 172
     }
173 173
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param User[] $users
178 178
      * @return $this
179 179
      */
180
-    public function addFollowers (array $users) {
180
+    public function addFollowers(array $users) {
181 181
         if ($this->hasGid()) {
182 182
             $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]);
183 183
             $this->_merge('followers', $users);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      * @param Tag $tag
195 195
      * @return $this
196 196
      */
197
-    public function addTag (Tag $tag) {
197
+    public function addTag(Tag $tag) {
198 198
         if ($this->hasGid()) {
199 199
             $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]);
200 200
             $this->_merge('tags', [$tag]);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param Section $section
212 212
      * @return $this
213 213
      */
214
-    public function addToProject (Section $section) {
214
+    public function addToProject(Section $section) {
215 215
         $project = $section->getProject();
216 216
         if ($this->hasGid()) {
217 217
             $this->api->post("{$this}/addProject", [
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      * @param string $target
246 246
      * @return TaskWebhook
247 247
      */
248
-    public function addWebhook (string $target) {
248
+    public function addWebhook(string $target) {
249 249
         /** @var TaskWebhook $webhook */
250 250
         $webhook = $this->factory(TaskWebhook::class);
251 251
         return $webhook->create($this, $target);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      * @param string[] $include
262 262
      * @return Job
263 263
      */
264
-    public function duplicate (string $name, array $include) {
264
+    public function duplicate(string $name, array $include) {
265 265
         $remote = $this->api->post("{$this}/duplicate", [
266 266
             'name' => $name,
267 267
             'include' => array_values($include)
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      * @depends after-create
276 276
      * @return Attachment[]
277 277
      */
278
-    public function getAttachments () {
278
+    public function getAttachments() {
279 279
         return $this->loadAll(Attachment::class, "{$this}/attachments");
280 280
     }
281 281
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * @depends after-create
286 286
      * @return Story[]
287 287
      */
288
-    public function getComments () {
288
+    public function getComments() {
289 289
         return array_values(array_filter($this->getStories(), function(Story $story) {
290 290
             return $story->isComment();
291 291
         }));
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * @depends after-create
298 298
      * @return Task[]
299 299
      */
300
-    public function getDependencies () {
300
+    public function getDependencies() {
301 301
         return $this->loadAll(self::class, "{$this}/dependencies");
302 302
     }
303 303
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @depends after-create
308 308
      * @return Task[]
309 309
      */
310
-    public function getDependents () {
310
+    public function getDependents() {
311 311
         return $this->loadAll(self::class, "{$this}/dependents");
312 312
     }
313 313
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      * @param string $token
319 319
      * @return TaskEvent[]|StoryEvent[]
320 320
      */
321
-    public function getEvents (string &$token) {
321
+    public function getEvents(string &$token) {
322 322
         return $this->api->sync($this, $token);
323 323
     }
324 324
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @depends after-create
329 329
      * @return Story[]
330 330
      */
331
-    public function getStories () {
331
+    public function getStories() {
332 332
         return $this->loadAll(Story::class, "{$this}/stories");
333 333
     }
334 334
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      * @depends after-create
339 339
      * @return Task[]
340 340
      */
341
-    public function getSubTasks () {
341
+    public function getSubTasks() {
342 342
         return $this->loadAll(self::class, "{$this}/subtasks");
343 343
     }
344 344
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      * @depends after-create
349 349
      * @return string
350 350
      */
351
-    public function getUrl (): string {
351
+    public function getUrl(): string {
352 352
         return "https://app.asana.com/0/0/{$this->getGid()}";
353 353
     }
354 354
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      * @depends after-create
359 359
      * @return TaskWebhook[]
360 360
      */
361
-    public function getWebhooks () {
361
+    public function getWebhooks() {
362 362
         return $this->loadAll(TaskWebhook::class, 'webhooks', [
363 363
             'workspace' => $this->getWorkspace()->getGid(),
364 364
             'resource' => $this->getGid()
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     /**
369 369
      * @return bool
370 370
      */
371
-    public function isRenderedAsSeparator (): bool {
371
+    public function isRenderedAsSeparator(): bool {
372 372
         return $this->_is('is_rendered_as_separator');
373 373
     }
374 374
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      * @depends after-create
379 379
      * @return Story
380 380
      */
381
-    public function newComment () {
381
+    public function newComment() {
382 382
         /** @var Story $comment */
383 383
         $comment = $this->factory(Story::class, [
384 384
             'resource_subtype' => Story::TYPE_COMMENT_ADDED
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      * @depends after-create
393 393
      * @return Task
394 394
      */
395
-    public function newSubTask () {
395
+    public function newSubTask() {
396 396
         /** @var Task $sub */
397 397
         $sub = $this->factory(self::class);
398 398
         return $sub->setParent($this);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      * @param Task[] $tasks
406 406
      * @return $this
407 407
      */
408
-    public function removeDependencies (array $tasks) {
408
+    public function removeDependencies(array $tasks) {
409 409
         $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]);
410 410
         return $this;
411 411
     }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
      * @param Task $task
418 418
      * @return $this
419 419
      */
420
-    public function removeDependency (Task $task) {
420
+    public function removeDependency(Task $task) {
421 421
         return $this->removeDependencies([$task]);
422 422
     }
423 423
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
      * @param Task $task
429 429
      * @return $this
430 430
      */
431
-    public function removeDependent (Task $task) {
431
+    public function removeDependent(Task $task) {
432 432
         return $this->removeDependents([$task]);
433 433
     }
434 434
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      * @param Task[] $tasks
440 440
      * @return $this
441 441
      */
442
-    public function removeDependents (array $tasks) {
442
+    public function removeDependents(array $tasks) {
443 443
         $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]);
444 444
         return $this;
445 445
     }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
      * @param User $user
451 451
      * @return $this
452 452
      */
453
-    public function removeFollower (User $user) {
453
+    public function removeFollower(User $user) {
454 454
         return $this->removeFollowers([$user]);
455 455
     }
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
      * @param User[] $users
461 461
      * @return $this
462 462
      */
463
-    public function removeFollowers (array $users) {
463
+    public function removeFollowers(array $users) {
464 464
         if ($this->hasGid()) {
465 465
             $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]);
466 466
         }
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      * @param Project $project
475 475
      * @return $this
476 476
      */
477
-    public function removeFromProject (Project $project) {
477
+    public function removeFromProject(Project $project) {
478 478
         $gid = $project->getGid();
479 479
         if ($this->hasGid()) {
480 480
             $this->api->post("{$this}/removeProject", ['project' => $gid]);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param Tag $tag
494 494
      * @return $this
495 495
      */
496
-    public function removeTag (Tag $tag) {
496
+    public function removeTag(Tag $tag) {
497 497
         if ($this->hasGid()) {
498 498
             $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]);
499 499
         }
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      * @param null|Task $parent
508 508
      * @return $this
509 509
      */
510
-    public function setParent (?self $parent) {
510
+    public function setParent(?self $parent) {
511 511
         if ($this->hasGid()) {
512 512
             $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]);
513 513
             $this->data['parent'] = $parent;
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
      * @param bool $flag
523 523
      * @return $this
524 524
      */
525
-    public function setRenderedAsSeparator (bool $flag) {
525
+    public function setRenderedAsSeparator(bool $flag) {
526 526
         return $this->_set('is_rendered_as_separator', $flag);
527 527
     }
528 528
 }
529 529
\ No newline at end of file
Please login to merge, or discard this patch.
src/CustomField/CustomValues.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     protected $enumNames = [];
18 18
 
19
-    public function __construct ($caller, array $data = []) {
19
+    public function __construct($caller, array $data = []) {
20 20
         parent::__construct($caller);
21 21
         foreach ($data as $field) {
22 22
             $gid = $field['gid'];
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param string $enumName
39 39
      * @return null|string
40 40
      */
41
-    public function getEnumGid (string $fieldGid, string $enumName) {
41
+    public function getEnumGid(string $fieldGid, string $enumName) {
42 42
         return array_search($enumName, $this->enumNames[$fieldGid]) ?: null;
43 43
     }
44 44
 
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      * @param string $valueGid
48 48
      * @return string
49 49
      */
50
-    public function getEnumName (string $fieldGid, string $valueGid) {
50
+    public function getEnumName(string $fieldGid, string $valueGid) {
51 51
         return $this->enumNames[$fieldGid][$valueGid];
52 52
     }
53 53
 
54 54
     /**
55 55
      * @return string[][]
56 56
      */
57
-    public function getEnumNames (): array {
57
+    public function getEnumNames(): array {
58 58
         return $this->enumNames;
59 59
     }
60 60
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param string $fieldGid
63 63
      * @return null|number|string
64 64
      */
65
-    public function getValue (string $fieldGid) {
65
+    public function getValue(string $fieldGid) {
66 66
         return $this->data[$fieldGid] ?? null;
67 67
     }
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param string $fieldGid
71 71
      * @return bool
72 72
      */
73
-    public function offsetExists ($fieldGid) {
73
+    public function offsetExists($fieldGid) {
74 74
         return array_key_exists($fieldGid, $this->data);
75 75
     }
76 76
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param string $fieldGid
79 79
      * @return null|number|string
80 80
      */
81
-    public function offsetGet ($fieldGid) {
81
+    public function offsetGet($fieldGid) {
82 82
         return $this->getValue($fieldGid);
83 83
     }
84 84
 
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
      * @param string $fieldGid
87 87
      * @param null|number|string $value
88 88
      */
89
-    public function offsetSet ($fieldGid, $value) {
89
+    public function offsetSet($fieldGid, $value) {
90 90
         $this->setValue($fieldGid, $value);
91 91
     }
92 92
 
93 93
     /**
94 94
      * @param string $fieldGid
95 95
      */
96
-    public function offsetUnset ($fieldGid) {
96
+    public function offsetUnset($fieldGid) {
97 97
         unset($this->data[$fieldGid]);
98 98
         $this->diff[$fieldGid] = true;
99 99
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @param null|number|string $value
104 104
      * @return $this
105 105
      */
106
-    public function setValue (string $fieldGid, $value) {
106
+    public function setValue(string $fieldGid, $value) {
107 107
         $this->data[$fieldGid] = $value;
108 108
         $this->diff[$fieldGid] = true;
109 109
         return $this;
Please login to merge, or discard this patch.
src/Project.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
     const LAYOUT_BOARD = 'board';
59 59
     const LAYOUT_LIST = 'list';
60 60
 
61
-    final public function __toString (): string {
61
+    final public function __toString(): string {
62 62
         return "projects/{$this->getGid()}";
63 63
     }
64 64
 
65
-    final protected function _getDir (): string {
65
+    final protected function _getDir(): string {
66 66
         return 'projects';
67 67
     }
68 68
 
69
-    protected function _getMap (): array {
69
+    protected function _getMap(): array {
70 70
         return [
71 71
             'current_status' => Status::class,
72 72
             'custom_fields' => CustomValues::class,
@@ -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
         $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]);
97 97
         $this->_merge('members', $users);
98 98
         return $this;
@@ -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();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @param string $token
149 149
      * @return ProjectEvent[]|TaskEvent[]|StoryEvent[]
150 150
      */
151
-    public function getEvents (string &$token) {
151
+    public function getEvents(string &$token) {
152 152
         return $this->api->sync($this, $token);
153 153
     }
154 154
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @depends after-create
157 157
      * @return Section[]
158 158
      */
159
-    public function getSections () {
159
+    public function getSections() {
160 160
         return $this->loadAll(Section::class, "{$this}/sections");
161 161
     }
162 162
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * @depends after-create
165 165
      * @return Status[]
166 166
      */
167
-    public function getStatuses () {
167
+    public function getStatuses() {
168 168
         return $this->loadAll(Status::class, "{$this}/project_statuses");
169 169
     }
170 170
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @param array $query
174 174
      * @return Task[]
175 175
      */
176
-    public function getTasks (array $query = []) {
176
+    public function getTasks(array $query = []) {
177 177
         $query['project'] = $this->getGid();
178 178
         return $this->loadAll(Task::class, "tasks", $query);
179 179
     }
@@ -182,25 +182,25 @@  discard block
 block discarded – undo
182 182
      * @depends after-create
183 183
      * @return string
184 184
      */
185
-    public function getUrl (): string {
185
+    public function getUrl(): string {
186 186
         return "https://app.asana.com/0/{$this->getGid()}";
187 187
     }
188 188
 
189 189
     /**
190 190
      * @return ProjectWebhook[]
191 191
      */
192
-    public function getWebhooks () {
192
+    public function getWebhooks() {
193 193
         return $this->loadAll(ProjectWebhook::class, 'webhooks', [
194 194
             'workspace' => $this->getWorkspace()->getGid(),
195 195
             'resource' => $this->getGid()
196 196
         ]);
197 197
     }
198 198
 
199
-    public function isBoard (): bool {
199
+    public function isBoard(): bool {
200 200
         return $this->getLayout() === self::LAYOUT_BOARD;
201 201
     }
202 202
 
203
-    public function isList (): bool {
203
+    public function isList(): bool {
204 204
         return $this->getLayout() === self::LAYOUT_LIST;
205 205
     }
206 206
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @depends after-create
209 209
      * @return Section
210 210
      */
211
-    public function newSection () {
211
+    public function newSection() {
212 212
         return $this->factory(Section::class, ['projects' => [$this]]);
213 213
     }
214 214
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      * @depends after-create
217 217
      * @return Status
218 218
      */
219
-    public function newStatus () {
219
+    public function newStatus() {
220 220
         return $this->factory(Status::class);
221 221
     }
222 222
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      * @depends after-create
227 227
      * @return Task
228 228
      */
229
-    public function newTask () {
229
+    public function newTask() {
230 230
         return $this->getSections()[0]->newTask();
231 231
     }
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param User $user
236 236
      * @return $this
237 237
      */
238
-    public function removeMember (User $user) {
238
+    public function removeMember(User $user) {
239 239
         return $this->removeMembers([$user]);
240 240
     }
241 241
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param User[] $users
245 245
      * @return $this
246 246
      */
247
-    public function removeMembers (array $users) {
247
+    public function removeMembers(array $users) {
248 248
         $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]);
249 249
         $this->_remove('members', $users);
250 250
         return $this;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      * @param null|Team $team
256 256
      * @return $this
257 257
      */
258
-    public function setTeam (?Team $team) {
258
+    public function setTeam(?Team $team) {
259 259
         assert(!$this->hasGid());
260 260
         if ($team and !$this->hasWorkspace()) {
261 261
             $this->setWorkspace($team->getOrganization());
Please login to merge, or discard this patch.