@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | } |
31 | 31 | use DeleteTrait; |
32 | 32 | |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "webhooks/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
37 | - final protected function _getDir (): string { |
|
37 | + final protected function _getDir(): string { |
|
38 | 38 | return 'webhooks'; |
39 | 39 | } |
40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $target |
44 | 44 | * @return $this |
45 | 45 | */ |
46 | - public function create ($resource, string $target) { |
|
46 | + public function create($resource, string $target) { |
|
47 | 47 | $this->_set('resource', $resource); |
48 | 48 | $this->_set('target', $target); |
49 | 49 | return $this->_create(); |
@@ -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 (Exception $exception) { |
|
42 | + } catch (Exception $exception) { |
|
44 | 43 | return 'none'; // unreachable |
45 | 44 | } |
46 | 45 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @return string |
37 | 37 | */ |
38 | - public static function random (): string { |
|
38 | + public static function random(): string { |
|
39 | 39 | try { |
40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
41 | 41 | return $colors[array_rand($colors)]; |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected $customField; |
35 | 35 | |
36 | - public function __construct (CustomField $customField, array $data = []) { |
|
36 | + public function __construct(CustomField $customField, array $data = []) { |
|
37 | 37 | parent::__construct($customField, $data); |
38 | 38 | $this->customField = $customField; |
39 | 39 | } |
40 | 40 | |
41 | - final public function __toString (): string { |
|
41 | + final public function __toString(): string { |
|
42 | 42 | return "enum_options/{$this->getGid()}"; |
43 | 43 | } |
44 | 44 | |
45 | - final protected function _getDir (): string { |
|
45 | + final protected function _getDir(): string { |
|
46 | 46 | return "{$this->customField}/enum_options"; |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @return CustomField |
51 | 51 | */ |
52 | - public function getCustomField () { |
|
52 | + public function getCustomField() { |
|
53 | 53 | return $this->customField; |
54 | 54 | } |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param EnumOption $option |
59 | 59 | * @return $this |
60 | 60 | */ |
61 | - public function moveAfter (EnumOption $option) { |
|
61 | + public function moveAfter(EnumOption $option) { |
|
62 | 62 | $this->api->post("{$this->_getDir()}/insert", [ |
63 | 63 | 'after_enum_option' => $option->getGid(), |
64 | 64 | 'enum_option' => $this->getGid() |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param EnumOption $option |
73 | 73 | * @return $this |
74 | 74 | */ |
75 | - public function moveBefore (EnumOption $option) { |
|
75 | + public function moveBefore(EnumOption $option) { |
|
76 | 76 | $this->api->post("{$this->_getDir()}/insert", [ |
77 | 77 | 'before_enum_option' => $option->getGid(), |
78 | 78 | 'enum_option' => $this->getGid() |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @return $this |
86 | 86 | */ |
87 | - public function moveFirst () { |
|
87 | + public function moveFirst() { |
|
88 | 88 | $first = $this->customField->getEnumOptions()[0]; |
89 | 89 | if ($first !== $this) { |
90 | 90 | $this->moveBefore($first); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @return $this |
97 | 97 | */ |
98 | - public function moveLast () { |
|
98 | + public function moveLast() { |
|
99 | 99 | $options = $this->customField->getEnumOptions(); |
100 | 100 | $last = $options[count($options) - 1]; |
101 | 101 | if ($last !== $this) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $task; |
26 | 26 | |
27 | - public function __construct (Task $task, array $data = []) { |
|
27 | + public function __construct(Task $task, array $data = []) { |
|
28 | 28 | parent::__construct($task, $data); |
29 | 29 | $this->task = $task; |
30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param mixed $value |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - protected function _set (string $field, $value) { |
|
39 | + protected function _set(string $field, $value) { |
|
40 | 40 | $this->task->diff['external'] = true; |
41 | 41 | return parent::_set($field, $value); |
42 | 42 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return null|bool|number|string|array |
48 | 48 | */ |
49 | - public function getDataJsonDecoded () { |
|
49 | + public function getDataJsonDecoded() { |
|
50 | 50 | if (strlen($data = $this->getData())) { |
51 | - return json_decode($data, true, 512, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
51 | + return json_decode($data, true, 512, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
52 | 52 | } |
53 | 53 | return null; |
54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param mixed $data |
61 | 61 | * @return $this |
62 | 62 | */ |
63 | - public function setDataJsonEncoded ($data) { |
|
63 | + public function setDataJsonEncoded($data) { |
|
64 | 64 | if (isset($data)) { |
65 | 65 | return $this->setData(json_encode($data, JSON_THROW_ON_ERROR)); |
66 | 66 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | 'user' => User::class |
19 | 19 | ]; |
20 | 20 | |
21 | - protected function _setData (array $data): void { |
|
21 | + protected function _setData(array $data): void { |
|
22 | 22 | // useless. likes aren't entities. |
23 | 23 | unset($data['gid'], $data['resource_type']); |
24 | 24 | parent::_setData($data); |
25 | 25 | } |
26 | 26 | |
27 | - final public function getResourceType (): string { |
|
27 | + final public function getResourceType(): string { |
|
28 | 28 | return self::TYPE; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -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); |
@@ -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 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'organization' => Workspace::class |
25 | 25 | ]; |
26 | 26 | |
27 | - final public function __toString (): string { |
|
27 | + final public function __toString(): string { |
|
28 | 28 | return "teams/{$this->getGid()}"; |
29 | 29 | } |
30 | 30 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param User $user |
33 | 33 | * @return $this |
34 | 34 | */ |
35 | - public function addUser (User $user) { |
|
35 | + public function addUser(User $user) { |
|
36 | 36 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
37 | 37 | return $this; |
38 | 38 | } |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | * @param array $filter |
46 | 46 | * @return Project[] |
47 | 47 | */ |
48 | - public function getProjects (array $filter = Project::FILTER_ACTIVE) { |
|
48 | + public function getProjects(array $filter = Project::FILTER_ACTIVE) { |
|
49 | 49 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
50 | 50 | } |
51 | 51 | |
52 | - public function getUrl (): string { |
|
52 | + public function getUrl(): string { |
|
53 | 53 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
54 | 54 | } |
55 | 55 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return User[] |
62 | 62 | */ |
63 | - public function getUsers () { |
|
63 | + public function getUsers() { |
|
64 | 64 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
65 | 65 | } |
66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param User $user |
69 | 69 | * @return $this |
70 | 70 | */ |
71 | - public function removeUser (User $user) { |
|
71 | + public function removeUser(User $user) { |
|
72 | 72 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
73 | 73 | return $this; |
74 | 74 | } |