@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - final public function __toString (): string { |
|
41 | + final public function __toString(): string { |
|
42 | 42 | return "organization_exports/{$this->getGid()}"; |
43 | 43 | } |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return string |
49 | 49 | */ |
50 | - final protected function _getDir (): string { |
|
50 | + final protected function _getDir(): string { |
|
51 | 51 | return "organization_exports"; |
52 | 52 | } |
53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param Workspace $organization |
56 | 56 | * @return $this |
57 | 57 | */ |
58 | - public function create (Workspace $organization) { |
|
58 | + public function create(Workspace $organization) { |
|
59 | 59 | $this->_set('organization', $organization); |
60 | 60 | return $this->_create(); |
61 | 61 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return bool |
67 | 67 | */ |
68 | - final public function isActive (): bool { |
|
68 | + final public function isActive(): bool { |
|
69 | 69 | return $this->getState() === self::STATE_ACTIVE; |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | - final public function isDone (): bool { |
|
77 | + final public function isDone(): bool { |
|
78 | 78 | return $this->isSuccessful() or $this->isFailed(); |
79 | 79 | } |
80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return bool |
85 | 85 | */ |
86 | - final public function isFailed (): bool { |
|
86 | + final public function isFailed(): bool { |
|
87 | 87 | return $this->getState() === self::STATE_FAIL; |
88 | 88 | } |
89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - final public function isQueued (): bool { |
|
95 | + final public function isQueued(): bool { |
|
96 | 96 | return $this->getState() === self::STATE_QUEUED; |
97 | 97 | } |
98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return bool |
103 | 103 | */ |
104 | - final public function isSuccessful (): bool { |
|
104 | + final public function isSuccessful(): bool { |
|
105 | 105 | return $this->getState() === self::STATE_SUCCESS; |
106 | 106 | } |
107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param callable $spinner `fn( OrganizationExport $this ): void` |
114 | 114 | * @return $this |
115 | 115 | */ |
116 | - public function wait (callable $spinner = null) { |
|
116 | + public function wait(callable $spinner = null) { |
|
117 | 117 | while (!$this->isDone()) { |
118 | 118 | if ($spinner) { |
119 | 119 | call_user_func($spinner, $this); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected $key; |
42 | 42 | |
43 | - protected function _setData (array $data): void { |
|
43 | + protected function _setData(array $data): void { |
|
44 | 44 | $this->key = [ |
45 | 45 | Event::ACTION_ADDED => 'added_value', |
46 | 46 | Event::ACTION_REMOVED => 'removed_value', |
@@ -67,35 +67,35 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return null|User|Project|Section|Task|FieldEntry|Attachment|Story|Like |
69 | 69 | */ |
70 | - public function getPayload () { |
|
70 | + public function getPayload() { |
|
71 | 71 | return $this->data[$this->key]; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | - final public function hasPayload (): bool { |
|
77 | + final public function hasPayload(): bool { |
|
78 | 78 | return isset($this->data[$this->key]); |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @return bool |
83 | 83 | */ |
84 | - final public function wasAddition (): bool { |
|
84 | + final public function wasAddition(): bool { |
|
85 | 85 | return $this->getAction() === Event::ACTION_ADDED; |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return bool |
90 | 90 | */ |
91 | - final public function wasRemoval (): bool { |
|
91 | + final public function wasRemoval(): bool { |
|
92 | 92 | return $this->getAction() === Event::ACTION_REMOVED; |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @return bool |
97 | 97 | */ |
98 | - final public function wasValue (): bool { |
|
98 | + final public function wasValue(): bool { |
|
99 | 99 | return $this->getAction() === Event::ACTION_CHANGED; |
100 | 100 | } |
101 | 101 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string |
32 | 32 | */ |
33 | - final public function __toString (): string { |
|
33 | + final public function __toString(): string { |
|
34 | 34 | return "teams/{$this->getGid()}"; |
35 | 35 | } |
36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param User $user |
39 | 39 | * @return $this |
40 | 40 | */ |
41 | - public function addUser (User $user) { |
|
41 | + public function addUser(User $user) { |
|
42 | 42 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
43 | 43 | return $this; |
44 | 44 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @param array $filter |
52 | 52 | * @return Project[] |
53 | 53 | */ |
54 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
54 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
55 | 55 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
56 | 56 | } |
57 | 57 | |
58 | - public function getUrl (): string { |
|
58 | + public function getUrl(): string { |
|
59 | 59 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return User[] |
68 | 68 | */ |
69 | - public function getUsers () { |
|
69 | + public function getUsers() { |
|
70 | 70 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
71 | 71 | } |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param User $user |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function removeUser (User $user) { |
|
77 | + public function removeUser(User $user) { |
|
78 | 78 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
79 | 79 | return $this; |
80 | 80 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return string |
45 | 45 | */ |
46 | - final public function __toString (): string { |
|
46 | + final public function __toString(): string { |
|
47 | 47 | return "tags/{$this->getGid()}"; |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - final protected function _getDir (): string { |
|
55 | + final protected function _getDir(): string { |
|
56 | 56 | return 'tags'; |
57 | 57 | } |
58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array $filter |
61 | 61 | * @return Traversable|Task[] |
62 | 62 | */ |
63 | - public function getIterator (array $filter = Task::GET_INCOMPLETE) { |
|
63 | + public function getIterator(array $filter = Task::GET_INCOMPLETE) { |
|
64 | 64 | return $this->api->loadEach($this, Task::class, "{$this}/tasks", $filter); |
65 | 65 | } |
66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param array $filter |
69 | 69 | * @return Task[] |
70 | 70 | */ |
71 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
71 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
72 | 72 | return iterator_to_array($this->getIterator($filter)); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - final public function __toString (): string { |
|
42 | + final public function __toString(): string { |
|
43 | 43 | return "attachments/{$this->getGid()}"; |
44 | 44 | } |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param string $file |
52 | 52 | * @return $this |
53 | 53 | */ |
54 | - public function create (string $file) { |
|
54 | + public function create(string $file) { |
|
55 | 55 | // api returns compact version. reload. |
56 | 56 | $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [ |
57 | 57 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - final public function __toString (): string { |
|
41 | + final public function __toString(): string { |
|
42 | 42 | return "workspaces/{$this->getGid()}"; |
43 | 43 | } |
44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return OrganizationExport |
51 | 51 | */ |
52 | - public function export () { |
|
52 | + public function export() { |
|
53 | 53 | /** @var OrganizationExport $export */ |
54 | 54 | $export = $this->api->factory($this, OrganizationExport::class); |
55 | 55 | return $export->create($this); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param int $limit 1-100 |
70 | 70 | * @return array|AbstractEntity[] |
71 | 71 | */ |
72 | - protected function find (string $class, string $text, int $limit = 20) { |
|
72 | + protected function find(string $class, string $text, int $limit = 20) { |
|
73 | 73 | return $this->api->loadAll($this, $class, "{$this}/typeahead", [ |
74 | 74 | 'resource_type' => $class::TYPE, |
75 | 75 | 'query' => $text, |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param int $limit 1-100 |
85 | 85 | * @return CustomField[] |
86 | 86 | */ |
87 | - public function findCustomFields (string $text, int $limit = 20) { |
|
87 | + public function findCustomFields(string $text, int $limit = 20) { |
|
88 | 88 | return $this->find(CustomField::class, $text, $limit); |
89 | 89 | } |
90 | 90 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param int $limit 1-100 |
96 | 96 | * @return Portfolio[] |
97 | 97 | */ |
98 | - public function findPortfolios (string $text, int $limit = 20) { |
|
98 | + public function findPortfolios(string $text, int $limit = 20) { |
|
99 | 99 | return $this->find(Portfolio::class, $text, $limit); |
100 | 100 | } |
101 | 101 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param int $limit 1-100 |
107 | 107 | * @return Project[] |
108 | 108 | */ |
109 | - public function findProjects (string $text, int $limit = 20) { |
|
109 | + public function findProjects(string $text, int $limit = 20) { |
|
110 | 110 | return $this->find(Project::class, $text, $limit); |
111 | 111 | } |
112 | 112 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param int $limit 1-100 |
118 | 118 | * @return Tag[] |
119 | 119 | */ |
120 | - public function findTags (string $text, int $limit = 20) { |
|
120 | + public function findTags(string $text, int $limit = 20) { |
|
121 | 121 | return $this->find(Tag::class, $text, $limit); |
122 | 122 | } |
123 | 123 | |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | * @param int $limit 1-100 |
129 | 129 | * @return Task[] |
130 | 130 | */ |
131 | - public function findTasks (string $text, int $limit = 20) { |
|
131 | + public function findTasks(string $text, int $limit = 20) { |
|
132 | 132 | return $this->find(Task::class, $text, $limit); |
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
136 | 136 | * @return CustomField[] |
137 | 137 | */ |
138 | - public function getCustomFields () { |
|
138 | + public function getCustomFields() { |
|
139 | 139 | return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields"); |
140 | 140 | } |
141 | 141 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @return Portfolio[] |
146 | 146 | */ |
147 | - public function getPortfolios () { |
|
147 | + public function getPortfolios() { |
|
148 | 148 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
149 | 149 | 'workspace' => $this->getGid(), |
150 | 150 | 'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required. |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param array $filter |
158 | 158 | * @return Project[] |
159 | 159 | */ |
160 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
160 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
161 | 161 | $filter['workspace'] = $this->getGid(); |
162 | 162 | return $this->api->loadAll($this, Project::class, 'projects', $filter); |
163 | 163 | } |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * @return Tag[] |
167 | 167 | */ |
168 | - public function getTags () { |
|
168 | + public function getTags() { |
|
169 | 169 | return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]); |
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
173 | 173 | * @return Team[] |
174 | 174 | */ |
175 | - public function getTeams () { |
|
175 | + public function getTeams() { |
|
176 | 176 | return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams"); |
177 | 177 | } |
178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param string $email |
181 | 181 | * @return null|User |
182 | 182 | */ |
183 | - public function getUserByEmail (string $email) { |
|
183 | + public function getUserByEmail(string $email) { |
|
184 | 184 | return $this->api->getPool()->get("users/{$email}", $this, function() use ($email) { |
185 | 185 | foreach ($this->getUsers() as $user) { |
186 | 186 | if ($user->getEmail() === $email) { |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * @return User[] |
196 | 196 | */ |
197 | - public function getUsers () { |
|
197 | + public function getUsers() { |
|
198 | 198 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | 202 | * @return ProjectWebhook[]|TaskWebhook[] |
203 | 203 | */ |
204 | - public function getWebhooks () { |
|
204 | + public function getWebhooks() { |
|
205 | 205 | return array_map(function(array $each) { |
206 | 206 | return $this->api->getPool()->get($each['gid'], $this, function() use ($each) { |
207 | 207 | return $this->api->factory($this, [ |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @return bool |
220 | 220 | */ |
221 | - final public function isOrganization (): bool { |
|
221 | + final public function isOrganization(): bool { |
|
222 | 222 | return $this->_is('is_organization'); |
223 | 223 | } |
224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return CustomField |
229 | 229 | */ |
230 | - public function newCustomField () { |
|
230 | + public function newCustomField() { |
|
231 | 231 | /** @var CustomField $field */ |
232 | 232 | $field = $this->api->factory($this, CustomField::class); |
233 | 233 | return $field->setWorkspace($this); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return Portfolio |
240 | 240 | */ |
241 | - public function newPortfolio () { |
|
241 | + public function newPortfolio() { |
|
242 | 242 | /** @var Portfolio $portfolio */ |
243 | 243 | $portfolio = $this->api->factory($this, Portfolio::class); |
244 | 244 | return $portfolio->setWorkspace($this); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return Project |
251 | 251 | */ |
252 | - public function newProject () { |
|
252 | + public function newProject() { |
|
253 | 253 | /** @var Project $project */ |
254 | 254 | $project = $this->api->factory($this, Project::class); |
255 | 255 | return $project->setWorkspace($this); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return Tag |
262 | 262 | */ |
263 | - public function newTag () { |
|
263 | + public function newTag() { |
|
264 | 264 | /** @var Tag $tag */ |
265 | 265 | $tag = $this->api->factory($this, Tag::class); |
266 | 266 | return $tag->setWorkspace($this); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return Task |
273 | 273 | */ |
274 | - public function newTask () { |
|
274 | + public function newTask() { |
|
275 | 275 | /** @var Task $task */ |
276 | 276 | $task = $this->api->factory($this, Task::class); |
277 | 277 | return $task->setWorkspace($this); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - final public function __toString (): string { |
|
97 | + final public function __toString(): string { |
|
98 | 98 | return "projects/{$this->getGid()}"; |
99 | 99 | } |
100 | 100 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - final protected function _getDir (): string { |
|
106 | + final protected function _getDir(): string { |
|
107 | 107 | return 'projects'; |
108 | 108 | } |
109 | 109 | |
110 | - protected function _setData (array $data): void { |
|
110 | + protected function _setData(array $data): void { |
|
111 | 111 | // this is always empty. fields are in the settings, values are in tasks. |
112 | 112 | unset($data['custom_fields']); |
113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param User $user |
123 | 123 | * @return $this |
124 | 124 | */ |
125 | - public function addMember (User $user) { |
|
125 | + public function addMember(User $user) { |
|
126 | 126 | return $this->addMembers([$user]); |
127 | 127 | } |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param User[] $users |
132 | 132 | * @return $this |
133 | 133 | */ |
134 | - public function addMembers (array $users) { |
|
134 | + public function addMembers(array $users) { |
|
135 | 135 | return $this->_addWithPost("{$this}/addMembers", [ |
136 | 136 | 'members' => array_column($users, 'gid') |
137 | 137 | ], 'members', $users); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $target |
143 | 143 | * @return ProjectWebhook |
144 | 144 | */ |
145 | - public function addWebhook (string $target) { |
|
145 | + public function addWebhook(string $target) { |
|
146 | 146 | /** @var ProjectWebhook $webhook */ |
147 | 147 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
148 | 148 | return $webhook->create($this, $target); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param array $schedule |
168 | 168 | * @return Job |
169 | 169 | */ |
170 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
170 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
171 | 171 | $data = ['name' => $name]; |
172 | 172 | if ($team) { |
173 | 173 | $data['team'] = $team->getGid(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @depends after-create |
188 | 188 | * @return Section |
189 | 189 | */ |
190 | - public function getDefaultSection () { |
|
190 | + public function getDefaultSection() { |
|
191 | 191 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
192 | 192 | } |
193 | 193 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param int $limit |
200 | 200 | * @return Traversable|Section[] |
201 | 201 | */ |
202 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
202 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
203 | 203 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
204 | 204 | } |
205 | 205 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param int $limit |
209 | 209 | * @return Section[] |
210 | 210 | */ |
211 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
211 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
212 | 212 | return iterator_to_array($this->getIterator($limit)); |
213 | 213 | } |
214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @depends after-create |
217 | 217 | * @return Status[] |
218 | 218 | */ |
219 | - public function getStatuses () { |
|
219 | + public function getStatuses() { |
|
220 | 220 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
221 | 221 | } |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @depends after-create |
225 | 225 | * @return TaskCounts |
226 | 226 | */ |
227 | - public function getTaskCounts () { |
|
227 | + public function getTaskCounts() { |
|
228 | 228 | $remote = $this->api->get("{$this}/task_counts", [ |
229 | 229 | 'opt_fields' => // opt_expand doesn't work. |
230 | 230 | 'num_completed_milestones,' |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param array $filter |
245 | 245 | * @return Task[] |
246 | 246 | */ |
247 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
247 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
248 | 248 | $filter['project'] = $this->getGid(); |
249 | 249 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
250 | 250 | } |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | * @depends after-create |
254 | 254 | * @return string |
255 | 255 | */ |
256 | - public function getUrl (): string { |
|
256 | + public function getUrl(): string { |
|
257 | 257 | return "https://app.asana.com/0/{$this->getGid()}"; |
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | 261 | * @return ProjectWebhook[] |
262 | 262 | */ |
263 | - public function getWebhooks () { |
|
263 | + public function getWebhooks() { |
|
264 | 264 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
265 | 265 | 'workspace' => $this->getWorkspace()->getGid(), |
266 | 266 | 'resource' => $this->getGid() |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | /** |
271 | 271 | * @return bool |
272 | 272 | */ |
273 | - final public function isBoard (): bool { |
|
273 | + final public function isBoard(): bool { |
|
274 | 274 | return $this->getLayout() === self::LAYOUT_BOARD; |
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @return bool |
279 | 279 | */ |
280 | - final public function isList (): bool { |
|
280 | + final public function isList(): bool { |
|
281 | 281 | return $this->getLayout() === self::LAYOUT_LIST; |
282 | 282 | } |
283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @depends after-create |
288 | 288 | * @return Section |
289 | 289 | */ |
290 | - public function newSection () { |
|
290 | + public function newSection() { |
|
291 | 291 | return $this->api->factory($this, Section::class, ['project' => $this]); |
292 | 292 | } |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @depends after-create |
298 | 298 | * @return Status |
299 | 299 | */ |
300 | - public function newStatus () { |
|
300 | + public function newStatus() { |
|
301 | 301 | return $this->api->factory($this, Status::class); |
302 | 302 | } |
303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @depends after-create |
308 | 308 | * @return Task |
309 | 309 | */ |
310 | - public function newTask () { |
|
310 | + public function newTask() { |
|
311 | 311 | return $this->getDefaultSection()->newTask(); |
312 | 312 | } |
313 | 313 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @param User $user |
317 | 317 | * @return $this |
318 | 318 | */ |
319 | - public function removeMember (User $user) { |
|
319 | + public function removeMember(User $user) { |
|
320 | 320 | return $this->removeMembers([$user]); |
321 | 321 | } |
322 | 322 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @param User[] $users |
326 | 326 | * @return $this |
327 | 327 | */ |
328 | - public function removeMembers (array $users) { |
|
328 | + public function removeMembers(array $users) { |
|
329 | 329 | return $this->_removeWithPost("{$this}/removeMembers", [ |
330 | 330 | 'members' => array_column($users, 'gid') |
331 | 331 | ], 'members', $users); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @param null|Team $team |
337 | 337 | * @return $this |
338 | 338 | */ |
339 | - public function setTeam (?Team $team) { |
|
339 | + public function setTeam(?Team $team) { |
|
340 | 340 | if ($team and !$this->hasWorkspace()) { |
341 | 341 | $this->setWorkspace($team->getOrganization()); |
342 | 342 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected $curlInfo; |
23 | 23 | |
24 | - public function __construct (int $code, string $message, array $curlInfo) { |
|
24 | + public function __construct(int $code, string $message, array $curlInfo) { |
|
25 | 25 | parent::__construct($message, $code); |
26 | 26 | $this->curlInfo = $curlInfo; |
27 | 27 | } |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - public function asResponse () { |
|
33 | - return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
32 | + public function asResponse() { |
|
33 | + return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @return array |
38 | 38 | */ |
39 | - public function getCurlInfo (): array { |
|
39 | + public function getCurlInfo(): array { |
|
40 | 40 | return $this->curlInfo; |
41 | 41 | } |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param int $code |
45 | 45 | * @return bool |
46 | 46 | */ |
47 | - final public function is (int $code): bool { |
|
47 | + final public function is(int $code): bool { |
|
48 | 48 | return $this->code === $code; |
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string |
32 | 32 | */ |
33 | - abstract public function __toString (): string; |
|
33 | + abstract public function __toString(): string; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @param self $entity |
37 | 37 | * @return bool |
38 | 38 | * @internal pool |
39 | 39 | */ |
40 | - final public function __merge (self $entity): bool { |
|
40 | + final public function __merge(self $entity): bool { |
|
41 | 41 | $old = $this->toArray(); |
42 | 42 | $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff)); |
43 | 43 | return $this->toArray() !== $old; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $field |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - protected function _get (string $field) { |
|
52 | + protected function _get(string $field) { |
|
53 | 53 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
54 | 54 | $this->_reload($field); |
55 | 55 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @param string $field |
61 | 61 | */ |
62 | - protected function _reload (string $field): void { |
|
62 | + protected function _reload(string $field): void { |
|
63 | 63 | $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]); |
64 | 64 | $this->_setField($field, $remote[$field]); |
65 | 65 | $this->api->getPool()->add($this); |
66 | 66 | } |
67 | 67 | |
68 | - protected function _setData (array $data): void { |
|
68 | + protected function _setData(array $data): void { |
|
69 | 69 | // meaningless once the entity is being created. it's constant. |
70 | 70 | unset($data['resource_type'], $data['type']); |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @return null|string |
77 | 77 | */ |
78 | - final public function getGid (): ?string { |
|
78 | + final public function getGid(): ?string { |
|
79 | 79 | return $this->data['gid'] ?? null; |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return string[] |
86 | 86 | */ |
87 | - public function getPoolKeys () { |
|
87 | + public function getPoolKeys() { |
|
88 | 88 | return [$this->getGid(), (string)$this]; |
89 | 89 | } |
90 | 90 | |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return string |
95 | 95 | */ |
96 | - final public function getResourceType (): string { |
|
96 | + final public function getResourceType(): string { |
|
97 | 97 | return static::TYPE; |
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - final public function hasGid (): bool { |
|
103 | + final public function hasGid(): bool { |
|
104 | 104 | return isset($this->data['gid']); |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @depends after-create |
111 | 111 | * @return $this |
112 | 112 | */ |
113 | - public function reload () { |
|
113 | + public function reload() { |
|
114 | 114 | $remote = $this->api->get($this, ['opt_expand' => 'this']); |
115 | 115 | if (!isset($remote['gid'])) { // null and dir guard |
116 | 116 | $this->api->getPool()->remove($this->getPoolKeys()); |