@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | 'organization' => Workspace::class |
34 | 34 | ]; |
35 | 35 | |
36 | - final public function __toString (): string { |
|
36 | + final public function __toString(): string { |
|
37 | 37 | return "organization_exports/{$this->getGid()}"; |
38 | 38 | } |
39 | 39 | |
40 | - final protected function _getDir (): string { |
|
40 | + final protected function _getDir(): string { |
|
41 | 41 | return "organization_exports"; |
42 | 42 | } |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param Workspace $organization |
46 | 46 | * @return $this |
47 | 47 | */ |
48 | - public function create (Workspace $organization) { |
|
48 | + public function create(Workspace $organization) { |
|
49 | 49 | $this->_set('organization', $organization); |
50 | 50 | return $this->_create(); |
51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return bool |
57 | 57 | */ |
58 | - final public function isActive (): bool { |
|
58 | + final public function isActive(): bool { |
|
59 | 59 | return $this->getState() === self::STATE_ACTIVE; |
60 | 60 | } |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - final public function isDone (): bool { |
|
67 | + final public function isDone(): bool { |
|
68 | 68 | return $this->isSuccessful() or $this->isFailed(); |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - final public function isFailed (): bool { |
|
76 | + final public function isFailed(): bool { |
|
77 | 77 | return $this->getState() === self::STATE_FAIL; |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | - final public function isQueued (): bool { |
|
85 | + final public function isQueued(): bool { |
|
86 | 86 | return $this->getState() === self::STATE_QUEUED; |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return bool |
93 | 93 | */ |
94 | - final public function isSuccessful (): bool { |
|
94 | + final public function isSuccessful(): bool { |
|
95 | 95 | return $this->getState() === self::STATE_SUCCESS; |
96 | 96 | } |
97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param callable $spinner `fn( OrganizationExport $this ): void` |
104 | 104 | * @return $this |
105 | 105 | */ |
106 | - public function wait (callable $spinner = null) { |
|
106 | + public function wait(callable $spinner = null) { |
|
107 | 107 | while (!$this->isDone()) { |
108 | 108 | if ($spinner) { |
109 | 109 | call_user_func($spinner, $this); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'new_task' => Task::class |
34 | 34 | ]; |
35 | 35 | |
36 | - final public function __toString (): string { |
|
36 | + final public function __toString(): string { |
|
37 | 37 | return "jobs/{$this->getGid()}"; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return bool |
44 | 44 | */ |
45 | - public function isActive (): bool { |
|
45 | + public function isActive(): bool { |
|
46 | 46 | return $this->getStatus() === self::STATUS_ACTIVE; |
47 | 47 | } |
48 | 48 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return bool |
53 | 53 | */ |
54 | - public function isDone (): bool { |
|
54 | + public function isDone(): bool { |
|
55 | 55 | return $this->isSuccessful() or $this->isFailed(); |
56 | 56 | } |
57 | 57 | |
58 | - final public function isDuplicatingProject (): bool { |
|
58 | + final public function isDuplicatingProject(): bool { |
|
59 | 59 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_PROJECT; |
60 | 60 | } |
61 | 61 | |
62 | - final public function isDuplicatingTask (): bool { |
|
62 | + final public function isDuplicatingTask(): bool { |
|
63 | 63 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_TASK; |
64 | 64 | } |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return bool |
70 | 70 | */ |
71 | - public function isFailed (): bool { |
|
71 | + public function isFailed(): bool { |
|
72 | 72 | return $this->getStatus() === self::STATUS_FAIL; |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | - public function isQueued (): bool { |
|
80 | + public function isQueued(): bool { |
|
81 | 81 | return $this->getStatus() === self::STATUS_QUEUED; |
82 | 82 | } |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public function isSuccessful (): bool { |
|
89 | + public function isSuccessful(): bool { |
|
90 | 90 | return $this->getStatus() === self::STATUS_SUCCESS; |
91 | 91 | } |
92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param callable $spinner `fn( Job $this ): void` |
99 | 99 | * @return $this |
100 | 100 | */ |
101 | - public function wait (callable $spinner = null) { |
|
101 | + public function wait(callable $spinner = null) { |
|
102 | 102 | while (!$this->isDone()) { |
103 | 103 | if ($spinner) { |
104 | 104 | call_user_func($spinner, $this); |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | * @param Project $project |
51 | 51 | * @param array $data |
52 | 52 | */ |
53 | - public function __construct (Project $project, array $data = []) { |
|
53 | + public function __construct(Project $project, array $data = []) { |
|
54 | 54 | parent::__construct($project, $data); |
55 | 55 | $this->project = $project; |
56 | 56 | } |
57 | 57 | |
58 | - final public function __toString (): string { |
|
58 | + final public function __toString(): string { |
|
59 | 59 | return "project_statuses/{$this->getGid()}"; |
60 | 60 | } |
61 | 61 | |
62 | - final protected function _getDir (): string { |
|
62 | + final protected function _getDir(): string { |
|
63 | 63 | return "{$this->project}/project_statuses"; |
64 | 64 | } |
65 | 65 | |
66 | - protected function _setData (array $data): void { |
|
66 | + protected function _setData(array $data): void { |
|
67 | 67 | // redundant, prefer created_by |
68 | 68 | unset($data['author']); |
69 | 69 | parent::_setData($data); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @return Project |
74 | 74 | */ |
75 | - public function getProject () { |
|
75 | + public function getProject() { |
|
76 | 76 | return $this->project; |
77 | 77 | } |
78 | 78 | } |
79 | 79 | \ No newline at end of file |
@@ -15,15 +15,15 @@ |
||
15 | 15 | |
16 | 16 | const NAME = 'asana'; |
17 | 17 | |
18 | - public function boot () { |
|
18 | + public function boot() { |
|
19 | 19 | $this->publishes([__DIR__ . '/config/asana.php' => App::configPath('asana.php')]); |
20 | 20 | } |
21 | 21 | |
22 | - public function provides () { |
|
22 | + public function provides() { |
|
23 | 23 | return [self::NAME]; |
24 | 24 | } |
25 | 25 | |
26 | - public function register () { |
|
26 | + public function register() { |
|
27 | 27 | $this->app->singleton(self::NAME, function(Application $app) { |
28 | 28 | $config = $app['config'][self::NAME]; |
29 | 29 |
@@ -53,23 +53,23 @@ |
||
53 | 53 | 'user' => User::class |
54 | 54 | ]; |
55 | 55 | |
56 | - final public function wasAddition (): bool { |
|
56 | + final public function wasAddition(): bool { |
|
57 | 57 | return $this->getAction() === self::ACTION_ADDED; |
58 | 58 | } |
59 | 59 | |
60 | - final public function wasChange (): bool { |
|
60 | + final public function wasChange(): bool { |
|
61 | 61 | return $this->getAction() === self::ACTION_CHANGED; |
62 | 62 | } |
63 | 63 | |
64 | - final public function wasDeletion (): bool { |
|
64 | + final public function wasDeletion(): bool { |
|
65 | 65 | return $this->getAction() === self::ACTION_DELETED; |
66 | 66 | } |
67 | 67 | |
68 | - final public function wasRemoval (): bool { |
|
68 | + final public function wasRemoval(): bool { |
|
69 | 69 | return $this->getAction() === self::ACTION_REMOVED; |
70 | 70 | } |
71 | 71 | |
72 | - final public function wasUndeletion (): bool { |
|
72 | + final public function wasUndeletion(): bool { |
|
73 | 73 | return $this->getAction() === self::ACTION_UNDELETED; |
74 | 74 | } |
75 | 75 |
@@ -315,8 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | if ($isList) { |
317 | 317 | $this->data[$field] = array_map($hydrate, $value); |
318 | - } |
|
319 | - else { |
|
318 | + } else { |
|
320 | 319 | $this->data[$field] = $hydrate($value); |
321 | 320 | } |
322 | 321 | } |
@@ -387,11 +386,9 @@ discard block |
||
387 | 386 | return array_map($dehydrate = function($each) use (&$dehydrate) { |
388 | 387 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
389 | 388 | return $each->getGid(); |
390 | - } |
|
391 | - elseif ($each instanceof self) { |
|
389 | + } elseif ($each instanceof self) { |
|
392 | 390 | return $each->toArray(); |
393 | - } |
|
394 | - elseif (is_array($each)) { |
|
391 | + } elseif (is_array($each)) { |
|
395 | 392 | return array_map($dehydrate, $each); |
396 | 393 | } |
397 | 394 | return $each; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param Api|Data $caller |
59 | 59 | * @param array $data |
60 | 60 | */ |
61 | - public function __construct ($caller, array $data = []) { |
|
61 | + public function __construct($caller, array $data = []) { |
|
62 | 62 | $this->api = $caller instanceof self ? $caller->api : $caller; |
63 | 63 | $this->_setData($data); |
64 | 64 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param array $args |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function __call (string $method, array $args) { |
|
77 | + public function __call(string $method, array $args) { |
|
78 | 78 | static $cache = []; |
79 | - if (!$call =& $cache[$method]) { |
|
79 | + if (!$call = & $cache[$method]) { |
|
80 | 80 | preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call); |
81 | 81 | $call[1] = '_' . $call[1]; |
82 | 82 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return $this->{$call[1]}($call[2], ...$args); |
87 | 87 | } |
88 | 88 | |
89 | - public function __debugInfo (): array { |
|
89 | + public function __debugInfo(): array { |
|
90 | 90 | return $this->data; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param $field |
97 | 97 | * @return null|Data|mixed |
98 | 98 | */ |
99 | - final public function __get ($field) { |
|
99 | + final public function __get($field) { |
|
100 | 100 | return $this->_get($field); |
101 | 101 | } |
102 | 102 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param $field |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - final public function __isset ($field) { |
|
111 | + final public function __isset($field) { |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param array $data |
120 | 120 | * @return mixed|Data|AbstractEntity |
121 | 121 | */ |
122 | - final protected function _factory (string $class, array $data = []) { |
|
122 | + final protected function _factory(string $class, array $data = []) { |
|
123 | 123 | return $this->api->factory($class, $this, $data); |
124 | 124 | } |
125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param string $field |
132 | 132 | * @return mixed |
133 | 133 | */ |
134 | - protected function _get (string $field) { |
|
134 | + protected function _get(string $field) { |
|
135 | 135 | return $this->data[$field] ?? null; |
136 | 136 | } |
137 | 137 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $field |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | - protected function _has (string $field): bool { |
|
149 | + protected function _has(string $field): bool { |
|
150 | 150 | $value = $this->_get($field); |
151 | 151 | if (isset($value)) { |
152 | 152 | if (is_countable($value)) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param string $field |
170 | 170 | * @return bool |
171 | 171 | */ |
172 | - protected function _is (string $field): bool { |
|
172 | + protected function _is(string $field): bool { |
|
173 | 173 | return (bool)$this->_get($field); |
174 | 174 | } |
175 | 175 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param callable $filter `fn( Data $object ): bool` |
185 | 185 | * @return array |
186 | 186 | */ |
187 | - protected function _select ($subject, callable $filter) { |
|
187 | + protected function _select($subject, callable $filter) { |
|
188 | 188 | if (!is_iterable($subject)) { |
189 | 189 | $subject = $this->_get($subject) ?? []; |
190 | 190 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param mixed $value |
207 | 207 | * @return $this |
208 | 208 | */ |
209 | - protected function _set (string $field, $value) { |
|
209 | + protected function _set(string $field, $value) { |
|
210 | 210 | $this->data[$field] = $value; |
211 | 211 | $this->diff[$field] = true; |
212 | 212 | return $this; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param array $data |
219 | 219 | */ |
220 | - protected function _setData (array $data): void { |
|
220 | + protected function _setData(array $data): void { |
|
221 | 221 | $this->data = $this->diff = []; |
222 | 222 | foreach ($data as $field => $value) { |
223 | 223 | $this->_setMapped($field, $value); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param string $field |
231 | 231 | * @param mixed $value |
232 | 232 | */ |
233 | - protected function _setMapped (string $field, $value): void { |
|
233 | + protected function _setMapped(string $field, $value): void { |
|
234 | 234 | unset($this->diff[$field]); |
235 | 235 | |
236 | 236 | // use value as-is? |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return array |
284 | 284 | */ |
285 | - public function getDiff (): array { |
|
285 | + public function getDiff(): array { |
|
286 | 286 | $convert = function($each) use (&$convert) { |
287 | 287 | // convert existing entities to gids |
288 | 288 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @param string null $field |
309 | 309 | * @return bool |
310 | 310 | */ |
311 | - final public function isDiff (string $field = null): bool { |
|
311 | + final public function isDiff(string $field = null): bool { |
|
312 | 312 | if ($field) { |
313 | 313 | return isset($this->diff[$field]); |
314 | 314 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @see toArray() |
320 | 320 | * @return array |
321 | 321 | */ |
322 | - public function jsonSerialize (): array { |
|
322 | + public function jsonSerialize(): array { |
|
323 | 323 | $data = $this->toArray(); |
324 | 324 | ksort($data); |
325 | 325 | return $data; |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return string |
332 | 332 | */ |
333 | - public function serialize (): string { |
|
334 | - return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
333 | + public function serialize(): string { |
|
334 | + return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return array |
341 | 341 | */ |
342 | - public function toArray (): array { |
|
342 | + public function toArray(): array { |
|
343 | 343 | return array_map($dehydrate = function($each) use (&$dehydrate) { |
344 | 344 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
345 | 345 | return $each->getGid(); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @param $serialized |
361 | 361 | */ |
362 | - public function unserialize ($serialized): void { |
|
362 | + public function unserialize($serialized): void { |
|
363 | 363 | $this->api = Api::getDefault(); |
364 | 364 | $data = json_decode($serialized, true); |
365 | 365 | $this->_setData($data); |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | 'enum_options' => [EnumOption::class], |
41 | 41 | ]; |
42 | 42 | |
43 | - final public function __toString (): string { |
|
43 | + final public function __toString(): string { |
|
44 | 44 | return "custom_fields/{$this->getGid()}"; |
45 | 45 | } |
46 | 46 | |
47 | - final protected function _getDir (): string { |
|
47 | + final protected function _getDir(): string { |
|
48 | 48 | return 'custom_fields'; |
49 | 49 | } |
50 | 50 | |
51 | - protected function _setData (array $data): void { |
|
51 | + protected function _setData(array $data): void { |
|
52 | 52 | // deprecated for resource_subtype. also removing to conceptually separate from FieldValue |
53 | 53 | unset($data['type']); |
54 | 54 | parent::_setData($data); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param string $name |
63 | 63 | * @return EnumOption |
64 | 64 | */ |
65 | - public function addEnumOption (string $name) { |
|
65 | + public function addEnumOption(string $name) { |
|
66 | 66 | /** @var EnumOption $option */ |
67 | 67 | $option = $this->_factory(EnumOption::class); |
68 | 68 | $option->setName($name); |
@@ -78,35 +78,35 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public function hasNotificationsEnabled (): bool { |
|
81 | + public function hasNotificationsEnabled(): bool { |
|
82 | 82 | return $this->_is('has_notifications_enabled'); |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - final public function isEnum (): bool { |
|
88 | + final public function isEnum(): bool { |
|
89 | 89 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public function isGlobalToWorkspace (): bool { |
|
95 | + public function isGlobalToWorkspace(): bool { |
|
96 | 96 | return $this->_is('is_global_to_workspace'); |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @return bool |
101 | 101 | */ |
102 | - final public function isNumber (): bool { |
|
102 | + final public function isNumber(): bool { |
|
103 | 103 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - final public function isText (): bool { |
|
109 | + final public function isText(): bool { |
|
110 | 110 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
111 | 111 | } |
112 | 112 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param bool $flag |
115 | 115 | * @return $this |
116 | 116 | */ |
117 | - public function setGlobalToWorkspace (bool $flag) { |
|
117 | + public function setGlobalToWorkspace(bool $flag) { |
|
118 | 118 | return $this->_set('is_global_to_workspace', $flag); |
119 | 119 | } |
120 | 120 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param bool $flag |
123 | 123 | * @return $this |
124 | 124 | */ |
125 | - public function setNotificationsEnabled (bool $flag) { |
|
125 | + public function setNotificationsEnabled(bool $flag) { |
|
126 | 126 | return $this->_set('has_notifications_enabled', $flag); |
127 | 127 | } |
128 | 128 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
131 | 131 | * @return $this |
132 | 132 | */ |
133 | - public function sortEnumOptions (callable $cmp) { |
|
133 | + public function sortEnumOptions(callable $cmp) { |
|
134 | 134 | if ($options = $this->getEnumOptions()) { |
135 | 135 | $prev = $options[0]; // first option on remote |
136 | 136 | usort($options, $cmp); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @return string |
25 | 25 | */ |
26 | - public function getCurrentOptionName () { |
|
26 | + public function getCurrentOptionName() { |
|
27 | 27 | return $this->getEnumOptionNames()[$this->getValue()]; |
28 | 28 | } |
29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return string[] |
34 | 34 | */ |
35 | - public function getEnumOptionNames () { |
|
35 | + public function getEnumOptionNames() { |
|
36 | 36 | static $names = []; // shared |
37 | 37 | $gid = $this->data['gid']; |
38 | 38 | return $names[$gid] ?? $names[$gid] = array_column($this->data['enum_options'], 'name', 'gid'); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return string[] |
45 | 45 | */ |
46 | - public function getEnumOptionValues () { |
|
46 | + public function getEnumOptionValues() { |
|
47 | 47 | static $values = []; // shared |
48 | 48 | $gid = $this->data['gid']; |
49 | 49 | return $values[$gid] ?? $values[$gid] = array_column($this->data['enum_options'], 'gid', 'name'); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @return null|number|string |
54 | 54 | */ |
55 | - public function getValue () { |
|
55 | + public function getValue() { |
|
56 | 56 | $type = $this->data['type']; |
57 | 57 | if ($type === CustomField::TYPE_ENUM) { |
58 | 58 | return $this->data['enum_value']['gid'] ?? null; |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | return $this->data["{$type}_value"]; |
61 | 61 | } |
62 | 62 | |
63 | - final public function isEnum (): bool { |
|
63 | + final public function isEnum(): bool { |
|
64 | 64 | return $this->getType() === CustomField::TYPE_ENUM; |
65 | 65 | } |
66 | 66 | |
67 | - final public function isNumber (): bool { |
|
67 | + final public function isNumber(): bool { |
|
68 | 68 | return $this->getType() === CustomField::TYPE_NUMBER; |
69 | 69 | } |
70 | 70 | |
71 | - final public function isText (): bool { |
|
71 | + final public function isText(): bool { |
|
72 | 72 | return $this->getType() === CustomField::TYPE_TEXT; |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param null|number|string $value |
77 | 77 | * @return $this |
78 | 78 | */ |
79 | - public function setValue ($value) { |
|
79 | + public function setValue($value) { |
|
80 | 80 | $type = $this->data['type']; |
81 | 81 | $this->diff["{$type}_value"] = true; |
82 | 82 | if ($type === CustomField::TYPE_ENUM) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return array |
94 | 94 | */ |
95 | - public function toArray (): array { |
|
95 | + public function toArray(): array { |
|
96 | 96 | // only strip if needed. |
97 | 97 | if (!isset($this->data['resource_subtype'])) { |
98 | 98 | return $this->data; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected $types = []; |
41 | 41 | |
42 | - public function __construct (Task $task, array $data = []) { |
|
42 | + public function __construct(Task $task, array $data = []) { |
|
43 | 43 | $this->task = $task; |
44 | 44 | parent::__construct($task, $data); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @param array[] $values |
49 | 49 | */ |
50 | - protected function _setData (array $values): void { |
|
50 | + protected function _setData(array $values): void { |
|
51 | 51 | // ensure data is keyed by field gid |
52 | 52 | $values = array_combine(array_column($values, 'gid'), $values); |
53 | 53 | parent::_setData($values); |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * @return int |
58 | 58 | */ |
59 | - public function count () { |
|
59 | + public function count() { |
|
60 | 60 | return count($this->data); |
61 | 61 | } |
62 | 62 | |
63 | - public function getDiff (): array { |
|
63 | + public function getDiff(): array { |
|
64 | 64 | return array_map(function(FieldEntry $value) { |
65 | 65 | return $value->getValue(); |
66 | 66 | }, array_intersect_key($this->data, $this->diff)); |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * @param $fieldGid |
71 | 71 | * @return FieldEntry |
72 | 72 | */ |
73 | - public function getField ($fieldGid) { |
|
73 | + public function getField($fieldGid) { |
|
74 | 74 | return $this->data[$fieldGid]; |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @return Generator |
79 | 79 | */ |
80 | - public function getIterator () { |
|
80 | + public function getIterator() { |
|
81 | 81 | foreach ($this->data as $gid => $field) { |
82 | 82 | yield $gid => $field->getValue(); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $fieldGid |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function offsetExists ($fieldGid) { |
|
90 | + public function offsetExists($fieldGid) { |
|
91 | 91 | return array_key_exists($fieldGid, $this->data); |
92 | 92 | } |
93 | 93 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $fieldGid |
96 | 96 | * @return null|number|string |
97 | 97 | */ |
98 | - public function offsetGet ($fieldGid) { |
|
98 | + public function offsetGet($fieldGid) { |
|
99 | 99 | return $this->data[$fieldGid]->getValue(); |
100 | 100 | } |
101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $fieldGid |
104 | 104 | * @param null|number|string $value |
105 | 105 | */ |
106 | - public function offsetSet ($fieldGid, $value) { |
|
106 | + public function offsetSet($fieldGid, $value) { |
|
107 | 107 | $this->data[$fieldGid]->setValue($value); |
108 | 108 | $this->diff[$fieldGid] = true; |
109 | 109 | $this->task->diff['custom_fields'] = true; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param string $fieldGid |
116 | 116 | */ |
117 | - public function offsetUnset ($fieldGid) { |
|
117 | + public function offsetUnset($fieldGid) { |
|
118 | 118 | $this->offsetSet($fieldGid, null); |
119 | 119 | } |
120 | 120 |