Passed
Push — master ( 3c0c31...b6d585 )
by y
02:02
created
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->getPool()->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/CustomField.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  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
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $name
57 57
      * @return EnumOption
58 58
      */
59
-    public function addEnumOption (string $name) {
59
+    public function addEnumOption(string $name) {
60 60
         /** @var EnumOption $option */
61 61
         $option = $this->api->factory($this, EnumOption::class);
62 62
         $option->setName($name);
@@ -72,35 +72,35 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @return bool
74 74
      */
75
-    public function hasNotificationsEnabled (): bool {
75
+    public function hasNotificationsEnabled(): bool {
76 76
         return $this->_is('has_notifications_enabled');
77 77
     }
78 78
 
79 79
     /**
80 80
      * @return bool
81 81
      */
82
-    final public function isEnum (): bool {
82
+    final public function isEnum(): bool {
83 83
         return $this->getResourceSubtype() === self::TYPE_ENUM;
84 84
     }
85 85
 
86 86
     /**
87 87
      * @return bool
88 88
      */
89
-    public function isGlobalToWorkspace (): bool {
89
+    public function isGlobalToWorkspace(): bool {
90 90
         return $this->_is('is_global_to_workspace');
91 91
     }
92 92
 
93 93
     /**
94 94
      * @return bool
95 95
      */
96
-    final public function isNumber (): bool {
96
+    final public function isNumber(): bool {
97 97
         return $this->getResourceSubtype() === self::TYPE_NUMBER;
98 98
     }
99 99
 
100 100
     /**
101 101
      * @return bool
102 102
      */
103
-    final public function isText (): bool {
103
+    final public function isText(): bool {
104 104
         return $this->getResourceSubtype() === self::TYPE_TEXT;
105 105
     }
106 106
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param bool $flag
109 109
      * @return $this
110 110
      */
111
-    public function setGlobalToWorkspace (bool $flag) {
111
+    public function setGlobalToWorkspace(bool $flag) {
112 112
         return $this->_set('is_global_to_workspace', $flag);
113 113
     }
114 114
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param bool $flag
117 117
      * @return $this
118 118
      */
119
-    public function setNotificationsEnabled (bool $flag) {
119
+    public function setNotificationsEnabled(bool $flag) {
120 120
         return $this->_set('has_notifications_enabled', $flag);
121 121
     }
122 122
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int`
125 125
      * @return $this
126 126
      */
127
-    public function sortEnumOptions (callable $cmp) {
127
+    public function sortEnumOptions(callable $cmp) {
128 128
         if ($options = $this->getEnumOptions()) {
129 129
             $prev = $options[0]; // first option on remote
130 130
             usort($options, $cmp);
Please login to merge, or discard this patch.
src/Project/Status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
      * @param Project $project
52 52
      * @param array $data
53 53
      */
54
-    public function __construct (Project $project, array $data = []) {
54
+    public function __construct(Project $project, array $data = []) {
55 55
         parent::__construct($project, $data);
56 56
         $this->project = $project;
57 57
     }
58 58
 
59
-    final public function __toString (): string {
59
+    final public function __toString(): string {
60 60
         return "project_statuses/{$this->getGid()}";
61 61
     }
62 62
 
63
-    final protected function _getDir (): string {
63
+    final protected function _getDir(): string {
64 64
         return "{$this->project}/project_statuses";
65 65
     }
66 66
 
67
-    protected function _setData (array $data): void {
67
+    protected function _setData(array $data): void {
68 68
         // redundant, prefer created_by
69 69
         unset($data['author']);
70 70
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @return Project
76 76
      */
77
-    public function getProject () {
77
+    public function getProject() {
78 78
         return $this->project;
79 79
     }
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $token
49 49
      * @param Pool|null $pool
50 50
      */
51
-    public function __construct (string $token, Pool $pool = null) {
51
+    public function __construct(string $token, Pool $pool = null) {
52 52
         $this->token = $token;
53 53
         $this->pool = $pool ?? new Pool();
54 54
     }
@@ -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 $curlOpts = []) {
65
+    protected function _exec(string $method, string $path, array $curlOpts = []) {
66 66
         $log = $this->getLog();
67 67
         $log->log(LOG_DEBUG, "{$method} {$path}", $curlOpts);
68 68
         /** @var resource $ch */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @return string
114 114
      * @internal
115 115
      */
116
-    protected function _getPath (string $path, array $query): string {
116
+    protected function _getPath(string $path, array $query): string {
117 117
         if ($query) {
118 118
             return $path . '?' . http_build_query($query);
119 119
         }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      * @return array
126 126
      * @internal
127 127
      */
128
-    protected function _jsonDecode (string $json) {
129
-        return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
128
+    protected function _jsonDecode(string $json) {
129
+        return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR);
130 130
     }
131 131
 
132 132
     /**
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      * @return string
135 135
      * @internal
136 136
      */
137
-    protected function _jsonEncode (array $data): string {
138
-        return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
137
+    protected function _jsonEncode(array $data): string {
138
+        return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
139 139
     }
140 140
 
141 141
     /**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @param string $path
145 145
      */
146
-    public function delete (string $path): void {
146
+    public function delete(string $path): void {
147 147
         $this->_exec('DELETE', $path);
148 148
     }
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param array $data
158 158
      * @return mixed|Data|AbstractEntity
159 159
      */
160
-    public function factory ($caller, string $class, array $data = []) {
160
+    public function factory($caller, string $class, array $data = []) {
161 161
         return new $class($caller, $data);
162 162
     }
163 163
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param array $opt
170 170
      * @return null|array
171 171
      */
172
-    public function get (string $path, array $query = [], array $opt = []) {
172
+    public function get(string $path, array $query = [], array $opt = []) {
173 173
         foreach ($opt as $name => $value) {
174 174
             $query["opt_{$name}"] = $value;
175 175
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param string $gid
184 184
      * @return null|Attachment
185 185
      */
186
-    public function getAttachment (string $gid) {
186
+    public function getAttachment(string $gid) {
187 187
         return $this->load($this, Attachment::class, "attachments/{$gid}");
188 188
     }
189 189
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param string $gid
194 194
      * @return null|CustomField
195 195
      */
196
-    public function getCustomField (string $gid) {
196
+    public function getCustomField(string $gid) {
197 197
         return $this->load($this, CustomField::class, "custom_fields/{$gid}");
198 198
     }
199 199
 
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
      *
204 204
      * @return Workspace
205 205
      */
206
-    public function getDefaultWorkspace () {
206
+    public function getDefaultWorkspace() {
207 207
         return $this->getMe()->getDefaultWorkspace();
208 208
     }
209 209
 
210 210
     /**
211 211
      * @return LoggerInterface
212 212
      */
213
-    public function getLog () {
213
+    public function getLog() {
214 214
         return $this->log ?? $this->log = new NullLogger();
215 215
     }
216 216
 
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return User
221 221
      */
222
-    public function getMe () {
222
+    public function getMe() {
223 223
         return $this->me ?? $this->me = $this->getUser('me');
224 224
     }
225 225
 
226 226
     /**
227 227
      * @return Pool
228 228
      */
229
-    final public function getPool () {
229
+    final public function getPool() {
230 230
         return $this->pool;
231 231
     }
232 232
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * @param string $gid
237 237
      * @return null|Portfolio
238 238
      */
239
-    public function getPortfolio (string $gid) {
239
+    public function getPortfolio(string $gid) {
240 240
         return $this->load($this, Portfolio::class, "portfolios/{$gid}");
241 241
     }
242 242
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      * @param string $gid
247 247
      * @return null|Project
248 248
      */
249
-    public function getProject (string $gid) {
249
+    public function getProject(string $gid) {
250 250
         return $this->load($this, Project::class, "projects/{$gid}");
251 251
     }
252 252
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @param string $gid
257 257
      * @return null|Section
258 258
      */
259
-    public function getSection (string $gid) {
259
+    public function getSection(string $gid) {
260 260
         return $this->load($this, Section::class, "sections/{$gid}");
261 261
     }
262 262
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * @param string $gid
267 267
      * @return null|Story
268 268
      */
269
-    public function getStory (string $gid) {
269
+    public function getStory(string $gid) {
270 270
         return $this->load($this, Story::class, "stories/{$gid}");
271 271
     }
272 272
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      * @param string $gid
277 277
      * @return null|Tag
278 278
      */
279
-    public function getTag (string $gid) {
279
+    public function getTag(string $gid) {
280 280
         return $this->load($this, Tag::class, "tags/{$gid}");
281 281
     }
282 282
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param string $gid
287 287
      * @return null|Task
288 288
      */
289
-    public function getTask (string $gid) {
289
+    public function getTask(string $gid) {
290 290
         return $this->load($this, Task::class, "tasks/{$gid}");
291 291
     }
292 292
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      * @param string $gid
297 297
      * @return null|TaskList
298 298
      */
299
-    public function getTaskList (string $gid) {
299
+    public function getTaskList(string $gid) {
300 300
         return $this->load($this, TaskList::class, "user_task_lists/{$gid}");
301 301
     }
302 302
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @param string $gid
307 307
      * @return null|Team
308 308
      */
309
-    public function getTeam (string $gid) {
309
+    public function getTeam(string $gid) {
310 310
         return $this->load($this, Team::class, "teams/{$gid}");
311 311
     }
312 312
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      * @param string $gid
317 317
      * @return null|User
318 318
      */
319
-    public function getUser (string $gid) {
319
+    public function getUser(string $gid) {
320 320
         return $this->load($this, User::class, "users/{$gid}");
321 321
     }
322 322
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param string $gid
325 325
      * @return ProjectWebhook|TaskWebhook
326 326
      */
327
-    public function getWebhook (string $gid) {
327
+    public function getWebhook(string $gid) {
328 328
         return $this->pool->get($gid, $this, function() use ($gid) {
329 329
             static $classes = [
330 330
                 Project::TYPE => ProjectWebhook::class,
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      * @param array $data
346 346
      * @return Event
347 347
      */
348
-    public function getWebhookEvent (array $data) {
348
+    public function getWebhookEvent(array $data) {
349 349
         return $this->factory($this, Event::class, $data);
350 350
     }
351 351
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      * @param string $gid
356 356
      * @return null|Workspace
357 357
      */
358
-    public function getWorkspace (string $gid) {
358
+    public function getWorkspace(string $gid) {
359 359
         return $this->load($this, Workspace::class, "workspaces/{$gid}");
360 360
     }
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param string $name
366 366
      * @return null|Workspace
367 367
      */
368
-    public function getWorkspaceByName (string $name) {
368
+    public function getWorkspaceByName(string $name) {
369 369
         foreach ($this->getWorkspaces() as $workspace) {
370 370
             if ($workspace->getName() === $name) {
371 371
                 return $workspace;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      *
380 380
      * @return Workspace[]
381 381
      */
382
-    public function getWorkspaces () {
382
+    public function getWorkspaces() {
383 383
         return $this->getMe()->getWorkspaces();
384 384
     }
385 385
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      * @param array $query
393 393
      * @return null|mixed|AbstractEntity
394 394
      */
395
-    public function load ($caller, string $class, string $path, array $query = []) {
395
+    public function load($caller, string $class, string $path, array $query = []) {
396 396
         $key = $this->_getPath($path, $query);
397 397
         return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) {
398 398
             if ($data = $this->get($path, $query, ['expand' => 'this'])) {
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      * @param array $query
412 412
      * @return array|AbstractEntity[]
413 413
      */
414
-    public function loadAll ($caller, string $class, string $path, array $query = []) {
414
+    public function loadAll($caller, string $class, string $path, array $query = []) {
415 415
         return iterator_to_array($this->loadEach(...func_get_args()));
416 416
     }
417 417
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @param array $query `limit` can exceed `100` here. Empty `limit` for all pages.
427 427
      * @return Generator|AbstractEntity[]
428 428
      */
429
-    public function loadEach ($caller, string $class, string $path, array $query = []) {
429
+    public function loadEach($caller, string $class, string $path, array $query = []) {
430 430
         $query['opt_expand'] = 'this';
431 431
         if (!$i = $query['limit'] ?? 0) {
432 432
             $i = PHP_INT_MAX;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
      * @param array $opt
451 451
      * @return null|array
452 452
      */
453
-    public function post (string $path, array $data = [], array $opt = []) {
453
+    public function post(string $path, array $data = [], array $opt = []) {
454 454
         $response = $this->_exec('POST', $path, [
455 455
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
456 456
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $opt, 'data' => $data])
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @param array $opt
467 467
      * @return null|array
468 468
      */
469
-    public function put (string $path, array $data = [], array $opt = []) {
469
+    public function put(string $path, array $data = [], array $opt = []) {
470 470
         $response = $this->_exec('PUT', $path, [
471 471
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
472 472
             CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $opt, 'data' => $data])
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
     /**
478 478
      * @param LoggerInterface $log
479 479
      */
480
-    public function setLog (LoggerInterface $log) {
480
+    public function setLog(LoggerInterface $log) {
481 481
         $this->log = $log;
482 482
     }
483 483
 
484 484
     /**
485 485
      * @param Pool $pool
486 486
      */
487
-    public function setPool (Pool $pool) {
487
+    public function setPool(Pool $pool) {
488 488
         $this->pool = $pool;
489 489
     }
490 490
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
      * @param null|string $token Updated to the new token.
502 502
      * @return Event[]
503 503
      */
504
-    public function sync (string $gid, ?string &$token) {
504
+    public function sync(string $gid, ?string &$token) {
505 505
         try {
506 506
             /** @var array $remote Asana throws 400 for missing entities here. */
507 507
             $remote = $this->_exec('GET', $this->_getPath('events', [
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
      * @param string $to
542 542
      * @return null|array
543 543
      */
544
-    public function upload (string $file, string $to) {
544
+    public function upload(string $file, string $to) {
545 545
         $response = $this->_exec('POST', $to, [
546 546
             CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data
547 547
         ]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -509,8 +509,7 @@
 block discarded – undo
509 509
                 'sync' => $token,
510 510
                 'opt_expand' => 'this'
511 511
             ]));
512
-        }
513
-        catch (AsanaError $error) {
512
+        } catch (AsanaError $error) {
514 513
             if ($error->getCode() === 412) {
515 514
                 $remote = $this->_jsonDecode($error->getMessage());
516 515
                 if (!isset($token)) {
Please login to merge, or discard this patch.
src/Api/Laravel/AsanaServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     const NAME = 'asana';
19 19
 
20
-    public function boot () {
20
+    public function boot() {
21 21
         $this->publishes([
22 22
             __DIR__ . '/config/asana.php' => $this->app->configPath('asana.php')
23 23
         ]);
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         }
31 31
     }
32 32
 
33
-    public function provides () {
33
+    public function provides() {
34 34
         return [self::NAME];
35 35
     }
36 36
 
37
-    public function register () {
37
+    public function register() {
38 38
         $this->app->singleton(self::NAME, function(Application $app) {
39 39
             $config = $app['config'][self::NAME];
40 40
             $pool = null;
Please login to merge, or discard this patch.
src/Api/AsanaError.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     protected $curlInfo;
22 22
 
23
-    public function __construct (int $code, string $message, array $curlInfo) {
23
+    public function __construct(int $code, string $message, array $curlInfo) {
24 24
         parent::__construct($message, $code);
25 25
         $this->curlInfo = $curlInfo;
26 26
     }
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @return array
30 30
      */
31
-    public function getCurlInfo (): array {
31
+    public function getCurlInfo(): array {
32 32
         return $this->curlInfo;
33 33
     }
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/FileCache.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
             $this->_log("CACHE DELINK {$key}");
59 59
             unlink($ref);
60 60
             unlink($path);
61
-        }
62
-        elseif (is_file($path)) {
61
+        } elseif (is_file($path)) {
63 62
             $this->_log("CACHE DELETE {$key}");
64 63
             unlink($path);
65 64
         }
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
                 ["CACHE SET {$key}", "CACHE BURN {$key}"][$value instanceof ImmutableInterface],
118 117
                 "CACHE UPDATE {$key}"
119 118
             ][is_file($path)]);
120
-        }
121
-        else {
119
+        } else {
122 120
             $this->_log([
123 121
                 "CACHE LINK {$key} => {$value}",
124 122
                 "CACHE RENEW LINK {$key} => {$value}"
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,30 +29,30 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @param string $dir
31 31
      */
32
-    public function __construct (string $dir) {
32
+    public function __construct(string $dir) {
33 33
         $this->dir = $dir;
34 34
         $this->log = new NullLogger();
35 35
     }
36 36
 
37
-    private function _log (string $msg): void {
37
+    private function _log(string $msg): void {
38 38
         $this->log->log(LOG_DEBUG, $msg);
39 39
     }
40 40
 
41
-    private function _path ($key): string {
41
+    private function _path($key): string {
42 42
         $path = "{$this->dir}/{$key}~";
43 43
         clearstatcache(true, $path);
44 44
         return $path;
45 45
     }
46 46
 
47
-    private function _ref ($key): string {
47
+    private function _ref($key): string {
48 48
         return "{$this->dir}/{$key}.ref";
49 49
     }
50 50
 
51
-    public function clear () {
51
+    public function clear() {
52 52
         // unused. just delete the dir.
53 53
     }
54 54
 
55
-    public function delete ($key) {
55
+    public function delete($key) {
56 56
         $path = $this->_path($key);
57 57
         if (is_link($ref = $this->_ref($key))) {
58 58
             $this->_log("CACHE DELINK {$key}");
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
     }
67 67
 
68
-    public function deleteMultiple ($keys) {
68
+    public function deleteMultiple($keys) {
69 69
         // unused
70 70
     }
71 71
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @param mixed $default Unused.
75 75
      * @return null|string|object
76 76
      */
77
-    public function get ($key, $default = null) {
77
+    public function get($key, $default = null) {
78 78
         $path = $this->_path($key);
79 79
         if (!is_file($path)) {
80 80
             $this->_log("CACHE MISS {$key}");
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
         return $data;
94 94
     }
95 95
 
96
-    public function getMultiple ($keys, $default = null) {
96
+    public function getMultiple($keys, $default = null) {
97 97
         // unused
98 98
     }
99 99
 
100
-    public function has ($key): bool {
100
+    public function has($key): bool {
101 101
         return is_file($this->_path($key));
102 102
     }
103 103
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @param int $ttl
108 108
      * @return void
109 109
      */
110
-    public function set ($key, $value, $ttl = null): void {
110
+    public function set($key, $value, $ttl = null): void {
111 111
         $path = $this->_path($key);
112 112
         if (!is_dir(dirname($path))) {
113 113
             mkdir(dirname($path), 0770, true);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
      * @param LoggerInterface $log
137 137
      * @return $this
138 138
      */
139
-    public function setLog (LoggerInterface $log) {
139
+    public function setLog(LoggerInterface $log) {
140 140
         $this->log = $log;
141 141
         return $this;
142 142
     }
143 143
 
144
-    public function setMultiple ($values, $ttl = null) {
144
+    public function setMultiple($values, $ttl = null) {
145 145
         // unused
146 146
     }
147 147
 }
148 148
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Pool.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @param AbstractEntity $entity
31 31
      */
32
-    protected function _add (AbstractEntity $entity): void {
32
+    protected function _add(AbstractEntity $entity): void {
33 33
         $gid = $entity->getGid();
34 34
         $this->entities[$gid] = $entity;
35 35
         $this->gids[$gid] = $gid;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @param AbstractEntity $entity
40 40
      * @param string[] $keys
41 41
      */
42
-    protected function _addKeys (AbstractEntity $entity, ...$keys): void {
42
+    protected function _addKeys(AbstractEntity $entity, ...$keys): void {
43 43
         $this->gids += array_fill_keys($keys, $entity->getGid());
44 44
     }
45 45
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param Api|Data $caller For hydration if needed.
49 49
      * @return null|AbstractEntity
50 50
      */
51
-    protected function _get (string $key, $caller) {
51
+    protected function _get(string $key, $caller) {
52 52
         if (isset($this->gids[$key])) {
53 53
             return $this->entities[$this->gids[$key]];
54 54
         }
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      * @param string $key
63 63
      * @return bool
64 64
      */
65
-    protected function _has (string $key): bool {
65
+    protected function _has(string $key): bool {
66 66
         return isset($this->gids[$key]);
67 67
     }
68 68
 
69 69
     /**
70 70
      * @param AbstractEntity $entity
71 71
      */
72
-    final public function add (AbstractEntity $entity): void {
72
+    final public function add(AbstractEntity $entity): void {
73 73
         if (!$entity->isDiff()) {
74 74
             $this->_add($entity);
75 75
             $this->_addKeys($entity, ...$entity->getPoolKeys());
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param Closure $factory `fn( Api|Data $caller ): null|AbstractEntity`
83 83
      * @return null|mixed|AbstractEntity
84 84
      */
85
-    final public function get (string $key, $caller, Closure $factory) {
85
+    final public function get(string $key, $caller, Closure $factory) {
86 86
         /** @var AbstractEntity $entity */
87 87
         if (!$entity = $this->_get($key, $caller) and $entity = $factory($caller)) {
88 88
             $gid = $entity->getGid();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * @param string[] $keys
105 105
      */
106
-    public function remove (array $keys): void {
106
+    public function remove(array $keys): void {
107 107
         foreach ($keys as $key) {
108 108
             unset($this->entities[$key]);
109 109
             unset($this->gids[$key]);
Please login to merge, or discard this patch.
src/CustomField/FieldSetting.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         'custom_field' => CustomField::class,
24 24
     ];
25 25
 
26
-    protected function _setData (array $data): void {
26
+    protected function _setData(array $data): void {
27 27
         // these are the only fields that matter.
28 28
         parent::_setData([
29 29
             'custom_field' => $data['custom_field'],
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         ]);
32 32
     }
33 33
 
34
-    final public function getResourceType (): string {
34
+    final public function getResourceType(): string {
35 35
         return self::TYPE;
36 36
     }
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.