@@ -92,8 +92,7 @@ |
||
92 | 92 | protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
93 | 93 | if ($this->hasGid()) { |
94 | 94 | return $this->_setWithPost($rmPath, $data, $field); |
95 | - } |
|
96 | - elseif (is_array($diff)) { |
|
95 | + } elseif (is_array($diff)) { |
|
97 | 96 | return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
98 | 97 | } |
99 | 98 | return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff))); |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return string |
33 | 33 | */ |
34 | - abstract public function __toString (): string; |
|
34 | + abstract public function __toString(): string; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @param self $entity |
38 | 38 | * @return bool |
39 | 39 | * @internal pool |
40 | 40 | */ |
41 | - final public function __merge (self $entity): bool { |
|
41 | + final public function __merge(self $entity): bool { |
|
42 | 42 | $old = $this->toArray(); |
43 | 43 | $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff)); |
44 | 44 | return $this->toArray() !== $old; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return $this |
53 | 53 | * @internal |
54 | 54 | */ |
55 | - protected function _addWithPost (string $addPath, array $data, string $field, array $diff) { |
|
55 | + protected function _addWithPost(string $addPath, array $data, string $field, array $diff) { |
|
56 | 56 | if ($this->hasGid()) { |
57 | 57 | return $this->_setWithPost($addPath, $data, $field); |
58 | 58 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string $field |
66 | 66 | * @return mixed |
67 | 67 | */ |
68 | - protected function _get (string $field) { |
|
68 | + protected function _get(string $field) { |
|
69 | 69 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
70 | 70 | $this->_reload($field); |
71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @param string $field |
77 | 77 | */ |
78 | - protected function _reload (string $field): void { |
|
78 | + protected function _reload(string $field): void { |
|
79 | 79 | $remote = $this->api->get($this, [], ['fields' => static::OPT_FIELDS[$field] ?? $field]); |
80 | 80 | $this->_setField($field, $remote[$field] ?? null); |
81 | 81 | $this->api->getPool()->add($this); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return $this |
90 | 90 | * @internal |
91 | 91 | */ |
92 | - protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
|
92 | + protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) { |
|
93 | 93 | if ($this->hasGid()) { |
94 | 94 | return $this->_setWithPost($rmPath, $data, $field); |
95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff))); |
100 | 100 | } |
101 | 101 | |
102 | - protected function _setData (array $data): void { |
|
102 | + protected function _setData(array $data): void { |
|
103 | 103 | // meaningless once the entity is being created. it's constant. |
104 | 104 | unset($data['resource_type'], $data['type']); |
105 | 105 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return $this |
117 | 117 | * @internal |
118 | 118 | */ |
119 | - protected function _setWithPost (string $path, array $data, string $field, $value = null) { |
|
119 | + protected function _setWithPost(string $path, array $data, string $field, $value = null) { |
|
120 | 120 | if ($this->hasGid()) { |
121 | 121 | /** @var array $remote */ |
122 | 122 | $remote = $this->api->post($path, $data, ['fields' => static::OPT_FIELDS[$field] ?? $field]); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * @return null|string |
134 | 134 | */ |
135 | - final public function getGid (): ?string { |
|
135 | + final public function getGid(): ?string { |
|
136 | 136 | return $this->data['gid'] ?? null; |
137 | 137 | } |
138 | 138 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return string[] |
143 | 143 | */ |
144 | - public function getPoolKeys () { |
|
144 | + public function getPoolKeys() { |
|
145 | 145 | return [$this->getGid(), (string)$this]; |
146 | 146 | } |
147 | 147 | |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - final public function getResourceType (): string { |
|
153 | + final public function getResourceType(): string { |
|
154 | 154 | return $this::TYPE; |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @return bool |
159 | 159 | */ |
160 | - final public function hasGid (): bool { |
|
160 | + final public function hasGid(): bool { |
|
161 | 161 | return isset($this->data['gid']); |
162 | 162 | } |
163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @depends after-create |
168 | 168 | * @return $this |
169 | 169 | */ |
170 | - public function reload () { |
|
170 | + public function reload() { |
|
171 | 171 | $remote = $this->api->get($this, [], ['expand' => 'this']); |
172 | 172 | if (!isset($remote['gid'])) { // null and dir guard |
173 | 173 | $this->api->getPool()->remove($this->getPoolKeys()); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'workspaces' => [Workspace::class] |
30 | 30 | ]; |
31 | 31 | |
32 | - final public function __toString (): string { |
|
32 | + final public function __toString(): string { |
|
33 | 33 | return "users/{$this->getGid()}"; |
34 | 34 | } |
35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param Workspace $workspace |
38 | 38 | * @return $this |
39 | 39 | */ |
40 | - public function addToWorkspace (Workspace $workspace) { |
|
40 | + public function addToWorkspace(Workspace $workspace) { |
|
41 | 41 | return $this->_addWithPost("{$workspace}/addUser", [ |
42 | 42 | 'user' => $this->getGid() |
43 | 43 | ], 'workspaces', [$workspace]); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return Workspace |
51 | 51 | */ |
52 | - public function getDefaultWorkspace () { |
|
52 | + public function getDefaultWorkspace() { |
|
53 | 53 | return $this->getWorkspaces()[0]; |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param null|Workspace $workspace Falls back to the default workspace. |
58 | 58 | * @return Portfolio[] |
59 | 59 | */ |
60 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
60 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
61 | 61 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
62 | 62 | } |
63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param null|Workspace $workspace Falls back to the default workspace. |
66 | 66 | * @return Project[] |
67 | 67 | */ |
68 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
68 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
69 | 69 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
70 | 70 | } |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param null|Workspace $workspace Falls back to the default workspace. |
74 | 74 | * @return Tag[] |
75 | 75 | */ |
76 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
76 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
77 | 77 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param null|Workspace $workspace Falls back to the default workspace. |
82 | 82 | * @return Team[] |
83 | 83 | */ |
84 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
84 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
85 | 85 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
86 | 86 | } |
87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param null|Workspace $workspace Falls back to the default workspace. |
90 | 90 | * @return User[] |
91 | 91 | */ |
92 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
92 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
93 | 93 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param null|Workspace $workspace Falls back to the default workspace. |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
102 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
103 | 103 | return $this->api->loadAll($this, $class, "{$this}/favorites", [ |
104 | 104 | 'resource_type' => $resourceType, |
105 | 105 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * @return string[] |
111 | 111 | */ |
112 | - public function getPoolKeys () { |
|
112 | + public function getPoolKeys() { |
|
113 | 113 | $keys = parent::getPoolKeys(); |
114 | 114 | |
115 | 115 | // include email as a key if it's loaded |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param null|Workspace $workspace |
125 | 125 | * @return Portfolio[] |
126 | 126 | */ |
127 | - public function getPortfolios (Workspace $workspace = null) { |
|
127 | + public function getPortfolios(Workspace $workspace = null) { |
|
128 | 128 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
129 | 129 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid(), |
130 | 130 | 'owner' => $this->getGid() |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param null|Workspace $workspace Falls back to the default workspace. |
136 | 136 | * @return TaskList |
137 | 137 | */ |
138 | - public function getTaskList (Workspace $workspace = null) { |
|
138 | + public function getTaskList(Workspace $workspace = null) { |
|
139 | 139 | return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [ |
140 | 140 | 'workspace' => ($workspace ?? $this->api->getDefaultWorkspace())->getGid() |
141 | 141 | ]); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string[] $filter `workspace` falls back to the default. |
148 | 148 | * @return Task[] |
149 | 149 | */ |
150 | - public function getTasks (array $filter = Task::FILTER_INCOMPLETE) { |
|
150 | + public function getTasks(array $filter = Task::FILTER_INCOMPLETE) { |
|
151 | 151 | $filter['assignee'] = $this->getGid(); |
152 | 152 | $filter += ['workspace' => $this->api->getDefaultWorkspace()->getGid()]; |
153 | 153 | return $this->api->loadAll($this, Task::class, 'tasks', $filter); |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | * @param null|Workspace $organization Falls back to the default workspace. |
162 | 162 | * @return Team[] |
163 | 163 | */ |
164 | - public function getTeams (Workspace $organization = null) { |
|
164 | + public function getTeams(Workspace $organization = null) { |
|
165 | 165 | return $this->api->loadAll($this, Team::class, "{$this}/teams", [ |
166 | 166 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
167 | 167 | ]); |
168 | 168 | } |
169 | 169 | |
170 | - public function getUrl (): string { |
|
170 | + public function getUrl(): string { |
|
171 | 171 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
172 | 172 | } |
173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param Workspace $workspace |
176 | 176 | * @return $this |
177 | 177 | */ |
178 | - public function removeFromWorkspace (Workspace $workspace) { |
|
178 | + public function removeFromWorkspace(Workspace $workspace) { |
|
179 | 179 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
180 | 180 | 'user' => $this->getGid() |
181 | 181 | ], 'workspaces', [$workspace]); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'parent' => Task::class |
34 | 34 | ]; |
35 | 35 | |
36 | - final public function __toString (): string { |
|
36 | + final public function __toString(): string { |
|
37 | 37 | return "attachments/{$this->getGid()}"; |
38 | 38 | } |
39 | 39 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $file |
46 | 46 | * @return $this |
47 | 47 | */ |
48 | - public function upload (string $file) { |
|
48 | + public function upload(string $file) { |
|
49 | 49 | // api returns compact version. reload. |
50 | 50 | $remote = $this->api->upload($file, "{$this->getParent()}/attachments"); |
51 | 51 | $this->data['gid'] = $remote['gid']; |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | */ |
79 | 79 | private $defaultSection; |
80 | 80 | |
81 | - final public function __toString (): string { |
|
81 | + final public function __toString(): string { |
|
82 | 82 | return "projects/{$this->getGid()}"; |
83 | 83 | } |
84 | 84 | |
85 | - final protected function _getDir (): string { |
|
85 | + final protected function _getDir(): string { |
|
86 | 86 | return 'projects'; |
87 | 87 | } |
88 | 88 | |
89 | - protected function _setData (array $data): void { |
|
89 | + protected function _setData(array $data): void { |
|
90 | 90 | // this is always empty. fields are in the settings, values are in tasks. |
91 | 91 | unset($data['custom_fields']); |
92 | 92 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param User $user |
102 | 102 | * @return $this |
103 | 103 | */ |
104 | - public function addMember (User $user) { |
|
104 | + public function addMember(User $user) { |
|
105 | 105 | return $this->addMembers([$user]); |
106 | 106 | } |
107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param User[] $users |
111 | 111 | * @return $this |
112 | 112 | */ |
113 | - public function addMembers (array $users) { |
|
113 | + public function addMembers(array $users) { |
|
114 | 114 | return $this->_addWithPost("{$this}/addMembers", [ |
115 | 115 | 'members' => array_column($users, 'gid') |
116 | 116 | ], 'members', $users); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param string $target |
122 | 122 | * @return ProjectWebhook |
123 | 123 | */ |
124 | - public function addWebhook (string $target) { |
|
124 | + public function addWebhook(string $target) { |
|
125 | 125 | /** @var ProjectWebhook $webhook */ |
126 | 126 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
127 | 127 | return $webhook->create($this, $target); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param array $schedule |
147 | 147 | * @return Job |
148 | 148 | */ |
149 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
149 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
150 | 150 | $data = ['name' => $name]; |
151 | 151 | if ($team) { |
152 | 152 | $data['team'] = $team->getGid(); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @depends after-create |
167 | 167 | * @return Section |
168 | 168 | */ |
169 | - public function getDefaultSection () { |
|
169 | + public function getDefaultSection() { |
|
170 | 170 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
171 | 171 | } |
172 | 172 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param null|string $token |
180 | 180 | * @return Event[] |
181 | 181 | */ |
182 | - public function getEvents (&$token) { |
|
182 | + public function getEvents(&$token) { |
|
183 | 183 | return $this->api->sync($this->getGid(), $token); |
184 | 184 | } |
185 | 185 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param int $limit |
192 | 192 | * @return Traversable|Section[] |
193 | 193 | */ |
194 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
194 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
195 | 195 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
196 | 196 | } |
197 | 197 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param int $limit |
201 | 201 | * @return Section[] |
202 | 202 | */ |
203 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
203 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
204 | 204 | return iterator_to_array($this->getIterator($limit)); |
205 | 205 | } |
206 | 206 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @depends after-create |
209 | 209 | * @return Status[] |
210 | 210 | */ |
211 | - public function getStatuses () { |
|
211 | + public function getStatuses() { |
|
212 | 212 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
213 | 213 | } |
214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @depends after-create |
217 | 217 | * @return TaskCounts |
218 | 218 | */ |
219 | - public function getTaskCounts () { |
|
219 | + public function getTaskCounts() { |
|
220 | 220 | /** @var array $remote */ |
221 | 221 | $remote = $this->api->get("{$this}/task_counts", [], TaskCounts::OPT); |
222 | 222 | return $this->api->factory($this, TaskCounts::class, $remote); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param array $filter |
230 | 230 | * @return Task[] |
231 | 231 | */ |
232 | - public function getTasks (array $filter = Task::FILTER_INCOMPLETE) { |
|
232 | + public function getTasks(array $filter = Task::FILTER_INCOMPLETE) { |
|
233 | 233 | $filter['project'] = $this->getGid(); |
234 | 234 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
235 | 235 | } |
@@ -238,25 +238,25 @@ discard block |
||
238 | 238 | * @depends after-create |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public function getUrl (): string { |
|
241 | + public function getUrl(): string { |
|
242 | 242 | return "https://app.asana.com/0/{$this->getGid()}"; |
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | 246 | * @return ProjectWebhook[] |
247 | 247 | */ |
248 | - public function getWebhooks () { |
|
248 | + public function getWebhooks() { |
|
249 | 249 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
250 | 250 | 'workspace' => $this->getWorkspace()->getGid(), |
251 | 251 | 'resource' => $this->getGid() |
252 | 252 | ]); |
253 | 253 | } |
254 | 254 | |
255 | - public function isBoard (): bool { |
|
255 | + public function isBoard(): bool { |
|
256 | 256 | return $this->getLayout() === self::LAYOUT_BOARD; |
257 | 257 | } |
258 | 258 | |
259 | - public function isList (): bool { |
|
259 | + public function isList(): bool { |
|
260 | 260 | return $this->getLayout() === self::LAYOUT_LIST; |
261 | 261 | } |
262 | 262 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @depends after-create |
265 | 265 | * @return Section |
266 | 266 | */ |
267 | - public function newSection () { |
|
267 | + public function newSection() { |
|
268 | 268 | return $this->api->factory($this, Section::class, ['project' => $this]); |
269 | 269 | } |
270 | 270 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @depends after-create |
273 | 273 | * @return Status |
274 | 274 | */ |
275 | - public function newStatus () { |
|
275 | + public function newStatus() { |
|
276 | 276 | return $this->api->factory($this, Status::class); |
277 | 277 | } |
278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @depends after-create |
283 | 283 | * @return Task |
284 | 284 | */ |
285 | - public function newTask () { |
|
285 | + public function newTask() { |
|
286 | 286 | return $this->getDefaultSection()->newTask(); |
287 | 287 | } |
288 | 288 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @param User $user |
292 | 292 | * @return $this |
293 | 293 | */ |
294 | - public function removeMember (User $user) { |
|
294 | + public function removeMember(User $user) { |
|
295 | 295 | return $this->removeMembers([$user]); |
296 | 296 | } |
297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param User[] $users |
301 | 301 | * @return $this |
302 | 302 | */ |
303 | - public function removeMembers (array $users) { |
|
303 | + public function removeMembers(array $users) { |
|
304 | 304 | return $this->_removeWithPost("{$this}/removeMembers", [ |
305 | 305 | 'members' => array_column($users, 'gid') |
306 | 306 | ], 'members', $users); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @param callable $filter `fn( Section $section ): bool` |
311 | 311 | * @return Section[] |
312 | 312 | */ |
313 | - public function selectSections (callable $filter) { |
|
313 | + public function selectSections(callable $filter) { |
|
314 | 314 | return $this->_select($this->getSections(), $filter); |
315 | 315 | } |
316 | 316 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @param callable $filter `fn( Status $status ): bool` |
319 | 319 | * @return Status[] |
320 | 320 | */ |
321 | - public function selectStatuses (callable $filter) { |
|
321 | + public function selectStatuses(callable $filter) { |
|
322 | 322 | return $this->_select($this->getStatuses(), $filter); |
323 | 323 | } |
324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
328 | 328 | * @return Task[] |
329 | 329 | */ |
330 | - public function selectTasks (callable $filter, array $apiFilter = Task::FILTER_INCOMPLETE) { |
|
330 | + public function selectTasks(callable $filter, array $apiFilter = Task::FILTER_INCOMPLETE) { |
|
331 | 331 | return $this->_select($this->getTasks($apiFilter), $filter); |
332 | 332 | } |
333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @param null|Team $team |
337 | 337 | * @return $this |
338 | 338 | */ |
339 | - public function setTeam (?Team $team) { |
|
339 | + public function setTeam(?Team $team) { |
|
340 | 340 | if ($team and !$this->hasWorkspace()) { |
341 | 341 | $this->setWorkspace($team->getOrganization()); |
342 | 342 | } |
@@ -484,8 +484,7 @@ |
||
484 | 484 | 'sync' => $token, |
485 | 485 | 'opt_expand' => 'this' |
486 | 486 | ])); |
487 | - } |
|
488 | - catch (AsanaError $error) { |
|
487 | + } catch (AsanaError $error) { |
|
489 | 488 | if ($error->getCode() === 412) { |
490 | 489 | $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
491 | 490 | if (!isset($token)) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $token |
44 | 44 | * @param Pool|null $pool |
45 | 45 | */ |
46 | - public function __construct (string $token, Pool $pool = null) { |
|
46 | + public function __construct(string $token, Pool $pool = null) { |
|
47 | 47 | $this->token = $token; |
48 | 48 | $this->pool = $pool ?? new Pool(); |
49 | 49 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return null|array |
58 | 58 | * @internal |
59 | 59 | */ |
60 | - protected function _exec (string $method, string $path, array $curlOpts = []) { |
|
60 | + protected function _exec(string $method, string $path, array $curlOpts = []) { |
|
61 | 61 | $log = $this->getLog(); |
62 | 62 | $log->log(LOG_DEBUG, "{$method} {$path}", $curlOpts); |
63 | 63 | /** @var resource $ch */ |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | switch ($curlInfo['http_code']) { |
89 | 89 | case 200: |
90 | 90 | case 201: |
91 | - return json_decode($body, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
91 | + return json_decode($body, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
92 | 92 | case 404: |
93 | 93 | return null; |
94 | 94 | case 429: |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @param string $path |
109 | 109 | */ |
110 | - public function delete (string $path): void { |
|
110 | + public function delete(string $path): void { |
|
111 | 111 | $this->_exec('DELETE', $path); |
112 | 112 | } |
113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param array $data |
122 | 122 | * @return mixed|Data|AbstractEntity |
123 | 123 | */ |
124 | - public function factory ($caller, string $class, array $data = []) { |
|
124 | + public function factory($caller, string $class, array $data = []) { |
|
125 | 125 | return new $class($caller, $data); |
126 | 126 | } |
127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param array $opt |
134 | 134 | * @return null|array |
135 | 135 | */ |
136 | - public function get (string $path, array $query = [], array $opt = []) { |
|
136 | + public function get(string $path, array $query = [], array $opt = []) { |
|
137 | 137 | foreach ($opt as $name => $value) { |
138 | 138 | $query["opt_{$name}"] = $value; |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $gid |
148 | 148 | * @return null|Attachment |
149 | 149 | */ |
150 | - public function getAttachment (string $gid) { |
|
150 | + public function getAttachment(string $gid) { |
|
151 | 151 | return $this->load($this, Attachment::class, "attachments/{$gid}"); |
152 | 152 | } |
153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $gid |
158 | 158 | * @return null|CustomField |
159 | 159 | */ |
160 | - public function getCustomField (string $gid) { |
|
160 | + public function getCustomField(string $gid) { |
|
161 | 161 | return $this->load($this, CustomField::class, "custom_fields/{$gid}"); |
162 | 162 | } |
163 | 163 | |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return Workspace |
169 | 169 | */ |
170 | - public function getDefaultWorkspace () { |
|
170 | + public function getDefaultWorkspace() { |
|
171 | 171 | return $this->getMe()->getDefaultWorkspace(); |
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | 175 | * @return LoggerInterface |
176 | 176 | */ |
177 | - public function getLog () { |
|
177 | + public function getLog() { |
|
178 | 178 | return $this->log ?? $this->log = new NullLogger(); |
179 | 179 | } |
180 | 180 | |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return User |
185 | 185 | */ |
186 | - public function getMe () { |
|
186 | + public function getMe() { |
|
187 | 187 | return $this->getUser('me'); |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | 191 | * @return Pool |
192 | 192 | */ |
193 | - final public function getPool () { |
|
193 | + final public function getPool() { |
|
194 | 194 | return $this->pool; |
195 | 195 | } |
196 | 196 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param string $gid |
201 | 201 | * @return null|Portfolio |
202 | 202 | */ |
203 | - public function getPortfolio (string $gid) { |
|
203 | + public function getPortfolio(string $gid) { |
|
204 | 204 | return $this->load($this, Portfolio::class, "portfolios/{$gid}"); |
205 | 205 | } |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param string $gid |
211 | 211 | * @return null|Project |
212 | 212 | */ |
213 | - public function getProject (string $gid) { |
|
213 | + public function getProject(string $gid) { |
|
214 | 214 | return $this->load($this, Project::class, "projects/{$gid}"); |
215 | 215 | } |
216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param string $gid |
221 | 221 | * @return null|Section |
222 | 222 | */ |
223 | - public function getSection (string $gid) { |
|
223 | + public function getSection(string $gid) { |
|
224 | 224 | return $this->load($this, Section::class, "sections/{$gid}"); |
225 | 225 | } |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param string $gid |
231 | 231 | * @return null|Story |
232 | 232 | */ |
233 | - public function getStory (string $gid) { |
|
233 | + public function getStory(string $gid) { |
|
234 | 234 | return $this->load($this, Story::class, "stories/{$gid}"); |
235 | 235 | } |
236 | 236 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @param string $gid |
241 | 241 | * @return null|Tag |
242 | 242 | */ |
243 | - public function getTag (string $gid) { |
|
243 | + public function getTag(string $gid) { |
|
244 | 244 | return $this->load($this, Tag::class, "tags/{$gid}"); |
245 | 245 | } |
246 | 246 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @param string $gid |
251 | 251 | * @return null|Task |
252 | 252 | */ |
253 | - public function getTask (string $gid) { |
|
253 | + public function getTask(string $gid) { |
|
254 | 254 | return $this->load($this, Task::class, "tasks/{$gid}"); |
255 | 255 | } |
256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param string $gid |
261 | 261 | * @return null|TaskList |
262 | 262 | */ |
263 | - public function getTaskList (string $gid) { |
|
263 | + public function getTaskList(string $gid) { |
|
264 | 264 | return $this->load($this, TaskList::class, "user_task_lists/{$gid}"); |
265 | 265 | } |
266 | 266 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param string $gid |
271 | 271 | * @return null|Team |
272 | 272 | */ |
273 | - public function getTeam (string $gid) { |
|
273 | + public function getTeam(string $gid) { |
|
274 | 274 | return $this->load($this, Team::class, "teams/{$gid}"); |
275 | 275 | } |
276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param string $gid |
281 | 281 | * @return null|User |
282 | 282 | */ |
283 | - public function getUser (string $gid) { |
|
283 | + public function getUser(string $gid) { |
|
284 | 284 | return $this->load($this, User::class, "users/{$gid}"); |
285 | 285 | } |
286 | 286 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @param string $gid |
289 | 289 | * @return ProjectWebhook|TaskWebhook |
290 | 290 | */ |
291 | - public function getWebhook (string $gid) { |
|
291 | + public function getWebhook(string $gid) { |
|
292 | 292 | return $this->pool->get($gid, $this, function() use ($gid) { |
293 | 293 | static $classes = [ |
294 | 294 | Project::TYPE => ProjectWebhook::class, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param array $data |
310 | 310 | * @return Event |
311 | 311 | */ |
312 | - public function getWebhookEvent (array $data) { |
|
312 | + public function getWebhookEvent(array $data) { |
|
313 | 313 | return $this->factory($this, Event::class, $data); |
314 | 314 | } |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param string $gid |
320 | 320 | * @return null|Workspace |
321 | 321 | */ |
322 | - public function getWorkspace (string $gid) { |
|
322 | + public function getWorkspace(string $gid) { |
|
323 | 323 | return $this->load($this, Workspace::class, "workspaces/{$gid}"); |
324 | 324 | } |
325 | 325 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $query |
333 | 333 | * @return null|mixed|AbstractEntity |
334 | 334 | */ |
335 | - public function load ($caller, string $class, string $path, array $query = []) { |
|
335 | + public function load($caller, string $class, string $path, array $query = []) { |
|
336 | 336 | $key = rtrim($path . '?' . http_build_query($query), '?'); |
337 | 337 | return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) { |
338 | 338 | if ($data = $this->get($path, $query, ['expand' => 'this'])) { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param array $query |
352 | 352 | * @return array|AbstractEntity[] |
353 | 353 | */ |
354 | - public function loadAll ($caller, string $class, string $path, array $query = []) { |
|
354 | + public function loadAll($caller, string $class, string $path, array $query = []) { |
|
355 | 355 | return iterator_to_array($this->loadEach(...func_get_args())); |
356 | 356 | } |
357 | 357 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @param array $query `limit` can exceed `100` here. |
367 | 367 | * @return Generator|AbstractEntity[] |
368 | 368 | */ |
369 | - public function loadEach ($caller, string $class, string $path, array $query = []) { |
|
369 | + public function loadEach($caller, string $class, string $path, array $query = []) { |
|
370 | 370 | $query['opt_expand'] = 'this'; |
371 | 371 | $remain = $query['limit'] ?? PHP_INT_MAX; |
372 | 372 | do { |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | * @param array $opt |
391 | 391 | * @return null|array |
392 | 392 | */ |
393 | - public function post (string $path, array $data = [], array $opt = []) { |
|
393 | + public function post(string $path, array $data = [], array $opt = []) { |
|
394 | 394 | $response = $this->_exec('POST', $path, [ |
395 | 395 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
396 | 396 | CURLOPT_POSTFIELDS => json_encode([ |
397 | 397 | 'options' => $opt, |
398 | 398 | 'data' => $data |
399 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
399 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
400 | 400 | ]); |
401 | 401 | return $response['data'] ?? null; |
402 | 402 | } |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | * @param array $opt |
410 | 410 | * @return null|array |
411 | 411 | */ |
412 | - public function put (string $path, array $data = [], array $opt = []) { |
|
412 | + public function put(string $path, array $data = [], array $opt = []) { |
|
413 | 413 | $response = $this->_exec('PUT', $path, [ |
414 | 414 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
415 | 415 | CURLOPT_POSTFIELDS => json_encode([ |
416 | 416 | 'options' => $opt, |
417 | 417 | 'data' => $data |
418 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
418 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
419 | 419 | ]); |
420 | 420 | return $response['data'] ?? null; |
421 | 421 | } |
@@ -423,14 +423,14 @@ discard block |
||
423 | 423 | /** |
424 | 424 | * @param LoggerInterface $log |
425 | 425 | */ |
426 | - public function setLog (LoggerInterface $log) { |
|
426 | + public function setLog(LoggerInterface $log) { |
|
427 | 427 | $this->log = $log; |
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
431 | 431 | * @param Pool $pool |
432 | 432 | */ |
433 | - public function setPool (Pool $pool) { |
|
433 | + public function setPool(Pool $pool) { |
|
434 | 434 | $this->pool = $pool; |
435 | 435 | } |
436 | 436 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @param null|string $token Updated to the new token. |
448 | 448 | * @return Event[] |
449 | 449 | */ |
450 | - public function sync (string $gid, ?string &$token) { |
|
450 | + public function sync(string $gid, ?string &$token) { |
|
451 | 451 | try { |
452 | 452 | /** @var array $remote Asana throws 400 for missing entities here. */ |
453 | 453 | $remote = $this->_exec('GET', 'events?' . http_build_query([ |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | catch (AsanaError $error) { |
460 | 460 | if ($error->getCode() === 412) { |
461 | - $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
461 | + $remote = json_decode($error->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
462 | 462 | if (!isset($token)) { |
463 | 463 | // API docs say: "The response will be the same as for an expired sync token." |
464 | 464 | // The caller knowingly gave a null token, so we don't need to rethrow. |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @param string $to |
488 | 488 | * @return array |
489 | 489 | */ |
490 | - public function upload (string $file, string $to) { |
|
490 | + public function upload(string $file, string $to) { |
|
491 | 491 | return $this->_exec('POST', $to, [ |
492 | 492 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
493 | 493 | ])['data']; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @return $this |
18 | 18 | */ |
19 | - public function update () { |
|
19 | + public function update() { |
|
20 | 20 | if ($this->isDiff()) { |
21 | 21 | /** @var array $remote */ |
22 | 22 | $remote = $this->api->put($this, $this->toArray(true), ['expand' => 'this']); |
@@ -16,14 +16,14 @@ |
||
16 | 16 | * |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - abstract protected function _getDir (): string; |
|
19 | + abstract protected function _getDir(): string; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * `POST` the new entity to Asana. |
23 | 23 | * |
24 | 24 | * @return $this |
25 | 25 | */ |
26 | - public function create () { |
|
26 | + public function create() { |
|
27 | 27 | /** @var array $remote */ |
28 | 28 | $remote = $this->api->post($this->_getDir(), $this->toArray(true), ['expand' => 'this']); |
29 | 29 | $this->_setData($remote); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param array $data |
29 | 29 | */ |
30 | - protected function _setData (array $data): void { |
|
30 | + protected function _setData(array $data): void { |
|
31 | 31 | if (isset($data['resource_subtype'])) { |
32 | 32 | $tiny = array_intersect_key($data, array_flip([ |
33 | 33 | 'gid', |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * @param null|string $value |
55 | 55 | * @return null|string |
56 | 56 | */ |
57 | - protected function _toEnumOptionGid ($value) { |
|
57 | + protected function _toEnumOptionGid($value) { |
|
58 | 58 | return $this->getEnumOptionValues()[$value] ?? $value; |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - public function getCurrentOptionName () { |
|
64 | + public function getCurrentOptionName() { |
|
65 | 65 | return $this->getEnumOptionNames()[$this->getValue()]; |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return string[] |
72 | 72 | */ |
73 | - public function getEnumOptionNames () { |
|
73 | + public function getEnumOptionNames() { |
|
74 | 74 | static $names = []; // shared |
75 | 75 | $gid = $this->data['gid']; |
76 | 76 | return $names[$gid] ?? $names[$gid] = array_column($this->data['enum_options'], 'name', 'gid'); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return string[] |
83 | 83 | */ |
84 | - public function getEnumOptionValues () { |
|
84 | + public function getEnumOptionValues() { |
|
85 | 85 | static $values = []; // shared |
86 | 86 | $gid = $this->data['gid']; |
87 | 87 | return $values[$gid] ?? $values[$gid] = array_column($this->data['enum_options'], 'gid', 'name'); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * @return null|number|string |
92 | 92 | */ |
93 | - public function getValue () { |
|
93 | + public function getValue() { |
|
94 | 94 | $type = $this->data['type']; |
95 | 95 | if ($type === CustomField::TYPE_ENUM) { |
96 | 96 | return $this->data['enum_value']['gid'] ?? null; |
@@ -101,21 +101,21 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @return bool |
103 | 103 | */ |
104 | - final public function isEnum (): bool { |
|
104 | + final public function isEnum(): bool { |
|
105 | 105 | return $this->getType() === CustomField::TYPE_ENUM; |
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - final public function isNumber (): bool { |
|
111 | + final public function isNumber(): bool { |
|
112 | 112 | return $this->getType() === CustomField::TYPE_NUMBER; |
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @return bool |
117 | 117 | */ |
118 | - final public function isText (): bool { |
|
118 | + final public function isText(): bool { |
|
119 | 119 | return $this->getType() === CustomField::TYPE_TEXT; |
120 | 120 | } |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param null|number|string $value |
124 | 124 | * @return $this |
125 | 125 | */ |
126 | - public function setValue ($value) { |
|
126 | + public function setValue($value) { |
|
127 | 127 | $type = $this->data['type']; |
128 | 128 | $this->diff["{$type}_value"] = true; |
129 | 129 | if ($type === CustomField::TYPE_ENUM) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected $types = []; |
51 | 51 | |
52 | - public function __construct (Task $task, array $data = []) { |
|
52 | + public function __construct(Task $task, array $data = []) { |
|
53 | 53 | $this->task = $task; |
54 | 54 | parent::__construct($task, $data); |
55 | 55 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param string $i |
59 | 59 | * @param array $data |
60 | 60 | */ |
61 | - protected function _setField (string $i, $data): void { |
|
61 | + protected function _setField(string $i, $data): void { |
|
62 | 62 | /** @var FieldEntry $entry */ |
63 | 63 | $entry = $this->api->factory($this, FieldEntry::class, $data); |
64 | 64 | $gid = $entry->getGid(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param $offset |
73 | 73 | * @return null|string |
74 | 74 | */ |
75 | - protected function _toGid (string $offset) { |
|
75 | + protected function _toGid(string $offset) { |
|
76 | 76 | if (isset($this->names[$offset])) { |
77 | 77 | return $offset; |
78 | 78 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @return int |
84 | 84 | */ |
85 | - public function count () { |
|
85 | + public function count() { |
|
86 | 86 | return count($this->data); |
87 | 87 | } |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param $fieldGid |
91 | 91 | * @return FieldEntry |
92 | 92 | */ |
93 | - public function getField ($fieldGid) { |
|
93 | + public function getField($fieldGid) { |
|
94 | 94 | return $this->data[$fieldGid]; |
95 | 95 | } |
96 | 96 | |
@@ -98,41 +98,41 @@ discard block |
||
98 | 98 | * @param string $name |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function getGid (string $name): string { |
|
101 | + public function getGid(string $name): string { |
|
102 | 102 | return $this->gids[$name]; |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @return string[] |
107 | 107 | */ |
108 | - public function getGids () { |
|
108 | + public function getGids() { |
|
109 | 109 | return $this->gids; |
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @return Generator |
114 | 114 | */ |
115 | - public function getIterator () { |
|
115 | + public function getIterator() { |
|
116 | 116 | foreach ($this->data as $gid => $field) { |
117 | 117 | yield $gid => $field->getValue(); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - public function getName (string $fieldGid) { |
|
121 | + public function getName(string $fieldGid) { |
|
122 | 122 | return $this->names[$fieldGid]; |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @return string[] |
127 | 127 | */ |
128 | - public function getNames () { |
|
128 | + public function getNames() { |
|
129 | 129 | return $this->names; |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | 133 | * @return array |
134 | 134 | */ |
135 | - public function getValues () { |
|
135 | + public function getValues() { |
|
136 | 136 | return iterator_to_array($this); |
137 | 137 | } |
138 | 138 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param string $offset |
141 | 141 | * @return bool |
142 | 142 | */ |
143 | - public function offsetExists ($offset) { |
|
143 | + public function offsetExists($offset) { |
|
144 | 144 | return isset($this->data[$this->_toGid($offset)]); |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string $offset |
149 | 149 | * @return null|number|string |
150 | 150 | */ |
151 | - public function offsetGet ($offset) { |
|
151 | + public function offsetGet($offset) { |
|
152 | 152 | return $this->data[$this->_toGid($offset)]->getValue(); |
153 | 153 | } |
154 | 154 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param string $offset |
157 | 157 | * @param null|number|string $value |
158 | 158 | */ |
159 | - public function offsetSet ($offset, $value) { |
|
159 | + public function offsetSet($offset, $value) { |
|
160 | 160 | $offset = $this->_toGid($offset); |
161 | 161 | $this->data[$offset]->setValue($value); |
162 | 162 | $this->diff[$offset] = true; |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @param string $offset |
170 | 170 | */ |
171 | - public function offsetUnset ($offset) { |
|
171 | + public function offsetUnset($offset) { |
|
172 | 172 | $this->offsetSet($offset, null); |
173 | 173 | } |
174 | 174 | |
175 | - public function toArray (bool $diff = false): array { |
|
175 | + public function toArray(bool $diff = false): array { |
|
176 | 176 | if ($diff) { |
177 | 177 | return array_map(function(FieldEntry $entry) { |
178 | 178 | return $entry->getValue(); |