@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - abstract public function __toString (): string; |
|
25 | + abstract public function __toString(): string; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Maps lazy-loaded / reloadable mapped {@see Data} to their proper expanded field expression. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param AbstractEntity $entity |
43 | 43 | * @internal |
44 | 44 | */ |
45 | - public function __set (string $from, self $entity) { |
|
45 | + public function __set(string $from, self $entity) { |
|
46 | 46 | if ($from === Cache::class and $entity !== $this) { |
47 | 47 | foreach ($entity->data as $field => $value) { |
48 | 48 | if (!isset($this->diff[$field])) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return $this |
61 | 61 | * @internal |
62 | 62 | */ |
63 | - protected function _addWithPost (string $addPath, array $data, string $field, array $diff) { |
|
63 | + protected function _addWithPost(string $addPath, array $data, string $field, array $diff) { |
|
64 | 64 | if ($this->hasGid()) { |
65 | 65 | return $this->_setWithPost($addPath, $data, $field); |
66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @internal |
74 | 74 | */ |
75 | - protected function _cache (): void { |
|
75 | + protected function _cache(): void { |
|
76 | 76 | $this->api->getCache()->add($this); |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @internal |
83 | 83 | */ |
84 | - protected function _delete (): void { |
|
84 | + protected function _delete(): void { |
|
85 | 85 | $this->api->delete($this); |
86 | 86 | $this->api->getCache()->remove($this); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param string $field |
93 | 93 | * @return mixed |
94 | 94 | */ |
95 | - protected function _get (string $field) { |
|
95 | + protected function _get(string $field) { |
|
96 | 96 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
97 | 97 | $this->reload($field); |
98 | 98 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return $this |
108 | 108 | * @internal |
109 | 109 | */ |
110 | - protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
|
110 | + protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) { |
|
111 | 111 | if ($this->hasGid()) { |
112 | 112 | return $this->_setWithPost($rmPath, $data, $field); |
113 | 113 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return $this |
125 | 125 | * @internal |
126 | 126 | */ |
127 | - protected function _save (string $dir = null) { |
|
127 | + protected function _save(string $dir = null) { |
|
128 | 128 | if (isset($dir)) { |
129 | 129 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
130 | 130 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
143 | - protected function _setData (array $data): void { |
|
143 | + protected function _setData(array $data): void { |
|
144 | 144 | // make sure gid is consistently null|string across all entities. |
145 | 145 | $data['gid'] = empty($data['gid']) ? null : (string)$data['gid']; |
146 | 146 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return $this |
161 | 161 | * @internal |
162 | 162 | */ |
163 | - protected function _setWithPost (string $path, array $data, string $field, $value = null) { |
|
163 | + protected function _setWithPost(string $path, array $data, string $field, $value = null) { |
|
164 | 164 | if ($this->hasGid()) { |
165 | 165 | /** @var array $remote */ |
166 | 166 | $remote = $this->api->post($path, $data, ['fields' => static::$optFields[$field] ?? $field]); |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string[] |
180 | 180 | */ |
181 | - public function getCacheKeys () { |
|
181 | + public function getCacheKeys() { |
|
182 | 182 | return [$this->getGid(), (string)$this]; |
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
186 | 186 | * @return null|string |
187 | 187 | */ |
188 | - final public function getGid (): ?string { |
|
188 | + final public function getGid(): ?string { |
|
189 | 189 | return $this->data['gid']; |
190 | 190 | } |
191 | 191 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return string |
196 | 196 | */ |
197 | - final public function getResourceType (): string { |
|
197 | + final public function getResourceType(): string { |
|
198 | 198 | return $this::TYPE; |
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | 202 | * @return bool |
203 | 203 | */ |
204 | - final public function hasGid (): bool { |
|
204 | + final public function hasGid(): bool { |
|
205 | 205 | return isset($this->data['gid']); |
206 | 206 | } |
207 | 207 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param string $field |
213 | 213 | * @return $this |
214 | 214 | */ |
215 | - public function reload (string $field = null) { |
|
215 | + public function reload(string $field = null) { |
|
216 | 216 | if (!$this->hasGid()) { |
217 | 217 | throw new LogicException(static::class . " has no GID, it can't be reloaded."); |
218 | 218 | } |
@@ -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 |
@@ -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 |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | */ |
31 | 31 | private $logger; |
32 | 32 | |
33 | - public function __construct (string $dir) { |
|
33 | + public function __construct(string $dir) { |
|
34 | 34 | $this->dir = $dir; |
35 | 35 | } |
36 | 36 | |
37 | - private function _path ($key) { |
|
37 | + private function _path($key) { |
|
38 | 38 | $file = "{$this->dir}/{$key}~"; |
39 | 39 | clearstatcache(true, $file); |
40 | 40 | return $file; |
41 | 41 | } |
42 | 42 | |
43 | - public function clear () { |
|
43 | + public function clear() { |
|
44 | 44 | // unused. just delete the dir. |
45 | 45 | } |
46 | 46 | |
47 | - public function delete ($key) { |
|
47 | + public function delete($key) { |
|
48 | 48 | $path = $this->_path($key); |
49 | 49 | if (file_exists($path)) { |
50 | 50 | $this->log('CACHE DELETE', $key); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - public function deleteMultiple ($keys) { |
|
55 | + public function deleteMultiple($keys) { |
|
56 | 56 | // unused |
57 | 57 | } |
58 | 58 | |
59 | - public function get ($key, $default = null) { |
|
59 | + public function get($key, $default = null) { |
|
60 | 60 | $path = $this->_path($key); |
61 | 61 | if (file_exists($path)) { |
62 | 62 | if (filemtime($path) > time()) { |
@@ -75,32 +75,32 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @return LoggerInterface |
77 | 77 | */ |
78 | - public function getLogger () { |
|
78 | + public function getLogger() { |
|
79 | 79 | return $this->logger; |
80 | 80 | } |
81 | 81 | |
82 | - public function getMultiple ($keys, $default = null) { |
|
82 | + public function getMultiple($keys, $default = null) { |
|
83 | 83 | // unused |
84 | 84 | } |
85 | 85 | |
86 | - public function has ($key) { |
|
86 | + public function has($key) { |
|
87 | 87 | // unused |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @return bool |
92 | 92 | */ |
93 | - public function isGzEncoding (): bool { |
|
93 | + public function isGzEncoding(): bool { |
|
94 | 94 | return $this->gzEncoding; |
95 | 95 | } |
96 | 96 | |
97 | - private function log (string $msg, string $key): void { |
|
97 | + private function log(string $msg, string $key): void { |
|
98 | 98 | if ($this->logger) { |
99 | 99 | $this->logger->log($msg, $key); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - public function set ($key, $value, $ttl = null) { |
|
103 | + public function set($key, $value, $ttl = null) { |
|
104 | 104 | assert($ttl instanceof DateInterval); |
105 | 105 | $this->log('CACHE SET', $key); |
106 | 106 | $path = $this->_path($key); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param bool $gzEncoding |
125 | 125 | * @return $this |
126 | 126 | */ |
127 | - public function setGzEncoding (bool $gzEncoding) { |
|
127 | + public function setGzEncoding(bool $gzEncoding) { |
|
128 | 128 | $this->gzEncoding = $gzEncoding; |
129 | 129 | return $this; |
130 | 130 | } |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | * @param null|LoggerInterface $logger |
134 | 134 | * @return $this |
135 | 135 | */ |
136 | - public function setLogger (?LoggerInterface $logger) { |
|
136 | + public function setLogger(?LoggerInterface $logger) { |
|
137 | 137 | $this->logger = $logger; |
138 | 138 | return $this; |
139 | 139 | } |
140 | 140 | |
141 | - public function setMultiple ($values, $ttl = null) { |
|
141 | + public function setMultiple($values, $ttl = null) { |
|
142 | 142 | // unused |
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | 'workspace' => Workspace::class |
31 | 31 | ]; |
32 | 32 | |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "user_task_lists/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
37 | - public function getCacheKeys () { |
|
37 | + public function getCacheKeys() { |
|
38 | 38 | $keys = parent::getCacheKeys(); |
39 | 39 | |
40 | 40 | /** @see User::getTaskList() */ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param array $filter |
48 | 48 | * @return Traversable|Task[] |
49 | 49 | */ |
50 | - public function getIterator (array $filter = []) { |
|
50 | + public function getIterator(array $filter = []) { |
|
51 | 51 | return $this->api->loadEach($this, Task::class, "{$this}/tasks"); |
52 | 52 | } |
53 | 53 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param array $filter |
60 | 60 | * @return Task[] |
61 | 61 | */ |
62 | - public function getTasks (array $filter = []) { |
|
62 | + public function getTasks(array $filter = []) { |
|
63 | 63 | return iterator_to_array($this->getIterator($filter)); |
64 | 64 | } |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $apiFilter Given to the API to reduce network load. |
69 | 69 | * @return Task[] |
70 | 70 | */ |
71 | - public function selectTasks (callable $filter, array $apiFilter) { |
|
71 | + public function selectTasks(callable $filter, array $apiFilter) { |
|
72 | 72 | return $this->_select($this->getIterator($apiFilter), $filter); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'workspaces' => [Workspace::class] |
29 | 29 | ]; |
30 | 30 | |
31 | - final public function __toString (): string { |
|
31 | + final public function __toString(): string { |
|
32 | 32 | return "users/{$this->getGid()}"; |
33 | 33 | } |
34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param Workspace $workspace |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - public function addToWorkspace (Workspace $workspace) { |
|
39 | + public function addToWorkspace(Workspace $workspace) { |
|
40 | 40 | return $this->_addWithPost("{$workspace}/addUser", [ |
41 | 41 | 'user' => $this->getGid() |
42 | 42 | ], 'workspaces', [$workspace]); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @return string[] |
47 | 47 | */ |
48 | - public function getCacheKeys () { |
|
48 | + public function getCacheKeys() { |
|
49 | 49 | $keys = parent::getCacheKeys(); |
50 | 50 | |
51 | 51 | // only include email as a key if it's loaded |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return Workspace |
64 | 64 | */ |
65 | - public function getDefaultWorkspace () { |
|
65 | + public function getDefaultWorkspace() { |
|
66 | 66 | return $this->getWorkspaces()[0]; |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param null|Workspace $workspace Falls back to the default workspace. |
71 | 71 | * @return Portfolio[] |
72 | 72 | */ |
73 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
73 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
74 | 74 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param null|Workspace $workspace Falls back to the default workspace. |
79 | 79 | * @return Project[] |
80 | 80 | */ |
81 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
81 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
82 | 82 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param null|Workspace $workspace Falls back to the default workspace. |
87 | 87 | * @return Tag[] |
88 | 88 | */ |
89 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
89 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
90 | 90 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param null|Workspace $workspace Falls back to the default workspace. |
95 | 95 | * @return Team[] |
96 | 96 | */ |
97 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
97 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
98 | 98 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param null|Workspace $workspace Falls back to the default workspace. |
103 | 103 | * @return User[] |
104 | 104 | */ |
105 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
105 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
106 | 106 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
107 | 107 | } |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param null|Workspace $workspace Falls back to the default workspace. |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
115 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
116 | 116 | return $this->api->loadAll($this, $class, "{$this}/favorites", [ |
117 | 117 | 'resource_type' => $resourceType, |
118 | 118 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param null|Workspace $workspace |
124 | 124 | * @return Portfolio[] |
125 | 125 | */ |
126 | - public function getPortfolios (Workspace $workspace = null) { |
|
126 | + public function getPortfolios(Workspace $workspace = null) { |
|
127 | 127 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
128 | 128 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid(), |
129 | 129 | 'owner' => $this->getGid() |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param null|Workspace $workspace Falls back to the default workspace. |
135 | 135 | * @return TaskList |
136 | 136 | */ |
137 | - public function getTaskList (Workspace $workspace = null) { |
|
137 | + public function getTaskList(Workspace $workspace = null) { |
|
138 | 138 | return $this->api->load($this, TaskList::class, "{$this}/user_task_list", [ |
139 | 139 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
140 | 140 | ]); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string[] $filter `workspace` falls back to the default. |
147 | 147 | * @return Task[] |
148 | 148 | */ |
149 | - public function getTasks (array $filter = []) { |
|
149 | + public function getTasks(array $filter = []) { |
|
150 | 150 | $filter['assignee'] = $this->getGid(); |
151 | 151 | $filter += ['workspace' => $this->getDefaultWorkspace()->getGid()]; |
152 | 152 | return $this->api->loadAll($this, Task::class, 'tasks', $filter); |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | * @param null|Workspace $organization Falls back to the default workspace. |
161 | 161 | * @return Team[] |
162 | 162 | */ |
163 | - public function getTeams (Workspace $organization = null) { |
|
163 | + public function getTeams(Workspace $organization = null) { |
|
164 | 164 | return $this->api->loadAll($this, Team::class, "{$this}/teams", [ |
165 | 165 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
166 | 166 | ]); |
167 | 167 | } |
168 | 168 | |
169 | - public function getUrl (): string { |
|
169 | + public function getUrl(): string { |
|
170 | 170 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param Workspace $workspace |
175 | 175 | * @return $this |
176 | 176 | */ |
177 | - public function removeFromWorkspace (Workspace $workspace) { |
|
177 | + public function removeFromWorkspace(Workspace $workspace) { |
|
178 | 178 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
179 | 179 | 'user' => $this->getGid() |
180 | 180 | ], 'workspaces', [$workspace]); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'workspace' => Workspace::class |
53 | 53 | ]; |
54 | 54 | |
55 | - final public function __toString (): string { |
|
55 | + final public function __toString(): string { |
|
56 | 56 | return "portfolios/{$this->getGid()}"; |
57 | 57 | } |
58 | 58 | |
59 | - final protected function _getDir (): string { |
|
59 | + final protected function _getDir(): string { |
|
60 | 60 | return 'portfolios'; |
61 | 61 | } |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param Project $item |
66 | 66 | * @return $this |
67 | 67 | */ |
68 | - public function addItem (Project $item) { |
|
68 | + public function addItem(Project $item) { |
|
69 | 69 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
70 | 70 | return $this; |
71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param User $user |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function addMember (User $user) { |
|
77 | + public function addMember(User $user) { |
|
78 | 78 | return $this->addMembers([$user]); |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param User[] $users |
83 | 83 | * @return $this |
84 | 84 | */ |
85 | - public function addMembers (array $users) { |
|
85 | + public function addMembers(array $users) { |
|
86 | 86 | return $this->_addWithPost("{$this}/addMembers", [ |
87 | 87 | 'members' => array_column($users, 'gid') |
88 | 88 | ], 'members', $users); |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | * @depends after-create |
93 | 93 | * @return Project[] |
94 | 94 | */ |
95 | - public function getItems () { |
|
95 | + public function getItems() { |
|
96 | 96 | return iterator_to_array($this); |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @return Traversable|Project[] |
101 | 101 | */ |
102 | - public function getIterator () { |
|
102 | + public function getIterator() { |
|
103 | 103 | return $this->api->loadEach($this, Project::class, "{$this}/items"); |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param Project $item |
109 | 109 | * @return $this |
110 | 110 | */ |
111 | - public function removeItem (Project $item) { |
|
111 | + public function removeItem(Project $item) { |
|
112 | 112 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
113 | 113 | return $this; |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param User $user |
118 | 118 | * @return $this |
119 | 119 | */ |
120 | - public function removeMember (User $user) { |
|
120 | + public function removeMember(User $user) { |
|
121 | 121 | return $this->removeMembers([$user]); |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param User[] $users |
126 | 126 | * @return $this |
127 | 127 | */ |
128 | - public function removeMembers (array $users) { |
|
128 | + public function removeMembers(array $users) { |
|
129 | 129 | return $this->_removeWithPost("{$this}/removeMembers", [ |
130 | 130 | 'members' => array_column($users, 'gid') |
131 | 131 | ], 'members', $users); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param callable $filter `fn( Project $project ): bool` |
136 | 136 | * @return Project[] |
137 | 137 | */ |
138 | - public function selectItems (callable $filter) { |
|
138 | + public function selectItems(callable $filter) { |
|
139 | 139 | return $this->_select($this, $filter); |
140 | 140 | } |
141 | 141 | } |
142 | 142 | \ No newline at end of file |