Passed
Push — master ( 984447...7073d8 )
by y
02:06
created
src/Api/SimpleCache.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                     /** @var null|AbstractEntity $entity */
69 69
                     if ($entity = $this->get($entity, $caller, $factory)) {
70 70
                         $this->cache->set($key, $entity->getGid()); // renew potentially nonstandard key
71
-                    }
72
-                    else {
71
+                    } else {
73 72
                         $this->cache->delete($key); // remove invalid key
74 73
                     }
75 74
                     return $entity; // null or hydrated. parent calls add()
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param Api $api
37 37
      * @param PSR16 $cache
38 38
      */
39
-    public function __construct (Api $api, PSR16 $cache) {
39
+    public function __construct(Api $api, PSR16 $cache) {
40 40
         $this->api = $api;
41 41
         $this->cache = $cache;
42 42
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param AbstractEntity $entity
46 46
      * @throws InvalidArgumentException
47 47
      */
48
-    public function add (AbstractEntity $entity): void {
48
+    public function add(AbstractEntity $entity): void {
49 49
         if ($gid = $entity->getGid() and !$entity->isDiff()) {
50 50
             parent::add($entity);
51 51
             foreach ($this->getKeys($entity) as $key) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
     }
59 59
 
60
-    public function get (string $key, $caller, Closure $factory) {
60
+    public function get(string $key, $caller, Closure $factory) {
61 61
         return parent::get($key, $caller, function($caller) use ($key, $factory) {
62 62
             /** @var null|string|AbstractEntity $entity */
63 63
             if ($entity = $this->cache->get($key)) { // hit?
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param Api|Data $caller
102 102
      * @return AbstractEntity
103 103
      */
104
-    protected function hydrate (AbstractEntity $proto, $caller) {
104
+    protected function hydrate(AbstractEntity $proto, $caller) {
105 105
         return $this->api->factory(get_class($proto), $caller, $proto->toArray());
106 106
     }
107 107
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param AbstractEntity $entity
110 110
      * @throws InvalidArgumentException
111 111
      */
112
-    public function remove (AbstractEntity $entity): void {
112
+    public function remove(AbstractEntity $entity): void {
113 113
         parent::remove($entity);
114 114
         $this->cache->deleteMultiple($this->getKeys($entity));
115 115
     }
Please login to merge, or discard this patch.
src/Error.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/Base/AbstractEntity/DeleteTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     /**
14 14
      * `DELETE`
15 15
      */
16
-    public function delete (): void {
16
+    public function delete(): void {
17 17
         /** @var Api $api */
18 18
         $api = $this->api;
19 19
         $api->delete($this);
Please login to merge, or discard this patch.
src/Base/AbstractEntity/UpdateTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      *
16 16
      * @return $this
17 17
      */
18
-    public function update () {
18
+    public function update() {
19 19
         if ($this->isDiff()) {
20 20
             /** @var Api $api */
21 21
             $api = $this->api;
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/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/Base/AbstractEntity/CreateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
      *
16 16
      * @return string
17 17
      */
18
-    abstract protected function _getDir (): string;
18
+    abstract protected function _getDir(): string;
19 19
 
20 20
     /**
21 21
      * `POST`
22 22
      *
23 23
      * @return $this
24 24
      */
25
-    public function create () {
25
+    public function create() {
26 26
         /** @var Api $api */
27 27
         $api = $this->api;
28 28
         $remote = $api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']);
Please login to merge, or discard this patch.
src/Task/CustomValues.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,11 +41,9 @@
 block discarded – undo
41 41
             if ($field['type'] === CustomField::TYPE_ENUM) {
42 42
                 $this->optionNames[$gid] = array_column($field['enum_options'], 'name', 'gid');
43 43
                 $this->data[$gid] = $field['enum_value']['gid'];
44
-            }
45
-            elseif ($field['type'] === CustomField::TYPE_TEXT) {
44
+            } elseif ($field['type'] === CustomField::TYPE_TEXT) {
46 45
                 $this->data[$gid] = $field['text_value'];
47
-            }
48
-            elseif ($field['type'] === CustomField::TYPE_NUMBER) {
46
+            } elseif ($field['type'] === CustomField::TYPE_NUMBER) {
49 47
                 $this->data[$gid] = $field['number_value'];
50 48
             }
51 49
         }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     protected $task;
41 41
 
42
-    public function __construct (Task $task, array $fields) {
42
+    public function __construct(Task $task, array $fields) {
43 43
         parent::__construct($task);
44 44
         $this->task = $task;
45 45
         foreach ($fields as $field) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @return int
62 62
      */
63
-    public function count () {
63
+    public function count() {
64 64
         return count($this->data);
65 65
     }
66 66
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param string $enumGid
69 69
      * @return null|string
70 70
      */
71
-    public function getCurrentOptionName (string $enumGid): ?string {
71
+    public function getCurrentOptionName(string $enumGid): ?string {
72 72
         return $this->optionNames[$enumGid][$this[$enumGid]] ?? null;
73 73
     }
74 74
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param string $fieldName
77 77
      * @return null|string
78 78
      */
79
-    public function getGid (string $fieldName) {
79
+    public function getGid(string $fieldName) {
80 80
         return $this->gids[$fieldName] ?? null;
81 81
     }
82 82
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return string[]
87 87
      */
88
-    public function getGids () {
88
+    public function getGids() {
89 89
         return $this->gids;
90 90
     }
91 91
 
92 92
     /**
93 93
      * @return Traversable
94 94
      */
95
-    public function getIterator () {
95
+    public function getIterator() {
96 96
         return new ArrayIterator($this->data);
97 97
     }
98 98
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param string $fieldGid
101 101
      * @return null|string
102 102
      */
103
-    public function getName (string $fieldGid): ?string {
103
+    public function getName(string $fieldGid): ?string {
104 104
         return array_search($fieldGid, $this->gids) ?: null;
105 105
     }
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @return string[]
111 111
      */
112
-    public function getNames () {
112
+    public function getNames() {
113 113
         return array_flip($this->gids);
114 114
     }
115 115
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      * @param string $optionName
119 119
      * @return null|string
120 120
      */
121
-    public function getOptionGid (string $enumGid, string $optionName) {
121
+    public function getOptionGid(string $enumGid, string $optionName) {
122 122
         return array_search($optionName, $this->optionNames[$enumGid]) ?: null;
123 123
     }
124 124
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param string $enumGid
129 129
      * @return string[]
130 130
      */
131
-    public function getOptionGids (string $enumGid) {
131
+    public function getOptionGids(string $enumGid) {
132 132
         return array_flip($this->optionNames[$enumGid]);
133 133
     }
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      * @param string $optionGid
138 138
      * @return null|string
139 139
      */
140
-    public function getOptionName (string $enumGid, string $optionGid): ?string {
140
+    public function getOptionName(string $enumGid, string $optionGid): ?string {
141 141
         return $this->optionNames[$enumGid][$optionGid] ?? null;
142 142
     }
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @param string $enumGid
148 148
      * @return string[]
149 149
      */
150
-    public function getOptionNames (string $enumGid) {
150
+    public function getOptionNames(string $enumGid) {
151 151
         return $this->optionNames[$enumGid];
152 152
     }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @param string $fieldGid
156 156
      * @return null|number|string
157 157
      */
158
-    public function getValue (string $fieldGid) {
158
+    public function getValue(string $fieldGid) {
159 159
         return $this->data[$fieldGid] ?? null;
160 160
     }
161 161
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param string $fieldGid
164 164
      * @return bool
165 165
      */
166
-    public function offsetExists ($fieldGid) {
166
+    public function offsetExists($fieldGid) {
167 167
         return array_key_exists($fieldGid, $this->data);
168 168
     }
169 169
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @param string $fieldGid
172 172
      * @return null|number|string
173 173
      */
174
-    public function offsetGet ($fieldGid) {
174
+    public function offsetGet($fieldGid) {
175 175
         return $this->getValue($fieldGid);
176 176
     }
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      * @param string $fieldGid
180 180
      * @param null|number|string $value
181 181
      */
182
-    public function offsetSet ($fieldGid, $value) {
182
+    public function offsetSet($fieldGid, $value) {
183 183
         $this->setValue($fieldGid, $value);
184 184
     }
185 185
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      *
189 189
      * @param string $fieldGid
190 190
      */
191
-    public function offsetUnset ($fieldGid) {
191
+    public function offsetUnset($fieldGid) {
192 192
         $this->setValue($fieldGid, null);
193 193
     }
194 194
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @param null|number|string $value
198 198
      * @return $this
199 199
      */
200
-    public function setValue (string $fieldGid, $value) {
200
+    public function setValue(string $fieldGid, $value) {
201 201
         $this->data[$fieldGid] = $value;
202 202
         $this->diff[$fieldGid] = true;
203 203
         $this->task->diff['custom_fields'] = true;
Please login to merge, or discard this patch.
src/Task/External.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     protected $task;
26 26
 
27
-    public function __construct (Task $task, array $data = []) {
27
+    public function __construct(Task $task, array $data = []) {
28 28
         parent::__construct($task, $data);
29 29
         $this->task = $task;
30 30
     }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param mixed $value
37 37
      * @return $this
38 38
      */
39
-    protected function _set (string $key, $value) {
39
+    protected function _set(string $key, $value) {
40 40
         $this->task->diff['external'] = true;
41 41
         return parent::_set($key, $value);
42 42
     }
Please login to merge, or discard this patch.