@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | const TYPE = 'team'; |
23 | 23 | |
24 | - final public function __toString (): string { |
|
24 | + final public function __toString(): string { |
|
25 | 25 | return "teams/{$this->getGid()}"; |
26 | 26 | } |
27 | 27 | |
28 | - protected function _getMap (): array { |
|
28 | + protected function _getMap(): array { |
|
29 | 29 | return [ |
30 | 30 | 'organization' => Workspace::class |
31 | 31 | ]; |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | * @param User $user |
36 | 36 | * @return $this |
37 | 37 | */ |
38 | - public function addUser (User $user) { |
|
38 | + public function addUser(User $user) { |
|
39 | 39 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
40 | 40 | return $this; |
41 | 41 | } |
42 | 42 | |
43 | - public function getUrl (): string { |
|
43 | + public function getUrl(): string { |
|
44 | 44 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @return User[] |
49 | 49 | */ |
50 | - public function getUsers () { |
|
50 | + public function getUsers() { |
|
51 | 51 | return $this->loadAll(User::class, "{$this}/users"); |
52 | 52 | } |
53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param User $user |
56 | 56 | * @return $this |
57 | 57 | */ |
58 | - public function removeUser (User $user) { |
|
58 | + public function removeUser(User $user) { |
|
59 | 59 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
60 | 60 | return $this; |
61 | 61 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @return string |
37 | 37 | */ |
38 | - public static function random () { |
|
38 | + public static function random() { |
|
39 | 39 | try { |
40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
41 | 41 | return $colors[array_rand($colors)]; |
@@ -39,8 +39,7 @@ |
||
39 | 39 | try { |
40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
41 | 41 | return $colors[array_rand($colors)]; |
42 | - } |
|
43 | - catch (ReflectionException $exception) { |
|
42 | + } catch (ReflectionException $exception) { |
|
44 | 43 | return 'none'; // unreachable |
45 | 44 | } |
46 | 45 | } |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | const STATE_SUCCESS = 'finished'; |
31 | 31 | const STATE_FAIL = 'error'; |
32 | 32 | |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "organization_exports/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
37 | - final protected function _getDir (): string { |
|
37 | + final protected function _getDir(): string { |
|
38 | 38 | return "organization_exports"; |
39 | 39 | } |
40 | 40 | |
41 | - protected function _getMap (): array { |
|
41 | + protected function _getMap(): array { |
|
42 | 42 | return [ |
43 | 43 | 'organization' => Workspace::class |
44 | 44 | ]; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param Workspace $organization |
49 | 49 | * @return $this |
50 | 50 | */ |
51 | - public function create (Workspace $organization) { |
|
51 | + public function create(Workspace $organization) { |
|
52 | 52 | $this->_set('organization', $organization); |
53 | 53 | return $this->_create(); |
54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | - public function isActive (): bool { |
|
61 | + public function isActive(): bool { |
|
62 | 62 | return $this->getState() === self::STATE_ACTIVE; |
63 | 63 | } |
64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return bool |
69 | 69 | */ |
70 | - public function isDone (): bool { |
|
70 | + public function isDone(): bool { |
|
71 | 71 | return $this->isSuccessful() or $this->isFailed(); |
72 | 72 | } |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return bool |
78 | 78 | */ |
79 | - public function isFailed (): bool { |
|
79 | + public function isFailed(): bool { |
|
80 | 80 | return $this->getState() === self::STATE_FAIL; |
81 | 81 | } |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public function isQueued (): bool { |
|
88 | + public function isQueued(): bool { |
|
89 | 89 | return $this->getState() === self::STATE_QUEUED; |
90 | 90 | } |
91 | 91 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return bool |
96 | 96 | */ |
97 | - public function isSuccessful (): bool { |
|
97 | + public function isSuccessful(): bool { |
|
98 | 98 | return $this->getState() === self::STATE_SUCCESS; |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Sleeps and reloads "every few minutes" until the export completes successfully or fails. |
103 | 103 | */ |
104 | - public function wait () { |
|
104 | + public function wait() { |
|
105 | 105 | while (!$this->isDone()) { |
106 | 106 | sleep(240); |
107 | 107 | $this->reload(); |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | * @param CustomField $customField |
38 | 38 | * @param array $data |
39 | 39 | */ |
40 | - public function __construct (CustomField $customField, array $data = []) { |
|
40 | + public function __construct(CustomField $customField, array $data = []) { |
|
41 | 41 | parent::__construct($customField, $data); |
42 | 42 | $this->customField = $customField; |
43 | 43 | } |
44 | 44 | |
45 | - final public function __toString (): string { |
|
45 | + final public function __toString(): string { |
|
46 | 46 | return "enum_options/{$this->getGid()}"; |
47 | 47 | } |
48 | 48 | |
49 | - final protected function _getDir (): string { |
|
49 | + final protected function _getDir(): string { |
|
50 | 50 | return "{$this->customField}/enum_options"; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @return CustomField |
55 | 55 | */ |
56 | - public function getCustomField () { |
|
56 | + public function getCustomField() { |
|
57 | 57 | return $this->customField; |
58 | 58 | } |
59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param EnumOption $option |
62 | 62 | * @return $this |
63 | 63 | */ |
64 | - public function insertAfter (EnumOption $option) { |
|
64 | + public function insertAfter(EnumOption $option) { |
|
65 | 65 | assert($option->hasGid()); |
66 | 66 | if ($this->hasGid()) { |
67 | 67 | $this->api->post("{$this->_getDir()}/insert", [ |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param EnumOption $option |
81 | 81 | * @return $this |
82 | 82 | */ |
83 | - public function insertBefore (EnumOption $option) { |
|
83 | + public function insertBefore(EnumOption $option) { |
|
84 | 84 | assert($option->hasGid()); |
85 | 85 | if ($this->hasGid()) { |
86 | 86 | $this->api->post("{$this->_getDir()}/insert", [ |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | 'enum_option' => $this->getGid(), |
69 | 69 | 'after_enum_option' => $option->getGid() |
70 | 70 | ]); |
71 | - } |
|
72 | - else { |
|
71 | + } else { |
|
73 | 72 | unset($this->data['insert_before'], $this->diff['insert_before']); |
74 | 73 | $this->_set('insert_after', $option->getGid()); |
75 | 74 | } |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | 'enum_option' => $this->getGid(), |
88 | 87 | 'before_enum_option' => $option->getGid() |
89 | 88 | ]); |
90 | - } |
|
91 | - else { |
|
89 | + } else { |
|
92 | 90 | unset($this->data['insert_after'], $this->diff['insert_after']); |
93 | 91 | $this->_set('insert_before', $option->getGid()); |
94 | 92 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | class StoryEvent extends AbstractEvent { |
14 | 14 | |
15 | - protected function _getMap (): array { |
|
15 | + protected function _getMap(): array { |
|
16 | 16 | return [ |
17 | 17 | 'resource' => Story::class, |
18 | 18 | 'user' => User::class |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | class ProjectEvent extends AbstractEvent { |
14 | 14 | |
15 | - protected function _getMap (): array { |
|
15 | + protected function _getMap(): array { |
|
16 | 16 | return [ |
17 | 17 | 'resource' => Project::class, |
18 | 18 | 'user' => User::class |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | class TaskEvent extends AbstractEvent { |
15 | 15 | |
16 | - protected function _getMap (): array { |
|
16 | + protected function _getMap(): array { |
|
17 | 17 | return [ |
18 | 18 | 'parent' => Task::class, |
19 | 19 | 'resource' => Task::class, |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | const TYPE = 'task_webhook'; |
15 | 15 | |
16 | - protected function _getMap (): array { |
|
16 | + protected function _getMap(): array { |
|
17 | 17 | return [ |
18 | 18 | 'resource' => Task::class |
19 | 19 | ]; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | const TYPE = 'project_webhook'; |
15 | 15 | |
16 | - protected function _getMap (): array { |
|
16 | + protected function _getMap(): array { |
|
17 | 17 | return [ |
18 | 18 | 'resource' => Project::class |
19 | 19 | ]; |