@@ -46,14 +46,14 @@ |
||
46 | 46 | */ |
47 | 47 | class Asana extends Facade { |
48 | 48 | |
49 | - public static function getFacadeAccessor () { |
|
49 | + public static function getFacadeAccessor() { |
|
50 | 50 | return AsanaServiceProvider::NAME; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @return Api |
55 | 55 | */ |
56 | - public static function getFacadeRoot () { |
|
56 | + public static function getFacadeRoot() { |
|
57 | 57 | return parent::getFacadeRoot(); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -68,8 +68,7 @@ |
||
68 | 68 | /** @var null|AbstractEntity $entity */ |
69 | 69 | if ($entity = $this->get($entity, $caller, $factory)) { |
70 | 70 | $this->cache->set($key, $entity->getGid()); // renew potentially nonstandard key |
71 | - } |
|
72 | - else { |
|
71 | + } else { |
|
73 | 72 | $this->cache->delete($key); // remove invalid key |
74 | 73 | } |
75 | 74 | return $entity; // null or hydrated. parent calls add() |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param Api $api |
37 | 37 | * @param PSR16 $cache |
38 | 38 | */ |
39 | - public function __construct (Api $api, PSR16 $cache) { |
|
39 | + public function __construct(Api $api, PSR16 $cache) { |
|
40 | 40 | $this->api = $api; |
41 | 41 | $this->cache = $cache; |
42 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param AbstractEntity $entity |
46 | 46 | * @throws InvalidArgumentException |
47 | 47 | */ |
48 | - public function add (AbstractEntity $entity): void { |
|
48 | + public function add(AbstractEntity $entity): void { |
|
49 | 49 | if ($gid = $entity->getGid() and !$entity->isDiff()) { |
50 | 50 | parent::add($entity); |
51 | 51 | foreach ($this->getKeys($entity) as $key) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - public function get (string $key, $caller, Closure $factory) { |
|
60 | + public function get(string $key, $caller, Closure $factory) { |
|
61 | 61 | return parent::get($key, $caller, function($caller) use ($key, $factory) { |
62 | 62 | /** @var null|string|AbstractEntity $entity */ |
63 | 63 | if ($entity = $this->cache->get($key)) { // hit? |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param Api|Data $caller |
102 | 102 | * @return AbstractEntity |
103 | 103 | */ |
104 | - protected function hydrate (AbstractEntity $proto, $caller) { |
|
104 | + protected function hydrate(AbstractEntity $proto, $caller) { |
|
105 | 105 | return $this->api->factory(get_class($proto), $caller, $proto->toArray()); |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param AbstractEntity $entity |
110 | 110 | * @throws InvalidArgumentException |
111 | 111 | */ |
112 | - public function remove (AbstractEntity $entity): void { |
|
112 | + public function remove(AbstractEntity $entity): void { |
|
113 | 113 | parent::remove($entity); |
114 | 114 | $this->cache->deleteMultiple($this->getKeys($entity)); |
115 | 115 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | protected $curlInfo; |
22 | 22 | |
23 | - public function __construct (int $code, string $message, array $curlInfo) { |
|
23 | + public function __construct(int $code, string $message, array $curlInfo) { |
|
24 | 24 | parent::__construct($message, $code); |
25 | 25 | $this->curlInfo = $curlInfo; |
26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @return array |
30 | 30 | */ |
31 | - public function getCurlInfo (): array { |
|
31 | + public function getCurlInfo(): array { |
|
32 | 32 | return $this->curlInfo; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -15,14 +15,14 @@ |
||
15 | 15 | * |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - abstract protected function _getDir (): string; |
|
18 | + abstract protected function _getDir(): string; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * `POST` |
22 | 22 | * |
23 | 23 | * @return $this |
24 | 24 | */ |
25 | - public function create () { |
|
25 | + public function create() { |
|
26 | 26 | /** @var Api $api */ |
27 | 27 | $api = $this->api; |
28 | 28 | $remote = $api->post($this->_getDir(), $this->_getPatch(), ['expand' => 'this']); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * `DELETE` |
15 | 15 | */ |
16 | - public function delete (): void { |
|
16 | + public function delete(): void { |
|
17 | 17 | /** @var Api $api */ |
18 | 18 | $api = $this->api; |
19 | 19 | $api->delete($this); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * @return $this |
17 | 17 | */ |
18 | - public function update () { |
|
18 | + public function update() { |
|
19 | 19 | if ($this->isDiff()) { |
20 | 20 | /** @var Api $api */ |
21 | 21 | $api = $this->api; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | */ |
8 | 8 | class Logger implements LoggerInterface { |
9 | 9 | |
10 | - public function log (string $info, string $path, ?array $payload): void { |
|
10 | + public function log(string $info, string $path, ?array $payload): void { |
|
11 | 11 | // stub |
12 | 12 | } |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | |
24 | 24 | const TYPE = 'section'; |
25 | 25 | |
26 | - final public function __toString (): string { |
|
26 | + final public function __toString(): string { |
|
27 | 27 | return "sections/{$this->getGid()}"; |
28 | 28 | } |
29 | 29 | |
30 | - final protected function _getDir (): string { |
|
30 | + final protected function _getDir(): string { |
|
31 | 31 | return "{$this->getProject()}/sections"; |
32 | 32 | } |
33 | 33 | |
34 | - protected function _getMap (): array { |
|
34 | + protected function _getMap(): array { |
|
35 | 35 | return [ |
36 | 36 | 'projects' => [Project::class] |
37 | 37 | ]; |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return Project |
42 | 42 | */ |
43 | - public function getProject () { |
|
43 | + public function getProject() { |
|
44 | 44 | return $this->_get('projects')[0]; |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @return Task[] |
49 | 49 | */ |
50 | - public function getTasks () { |
|
50 | + public function getTasks() { |
|
51 | 51 | return $this->loadAll(Task::class, 'tasks', ['section' => $this->getGid()]); |
52 | 52 | } |
53 | 53 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @depends after-create |
58 | 58 | * @return Task |
59 | 59 | */ |
60 | - public function newTask () { |
|
60 | + public function newTask() { |
|
61 | 61 | /** @var Task $task */ |
62 | 62 | $task = $this->factory(Task::class); |
63 | 63 | return $task->addToProject($this); |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | const LAYOUT_BOARD = 'board'; |
57 | 57 | const LAYOUT_LIST = 'list'; |
58 | 58 | |
59 | - final public function __toString (): string { |
|
59 | + final public function __toString(): string { |
|
60 | 60 | return "projects/{$this->getGid()}"; |
61 | 61 | } |
62 | 62 | |
63 | - final protected function _getDir (): string { |
|
63 | + final protected function _getDir(): string { |
|
64 | 64 | return 'projects'; |
65 | 65 | } |
66 | 66 | |
67 | - protected function _getMap (): array { |
|
67 | + protected function _getMap(): array { |
|
68 | 68 | return [ |
69 | 69 | 'current_status' => Status::class, |
70 | 70 | 'custom_fields' => [CustomField::class], |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param User $user |
82 | 82 | * @return $this |
83 | 83 | */ |
84 | - public function addMember (User $user) { |
|
84 | + public function addMember(User $user) { |
|
85 | 85 | return $this->addMembers([$user]); |
86 | 86 | } |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param User[] $users |
91 | 91 | * @return $this |
92 | 92 | */ |
93 | - public function addMembers (array $users) { |
|
93 | + public function addMembers(array $users) { |
|
94 | 94 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
95 | 95 | $this->_merge('members', $users); |
96 | 96 | return $this; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $target |
102 | 102 | * @return ProjectWebhook |
103 | 103 | */ |
104 | - public function addWebhook (string $target) { |
|
104 | + public function addWebhook(string $target) { |
|
105 | 105 | /** @var ProjectWebhook $webhook */ |
106 | 106 | $webhook = $this->factory(ProjectWebhook::class); |
107 | 107 | return $webhook->create($this, $target); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param array $schedule |
127 | 127 | * @return Job |
128 | 128 | */ |
129 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
129 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
130 | 130 | $data = ['name' => $name]; |
131 | 131 | if ($team) { |
132 | 132 | $data['team'] = $team->getGid(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $token |
147 | 147 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
148 | 148 | */ |
149 | - public function getEvents (string &$token) { |
|
149 | + public function getEvents(string &$token) { |
|
150 | 150 | return $this->api->sync($this, $token); |
151 | 151 | } |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @depends after-create |
155 | 155 | * @return Section[] |
156 | 156 | */ |
157 | - public function getSections () { |
|
157 | + public function getSections() { |
|
158 | 158 | return $this->loadAll(Section::class, "{$this}/sections"); |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @depends after-create |
163 | 163 | * @return Status[] |
164 | 164 | */ |
165 | - public function getStatuses () { |
|
165 | + public function getStatuses() { |
|
166 | 166 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
167 | 167 | } |
168 | 168 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param array $query |
172 | 172 | * @return Task[] |
173 | 173 | */ |
174 | - public function getTasks (array $query = []) { |
|
174 | + public function getTasks(array $query = []) { |
|
175 | 175 | $query['project'] = $this->getGid(); |
176 | 176 | return $this->loadAll(Task::class, "tasks", $query); |
177 | 177 | } |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | * @depends after-create |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public function getUrl (): string { |
|
183 | + public function getUrl(): string { |
|
184 | 184 | return "https://app.asana.com/0/{$this->getGid()}"; |
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | 188 | * @return ProjectWebhook[] |
189 | 189 | */ |
190 | - public function getWebhooks () { |
|
190 | + public function getWebhooks() { |
|
191 | 191 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
192 | 192 | 'workspace' => $this->getWorkspace()->getGid(), |
193 | 193 | 'resource' => $this->getGid() |
194 | 194 | ]); |
195 | 195 | } |
196 | 196 | |
197 | - public function isBoard (): bool { |
|
197 | + public function isBoard(): bool { |
|
198 | 198 | return $this->getLayout() === self::LAYOUT_BOARD; |
199 | 199 | } |
200 | 200 | |
201 | - public function isList (): bool { |
|
201 | + public function isList(): bool { |
|
202 | 202 | return $this->getLayout() === self::LAYOUT_LIST; |
203 | 203 | } |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @depends after-create |
207 | 207 | * @return Section |
208 | 208 | */ |
209 | - public function newSection () { |
|
209 | + public function newSection() { |
|
210 | 210 | return $this->factory(Section::class, ['projects' => [$this]]); |
211 | 211 | } |
212 | 212 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @depends after-create |
215 | 215 | * @return Status |
216 | 216 | */ |
217 | - public function newStatus () { |
|
217 | + public function newStatus() { |
|
218 | 218 | return $this->factory(Status::class); |
219 | 219 | } |
220 | 220 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @depends after-create |
225 | 225 | * @return Task |
226 | 226 | */ |
227 | - public function newTask () { |
|
227 | + public function newTask() { |
|
228 | 228 | return $this->getSections()[0]->newTask(); |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param User $user |
234 | 234 | * @return $this |
235 | 235 | */ |
236 | - public function removeMember (User $user) { |
|
236 | + public function removeMember(User $user) { |
|
237 | 237 | return $this->removeMembers([$user]); |
238 | 238 | } |
239 | 239 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param User[] $users |
243 | 243 | * @return $this |
244 | 244 | */ |
245 | - public function removeMembers (array $users) { |
|
245 | + public function removeMembers(array $users) { |
|
246 | 246 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
247 | 247 | $this->_remove('members', $users); |
248 | 248 | return $this; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param null|Team $team |
254 | 254 | * @return $this |
255 | 255 | */ |
256 | - public function setTeam (?Team $team) { |
|
256 | + public function setTeam(?Team $team) { |
|
257 | 257 | assert(!$this->hasGid()); |
258 | 258 | if ($team and !$this->hasWorkspace()) { |
259 | 259 | $this->setWorkspace($team->getOrganization()); |