@@ -40,11 +40,11 @@ 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 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $name |
53 | 53 | * @return EnumOption |
54 | 54 | */ |
55 | - public function addEnumOption (string $name) { |
|
55 | + public function addEnumOption(string $name) { |
|
56 | 56 | /** @var EnumOption $option */ |
57 | 57 | $option = $this->factory(EnumOption::class); |
58 | 58 | $option->setName($name); |
@@ -69,28 +69,28 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @return bool |
71 | 71 | */ |
72 | - public function hasNotificationsEnabled (): bool { |
|
72 | + public function hasNotificationsEnabled(): bool { |
|
73 | 73 | return $this->_is('has_notifications_enabled'); |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * @return bool |
78 | 78 | */ |
79 | - public function isEnum (): bool { |
|
79 | + public function isEnum(): bool { |
|
80 | 80 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @return bool |
85 | 85 | */ |
86 | - public function isGlobalToWorkspace (): bool { |
|
86 | + public function isGlobalToWorkspace(): bool { |
|
87 | 87 | return $this->_is('is_global_to_workspace'); |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @return bool |
92 | 92 | */ |
93 | - final public function isText (): bool { |
|
93 | + final public function isText(): bool { |
|
94 | 94 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
95 | 95 | } |
96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param bool $flag |
99 | 99 | * @return $this |
100 | 100 | */ |
101 | - public function setGlobalToWorkspace (bool $flag) { |
|
101 | + public function setGlobalToWorkspace(bool $flag) { |
|
102 | 102 | return $this->_set('is_global_to_workspace', $flag); |
103 | 103 | } |
104 | 104 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param bool $flag |
107 | 107 | * @return $this |
108 | 108 | */ |
109 | - public function setNotificationsEnabled (bool $flag) { |
|
109 | + public function setNotificationsEnabled(bool $flag) { |
|
110 | 110 | return $this->_set('has_notifications_enabled', $flag); |
111 | 111 | } |
112 | 112 |
@@ -52,23 +52,23 @@ |
||
52 | 52 | * @param Project $project |
53 | 53 | * @param array $data |
54 | 54 | */ |
55 | - public function __construct (Project $project, array $data = []) { |
|
55 | + public function __construct(Project $project, array $data = []) { |
|
56 | 56 | parent::__construct($project, $data); |
57 | 57 | $this->project = $project; |
58 | 58 | } |
59 | 59 | |
60 | - final public function __toString (): string { |
|
60 | + final public function __toString(): string { |
|
61 | 61 | return "project_statuses/{$this->getGid()}"; |
62 | 62 | } |
63 | 63 | |
64 | - final protected function _getDir (): string { |
|
64 | + final protected function _getDir(): string { |
|
65 | 65 | return "{$this->project}/project_statuses"; |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @return Project |
70 | 70 | */ |
71 | - public function getProject () { |
|
71 | + public function getProject() { |
|
72 | 72 | return $this->project; |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | 'project' => Project::class |
29 | 29 | ]; |
30 | 30 | |
31 | - final public function __toString (): string { |
|
31 | + final public function __toString(): string { |
|
32 | 32 | return "sections/{$this->getGid()}"; |
33 | 33 | } |
34 | 34 | |
35 | - final protected function _getDir (): string { |
|
35 | + final protected function _getDir(): string { |
|
36 | 36 | return "{$this->getProject()}/sections"; |
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @return Task[] |
41 | 41 | */ |
42 | - public function getTasks () { |
|
42 | + public function getTasks() { |
|
43 | 43 | return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]); |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @depends after-create |
50 | 50 | * @return Task |
51 | 51 | */ |
52 | - public function newTask () { |
|
52 | + public function newTask() { |
|
53 | 53 | /** @var Task $task */ |
54 | 54 | $task = $this->factory(Task::class); |
55 | 55 | return $task->addToProject($this); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | 'workspace' => Workspace::class |
40 | 40 | ]; |
41 | 41 | |
42 | - final public function __toString (): string { |
|
42 | + final public function __toString(): string { |
|
43 | 43 | return "portfolios/{$this->getGid()}"; |
44 | 44 | } |
45 | 45 | |
46 | - final protected function _getDir (): string { |
|
46 | + final protected function _getDir(): string { |
|
47 | 47 | return 'portfolios'; |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param Project $item |
53 | 53 | * @return $this |
54 | 54 | */ |
55 | - public function addItem (Project $item) { |
|
55 | + public function addItem(Project $item) { |
|
56 | 56 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
57 | 57 | return $this; |
58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param User $user |
62 | 62 | * @return $this |
63 | 63 | */ |
64 | - public function addMember (User $user) { |
|
64 | + public function addMember(User $user) { |
|
65 | 65 | return $this->addMembers([$user]); |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param User[] $users |
70 | 70 | * @return $this |
71 | 71 | */ |
72 | - public function addMembers (array $users) { |
|
72 | + public function addMembers(array $users) { |
|
73 | 73 | if ($this->hasGid()) { |
74 | 74 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
75 | 75 | $this->_merge('members', $users); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @depends after-create |
85 | 85 | * @return Project[] |
86 | 86 | */ |
87 | - public function getItems () { |
|
87 | + public function getItems() { |
|
88 | 88 | return $this->loadAll(Project::class, "{$this}/items"); |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param Project $item |
94 | 94 | * @return $this |
95 | 95 | */ |
96 | - public function removeItem (Project $item) { |
|
96 | + public function removeItem(Project $item) { |
|
97 | 97 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
98 | 98 | return $this; |
99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param User $user |
103 | 103 | * @return $this |
104 | 104 | */ |
105 | - public function removeMember (User $user) { |
|
105 | + public function removeMember(User $user) { |
|
106 | 106 | return $this->removeMembers([$user]); |
107 | 107 | } |
108 | 108 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param User[] $users |
111 | 111 | * @return $this |
112 | 112 | */ |
113 | - public function removeMembers (array $users) { |
|
113 | + public function removeMembers(array $users) { |
|
114 | 114 | if ($this->hasGid()) { |
115 | 115 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
116 | 116 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Api|Data $caller |
41 | 41 | * @param array $data |
42 | 42 | */ |
43 | - public function __construct ($caller, array $data = []) { |
|
43 | + public function __construct($caller, array $data = []) { |
|
44 | 44 | $this->api = $caller instanceof self ? $caller->api : $caller; |
45 | 45 | $this->_setData($data); |
46 | 46 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param array $args |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - public function __call (string $method, array $args) { |
|
59 | + public function __call(string $method, array $args) { |
|
60 | 60 | static $cache = []; |
61 | - if (!$call =& $cache[$method]) { |
|
61 | + if (!$call = & $cache[$method]) { |
|
62 | 62 | preg_match('/^(get|has|is|set)(.+)$/', $method, $call); |
63 | 63 | $call[1] = '_' . $call[1]; |
64 | 64 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return $this->{$call[1]}($call[2], ...$args); |
69 | 69 | } |
70 | 70 | |
71 | - public function __debugInfo (): array { |
|
71 | + public function __debugInfo(): array { |
|
72 | 72 | return $this->data; |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param $key |
79 | 79 | * @return null|Data|mixed |
80 | 80 | */ |
81 | - final public function __get ($key) { |
|
81 | + final public function __get($key) { |
|
82 | 82 | return $this->_get($key); |
83 | 83 | } |
84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param $key |
91 | 91 | * @return bool |
92 | 92 | */ |
93 | - final public function __isset ($key) { |
|
93 | + final public function __isset($key) { |
|
94 | 94 | return true; |
95 | 95 | } |
96 | 96 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param string $key |
103 | 103 | * @return mixed |
104 | 104 | */ |
105 | - protected function _get (string $key) { |
|
105 | + protected function _get(string $key) { |
|
106 | 106 | return $this->data[$key] ?? null; |
107 | 107 | } |
108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $key |
117 | 117 | * @return bool |
118 | 118 | */ |
119 | - protected function _has (string $key): bool { |
|
119 | + protected function _has(string $key): bool { |
|
120 | 120 | $value = $this->_get($key); |
121 | 121 | if (isset($value)) { |
122 | 122 | if (is_countable($value)) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param string $key |
140 | 140 | * @return bool |
141 | 141 | */ |
142 | - protected function _is (string $key): bool { |
|
142 | + protected function _is(string $key): bool { |
|
143 | 143 | return !empty($this->_get($key)); |
144 | 144 | } |
145 | 145 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param mixed $value |
153 | 153 | * @return $this |
154 | 154 | */ |
155 | - protected function _set (string $key, $value) { |
|
155 | + protected function _set(string $key, $value) { |
|
156 | 156 | $this->data[$key] = $value; |
157 | 157 | $this->diff[$key] = true; |
158 | 158 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @param array $data |
165 | 165 | */ |
166 | - protected function _setData (array $data): void { |
|
166 | + protected function _setData(array $data): void { |
|
167 | 167 | $this->data = $this->diff = []; |
168 | 168 | foreach ($data as $key => $value) { |
169 | 169 | $this->_setMapped($key, $value); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param string $key |
177 | 177 | * @param null|Data|array $value |
178 | 178 | */ |
179 | - protected function _setMapped (string $key, $value): void { |
|
179 | + protected function _setMapped(string $key, $value): void { |
|
180 | 180 | unset($this->diff[$key]); |
181 | 181 | |
182 | 182 | // use unmapped values, null, [], Data, and Data[] as-is |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param array $data |
217 | 217 | * @return mixed |
218 | 218 | */ |
219 | - final protected function factory (string $class, array $data = []) { |
|
219 | + final protected function factory(string $class, array $data = []) { |
|
220 | 220 | return $this->api->factory($class, $this, $data); |
221 | 221 | } |
222 | 222 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return array |
227 | 227 | */ |
228 | - public function getDiff (): array { |
|
228 | + public function getDiff(): array { |
|
229 | 229 | $convert = function($each) use (&$convert) { |
230 | 230 | // convert existing entities to gids |
231 | 231 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return bool |
252 | 252 | */ |
253 | - final public function isDiff (): bool { |
|
253 | + final public function isDiff(): bool { |
|
254 | 254 | return (bool)$this->diff; |
255 | 255 | } |
256 | 256 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @see toArray() |
259 | 259 | * @return array |
260 | 260 | */ |
261 | - public function jsonSerialize (): array { |
|
261 | + public function jsonSerialize(): array { |
|
262 | 262 | return $this->toArray(); |
263 | 263 | } |
264 | 264 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param array $query |
273 | 273 | * @return null|mixed|AbstractEntity |
274 | 274 | */ |
275 | - final protected function load (string $class, string $path, array $query = []) { |
|
275 | + final protected function load(string $class, string $path, array $query = []) { |
|
276 | 276 | return $this->api->load($class, $this, $path, $query); |
277 | 277 | } |
278 | 278 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param int $pages |
288 | 288 | * @return array|AbstractEntity[] |
289 | 289 | */ |
290 | - final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) { |
|
290 | + final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) { |
|
291 | 291 | return $this->api->loadAll($class, $this, $path, $query, $pages); |
292 | 292 | } |
293 | 293 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return string |
298 | 298 | */ |
299 | - public function serialize (): string { |
|
299 | + public function serialize(): string { |
|
300 | 300 | return serialize($this->toArray()); |
301 | 301 | } |
302 | 302 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @return array |
307 | 307 | */ |
308 | - public function toArray (): array { |
|
308 | + public function toArray(): array { |
|
309 | 309 | if (!$this->api) { |
310 | 310 | return $this->data; |
311 | 311 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @param $serialized |
331 | 331 | */ |
332 | - public function unserialize ($serialized): void { |
|
332 | + public function unserialize($serialized): void { |
|
333 | 333 | $this->api = Api::getDefault(); |
334 | 334 | $this->data = unserialize($serialized); |
335 | 335 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - abstract public function __toString (): string; |
|
19 | + abstract public function __toString(): string; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Maps lazy-loaded / reloadable fields to their proper expanded field expression. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param AbstractEntity[] $entities |
34 | 34 | * @return string[] |
35 | 35 | */ |
36 | - protected static function _getGids (array $entities) { |
|
36 | + protected static function _getGids(array $entities) { |
|
37 | 37 | return array_map(function(AbstractEntity $entity) { |
38 | 38 | return $entity->getGid(); |
39 | 39 | }, $entities); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $key |
46 | 46 | * @return mixed |
47 | 47 | */ |
48 | - protected function _get (string $key) { |
|
48 | + protected function _get(string $key) { |
|
49 | 49 | if (!array_key_exists($key, $this->data) and isset($this->data['gid'])) { // can't use hasGid(), inf. loop |
50 | 50 | $this->reload($key); |
51 | 51 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param bool $force |
61 | 61 | * @return $this |
62 | 62 | */ |
63 | - protected function _merge (string $key, array $entities, $force = false) { |
|
63 | + protected function _merge(string $key, array $entities, $force = false) { |
|
64 | 64 | if ($force or isset($this->data[$key])) { |
65 | 65 | foreach ($entities as $entity) { |
66 | 66 | $this->data[$key][] = $entity; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param AbstractEntity[] $entities |
84 | 84 | * @return $this |
85 | 85 | */ |
86 | - protected function _remove (string $key, array $entities) { |
|
86 | + protected function _remove(string $key, array $entities) { |
|
87 | 87 | if (isset($this->data[$key])) { |
88 | 88 | $this->data[$key] = array_values(array_diff($this->data[$key], $entities)); |
89 | 89 | $this->api->getCache()->add($this); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param AbstractEntity $entity |
98 | 98 | * @return $this |
99 | 99 | */ |
100 | - public function merge (AbstractEntity $entity) { |
|
100 | + public function merge(AbstractEntity $entity) { |
|
101 | 101 | assert($entity->api); // hydrated |
102 | 102 | foreach ($entity->data as $key => $value) { |
103 | 103 | if (!array_key_exists($key, $this->data) and !isset($entity->diff[$key])) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string $key |
114 | 114 | * @return $this |
115 | 115 | */ |
116 | - public function reload (string $key = null) { |
|
116 | + public function reload(string $key = null) { |
|
117 | 117 | if (isset($key)) { |
118 | 118 | $value = $this->api->get($this, [], ['fields' => static::$optFields[$key] ?? $key])[$key] ?? null; |
119 | 119 | $this->_setMapped($key, $value); |
@@ -45,23 +45,23 @@ discard block |
||
45 | 45 | 'task' => Task::class |
46 | 46 | ]; |
47 | 47 | |
48 | - final public function __toString (): string { |
|
48 | + final public function __toString(): string { |
|
49 | 49 | return "stories/{$this->getGid()}"; |
50 | 50 | } |
51 | 51 | |
52 | - final protected function _getDir (): string { |
|
52 | + final protected function _getDir(): string { |
|
53 | 53 | return "{$this->getTask()}/stories"; |
54 | 54 | } |
55 | 55 | |
56 | - final public function isComment (): bool { |
|
56 | + final public function isComment(): bool { |
|
57 | 57 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
58 | 58 | } |
59 | 59 | |
60 | - public function isEdited (): bool { |
|
60 | + public function isEdited(): bool { |
|
61 | 61 | return $this->_is('is_edited'); |
62 | 62 | } |
63 | 63 | |
64 | - public function isPinned (): bool { |
|
64 | + public function isPinned(): bool { |
|
65 | 65 | return $this->_is('is_pinned'); |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param bool $pinned |
70 | 70 | * @return $this |
71 | 71 | */ |
72 | - public function setPinned (bool $pinned) { |
|
72 | + public function setPinned(bool $pinned) { |
|
73 | 73 | return $this->_set('is_pinned', $pinned); |
74 | 74 | } |
75 | 75 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'parent' => Task::class |
33 | 33 | ]; |
34 | 34 | |
35 | - final public function __toString (): string { |
|
35 | + final public function __toString(): string { |
|
36 | 36 | return "attachments/{$this->getGid()}"; |
37 | 37 | } |
38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $file |
43 | 43 | * @return $this |
44 | 44 | */ |
45 | - public function upload (string $file) { |
|
45 | + public function upload(string $file) { |
|
46 | 46 | // api returns compact version. reload. |
47 | 47 | $remote = $this->api->upload("{$this->getParent()}/attachments", $file); |
48 | 48 | $this->data['gid'] = $remote['gid']; |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | 'memberships' => 'memberships.(project|section)' |
96 | 96 | ]; |
97 | 97 | |
98 | - final public function __toString (): string { |
|
98 | + final public function __toString(): string { |
|
99 | 99 | return "tasks/{$this->getGid()}"; |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Clears the diffs for `custom_fields` and `external` sub-objects after saving. |
104 | 104 | */ |
105 | - protected function _clearSubDiffs (): void { |
|
105 | + protected function _clearSubDiffs(): void { |
|
106 | 106 | // use isset() to avoid has() fetch. |
107 | 107 | if (isset($this->data['custom_fields'])) { |
108 | 108 | $this->getCustomFields()->diff = []; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - final protected function _getDir (): string { |
|
115 | + final protected function _getDir(): string { |
|
116 | 116 | return 'tasks'; |
117 | 117 | } |
118 | 118 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param string $file |
124 | 124 | * @return Attachment |
125 | 125 | */ |
126 | - public function addAttachment (string $file) { |
|
126 | + public function addAttachment(string $file) { |
|
127 | 127 | /** @var Attachment $attachment */ |
128 | 128 | $attachment = $this->factory(Attachment::class, ['parent' => $this]); |
129 | 129 | return $attachment->upload($file); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param string $text |
136 | 136 | * @return Story |
137 | 137 | */ |
138 | - public function addComment (string $text) { |
|
138 | + public function addComment(string $text) { |
|
139 | 139 | return $this->newComment()->setText($text)->create(); |
140 | 140 | } |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param Task[] $tasks |
147 | 147 | * @return $this |
148 | 148 | */ |
149 | - public function addDependencies (array $tasks) { |
|
149 | + public function addDependencies(array $tasks) { |
|
150 | 150 | $this->api->post("{$this}/addDependencies", ['dependents' => static::_getGids($tasks)]); |
151 | 151 | return $this; |
152 | 152 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param Task $task |
159 | 159 | * @return $this |
160 | 160 | */ |
161 | - public function addDependency (Task $task) { |
|
161 | + public function addDependency(Task $task) { |
|
162 | 162 | return $this->addDependencies([$task]); |
163 | 163 | } |
164 | 164 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param Task $task |
170 | 170 | * @return $this |
171 | 171 | */ |
172 | - public function addDependent (Task $task) { |
|
172 | + public function addDependent(Task $task) { |
|
173 | 173 | return $this->addDependents([$task]); |
174 | 174 | } |
175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param Task[] $tasks |
181 | 181 | * @return $this |
182 | 182 | */ |
183 | - public function addDependents (array $tasks) { |
|
183 | + public function addDependents(array $tasks) { |
|
184 | 184 | $this->api->post("{$this}/addDependents", ['dependents' => static::_getGids($tasks)]); |
185 | 185 | return $this; |
186 | 186 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param User $user |
192 | 192 | * @return $this |
193 | 193 | */ |
194 | - public function addFollower (User $user) { |
|
194 | + public function addFollower(User $user) { |
|
195 | 195 | return $this->addFollowers([$user]); |
196 | 196 | } |
197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param User[] $users |
202 | 202 | * @return $this |
203 | 203 | */ |
204 | - public function addFollowers (array $users) { |
|
204 | + public function addFollowers(array $users) { |
|
205 | 205 | if ($this->hasGid()) { |
206 | 206 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
207 | 207 | $this->_merge('followers', $users); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param Tag $tag |
219 | 219 | * @return $this |
220 | 220 | */ |
221 | - public function addTag (Tag $tag) { |
|
221 | + public function addTag(Tag $tag) { |
|
222 | 222 | if ($this->hasGid()) { |
223 | 223 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
224 | 224 | $this->_merge('tags', [$tag]); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param Section $section |
236 | 236 | * @return $this |
237 | 237 | */ |
238 | - public function addToProject (Section $section) { |
|
238 | + public function addToProject(Section $section) { |
|
239 | 239 | $project = $section->getProject(); |
240 | 240 | if ($this->hasGid()) { |
241 | 241 | $this->api->post("{$this}/addProject", [ |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param string $target |
270 | 270 | * @return TaskWebhook |
271 | 271 | */ |
272 | - public function addWebhook (string $target) { |
|
272 | + public function addWebhook(string $target) { |
|
273 | 273 | /** @var TaskWebhook $webhook */ |
274 | 274 | $webhook = $this->factory(TaskWebhook::class); |
275 | 275 | return $webhook->create($this, $target); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * @return $this |
280 | 280 | */ |
281 | - public function create () { |
|
281 | + public function create() { |
|
282 | 282 | $this->_create(); |
283 | 283 | $this->_clearSubDiffs(); |
284 | 284 | return $this; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param string[] $include |
295 | 295 | * @return Job |
296 | 296 | */ |
297 | - public function duplicate (string $name, array $include) { |
|
297 | + public function duplicate(string $name, array $include) { |
|
298 | 298 | $remote = $this->api->post("{$this}/duplicate", [ |
299 | 299 | 'name' => $name, |
300 | 300 | 'include' => array_values($include) |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @depends after-create |
309 | 309 | * @return Attachment[] |
310 | 310 | */ |
311 | - public function getAttachments () { |
|
311 | + public function getAttachments() { |
|
312 | 312 | return $this->loadAll(Attachment::class, "{$this}/attachments"); |
313 | 313 | } |
314 | 314 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @depends after-create |
319 | 319 | * @return Story[] |
320 | 320 | */ |
321 | - public function getComments () { |
|
321 | + public function getComments() { |
|
322 | 322 | return array_values(array_filter($this->getStories(), function(Story $story) { |
323 | 323 | return $story->isComment(); |
324 | 324 | })); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @depends after-create |
331 | 331 | * @return Task[] |
332 | 332 | */ |
333 | - public function getDependencies () { |
|
333 | + public function getDependencies() { |
|
334 | 334 | return $this->loadAll(self::class, "{$this}/dependencies"); |
335 | 335 | } |
336 | 336 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @depends after-create |
341 | 341 | * @return Task[] |
342 | 342 | */ |
343 | - public function getDependents () { |
|
343 | + public function getDependents() { |
|
344 | 344 | return $this->loadAll(self::class, "{$this}/dependents"); |
345 | 345 | } |
346 | 346 | |
@@ -351,21 +351,21 @@ discard block |
||
351 | 351 | * @param null|string $token |
352 | 352 | * @return TaskEvent[]|StoryEvent[] |
353 | 353 | */ |
354 | - public function getEvents (&$token) { |
|
354 | + public function getEvents(&$token) { |
|
355 | 355 | return $this->api->sync($this, $token); |
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | 359 | * @return External |
360 | 360 | */ |
361 | - public function getExternal () { |
|
361 | + public function getExternal() { |
|
362 | 362 | return $this->_get('external') ?? $this->data['external'] = $this->factory(static::$map['external']); |
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
366 | 366 | * @return Project[] |
367 | 367 | */ |
368 | - public function getProjects () { |
|
368 | + public function getProjects() { |
|
369 | 369 | return array_map(function(Membership $membership) { |
370 | 370 | return $membership->getProject(); |
371 | 371 | }, $this->getMemberships()); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @depends after-create |
378 | 378 | * @return Story[] |
379 | 379 | */ |
380 | - public function getStories () { |
|
380 | + public function getStories() { |
|
381 | 381 | return $this->loadAll(Story::class, "{$this}/stories"); |
382 | 382 | } |
383 | 383 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * @depends after-create |
388 | 388 | * @return Task[] |
389 | 389 | */ |
390 | - public function getSubTasks () { |
|
390 | + public function getSubTasks() { |
|
391 | 391 | return $this->loadAll(self::class, "{$this}/subtasks"); |
392 | 392 | } |
393 | 393 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @depends after-create |
398 | 398 | * @return string |
399 | 399 | */ |
400 | - public function getUrl (): string { |
|
400 | + public function getUrl(): string { |
|
401 | 401 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
402 | 402 | } |
403 | 403 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @depends after-create |
408 | 408 | * @return TaskWebhook[] |
409 | 409 | */ |
410 | - public function getWebhooks () { |
|
410 | + public function getWebhooks() { |
|
411 | 411 | return $this->loadAll(TaskWebhook::class, 'webhooks', [ |
412 | 412 | 'workspace' => $this->getWorkspace()->getGid(), |
413 | 413 | 'resource' => $this->getGid() |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | /** |
418 | 418 | * @return bool |
419 | 419 | */ |
420 | - public function isRenderedAsSeparator (): bool { |
|
420 | + public function isRenderedAsSeparator(): bool { |
|
421 | 421 | return $this->_is('is_rendered_as_separator'); |
422 | 422 | } |
423 | 423 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @depends after-create |
428 | 428 | * @return Story |
429 | 429 | */ |
430 | - public function newComment () { |
|
430 | + public function newComment() { |
|
431 | 431 | /** @var Story $comment */ |
432 | 432 | $comment = $this->factory(Story::class, [ |
433 | 433 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * @depends after-create |
442 | 442 | * @return Task |
443 | 443 | */ |
444 | - public function newSubTask () { |
|
444 | + public function newSubTask() { |
|
445 | 445 | /** @var Task $sub */ |
446 | 446 | $sub = $this->factory(self::class); |
447 | 447 | return $sub->setParent($this); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * @param Task[] $tasks |
455 | 455 | * @return $this |
456 | 456 | */ |
457 | - public function removeDependencies (array $tasks) { |
|
457 | + public function removeDependencies(array $tasks) { |
|
458 | 458 | $this->api->post("{$this}/removeDependencies", ['dependencies' => static::_getGids($tasks)]); |
459 | 459 | return $this; |
460 | 460 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * @param Task $task |
467 | 467 | * @return $this |
468 | 468 | */ |
469 | - public function removeDependency (Task $task) { |
|
469 | + public function removeDependency(Task $task) { |
|
470 | 470 | return $this->removeDependencies([$task]); |
471 | 471 | } |
472 | 472 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param Task $task |
478 | 478 | * @return $this |
479 | 479 | */ |
480 | - public function removeDependent (Task $task) { |
|
480 | + public function removeDependent(Task $task) { |
|
481 | 481 | return $this->removeDependents([$task]); |
482 | 482 | } |
483 | 483 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param Task[] $tasks |
489 | 489 | * @return $this |
490 | 490 | */ |
491 | - public function removeDependents (array $tasks) { |
|
491 | + public function removeDependents(array $tasks) { |
|
492 | 492 | $this->api->post("{$this}/removeDependents", ['dependents' => static::_getGids($tasks)]); |
493 | 493 | return $this; |
494 | 494 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * @param User $user |
500 | 500 | * @return $this |
501 | 501 | */ |
502 | - public function removeFollower (User $user) { |
|
502 | + public function removeFollower(User $user) { |
|
503 | 503 | return $this->removeFollowers([$user]); |
504 | 504 | } |
505 | 505 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @param User[] $users |
510 | 510 | * @return $this |
511 | 511 | */ |
512 | - public function removeFollowers (array $users) { |
|
512 | + public function removeFollowers(array $users) { |
|
513 | 513 | if ($this->hasGid()) { |
514 | 514 | $this->api->post("{$this}/removeFollowers", ['followers' => static::_getGids($users)]); |
515 | 515 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * @param Project $project |
524 | 524 | * @return $this |
525 | 525 | */ |
526 | - public function removeFromProject (Project $project) { |
|
526 | + public function removeFromProject(Project $project) { |
|
527 | 527 | $gid = $project->getGid(); |
528 | 528 | if ($this->hasGid()) { |
529 | 529 | $this->api->post("{$this}/removeProject", ['project' => $gid]); |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | * @param Tag $tag |
543 | 543 | * @return $this |
544 | 544 | */ |
545 | - public function removeTag (Tag $tag) { |
|
545 | + public function removeTag(Tag $tag) { |
|
546 | 546 | if ($this->hasGid()) { |
547 | 547 | $this->api->post("{$this}/removeTag", ['tag' => $tag->getGid()]); |
548 | 548 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @param null|Task $parent |
557 | 557 | * @return $this |
558 | 558 | */ |
559 | - public function setParent (?self $parent) { |
|
559 | + public function setParent(?self $parent) { |
|
560 | 560 | if ($this->hasGid()) { |
561 | 561 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
562 | 562 | $this->data['parent'] = $parent; |
@@ -571,14 +571,14 @@ discard block |
||
571 | 571 | * @param bool $flag |
572 | 572 | * @return $this |
573 | 573 | */ |
574 | - public function setRenderedAsSeparator (bool $flag) { |
|
574 | + public function setRenderedAsSeparator(bool $flag) { |
|
575 | 575 | return $this->_set('is_rendered_as_separator', $flag); |
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
579 | 579 | * @return $this |
580 | 580 | */ |
581 | - public function update () { |
|
581 | + public function update() { |
|
582 | 582 | $this->_update(); |
583 | 583 | $this->_clearSubDiffs(); |
584 | 584 | return $this; |