@@ -48,20 +48,20 @@ discard block |
||
| 48 | 48 | * @param Project $project |
| 49 | 49 | * @param array $data |
| 50 | 50 | */ |
| 51 | - public function __construct (Project $project, array $data = []) { |
|
| 51 | + public function __construct(Project $project, array $data = []) { |
|
| 52 | 52 | parent::__construct($project, $data); |
| 53 | 53 | $this->project = $project; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - final public function __toString (): string { |
|
| 56 | + final public function __toString(): string { |
|
| 57 | 57 | return "project_statuses/{$this->getGid()}"; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - final protected function _getDir (): string { |
|
| 60 | + final protected function _getDir(): string { |
|
| 61 | 61 | return "{$this->project}/project_statuses"; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - protected function _getMap (): array { |
|
| 64 | + protected function _getMap(): array { |
|
| 65 | 65 | return [ |
| 66 | 66 | 'created_by' => User::class |
| 67 | 67 | ]; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * @return Project |
| 72 | 72 | */ |
| 73 | - public function getProject () { |
|
| 73 | + public function getProject() { |
|
| 74 | 74 | return $this->project; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | \ No newline at end of file |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | const STATUS_SUCCESS = 'succeeded'; // api docs say "completed" but that's wrong. |
| 29 | 29 | const STATUS_FAIL = 'failed'; |
| 30 | 30 | |
| 31 | - final public function __toString (): string { |
|
| 31 | + final public function __toString(): string { |
|
| 32 | 32 | return "jobs/{$this->getGid()}"; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - protected function _getMap (): array { |
|
| 35 | + protected function _getMap(): array { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'new_project' => Project::class, |
| 38 | 38 | 'new_task' => Task::class |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return bool |
| 46 | 46 | */ |
| 47 | - public function isActive (): bool { |
|
| 47 | + public function isActive(): bool { |
|
| 48 | 48 | return $this->getStatus() === self::STATUS_ACTIVE; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return bool |
| 55 | 55 | */ |
| 56 | - public function isDone (): bool { |
|
| 56 | + public function isDone(): bool { |
|
| 57 | 57 | return $this->isSuccessful() or $this->isFailed(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return bool |
| 64 | 64 | */ |
| 65 | - public function isFailed (): bool { |
|
| 65 | + public function isFailed(): bool { |
|
| 66 | 66 | return $this->getStatus() === self::STATUS_FAIL; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @return bool |
| 73 | 73 | */ |
| 74 | - public function isQueued (): bool { |
|
| 74 | + public function isQueued(): bool { |
|
| 75 | 75 | return $this->getStatus() === self::STATUS_QUEUED; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return bool |
| 82 | 82 | */ |
| 83 | - public function isSuccessful (): bool { |
|
| 83 | + public function isSuccessful(): bool { |
|
| 84 | 84 | return $this->getStatus() === self::STATUS_SUCCESS; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function wait () { |
|
| 92 | + public function wait() { |
|
| 93 | 93 | while (!$this->isDone()) { |
| 94 | 94 | sleep(3); |
| 95 | 95 | $this->reload(); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * @param Workspace $workspace |
| 18 | 18 | * @return $this |
| 19 | 19 | */ |
| 20 | - public function setWorkspace (Workspace $workspace) { |
|
| 20 | + public function setWorkspace(Workspace $workspace) { |
|
| 21 | 21 | assert(!$this->hasGid()); |
| 22 | 22 | return $this->_set('workspace', $workspace); |
| 23 | 23 | } |
@@ -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 | * Resolves entities to GIDs. |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param AbstractEntity[] $entities |
| 25 | 25 | * @return string[] |
| 26 | 26 | */ |
| 27 | - protected static function _getGids (array $entities) { |
|
| 27 | + protected static function _getGids(array $entities) { |
|
| 28 | 28 | return array_map(function(AbstractEntity $entity) { |
| 29 | 29 | return $entity->getGid(); |
| 30 | 30 | }, $entities); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param string $key |
| 37 | 37 | * @return mixed |
| 38 | 38 | */ |
| 39 | - protected function _get (string $key) { |
|
| 39 | + protected function _get(string $key) { |
|
| 40 | 40 | if (!array_key_exists($key, $this->data) and isset($this->data['gid'])) { // can't use hasGid(), inf. loop |
| 41 | 41 | $this->reload($key); |
| 42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param bool $force |
| 52 | 52 | * @return $this |
| 53 | 53 | */ |
| 54 | - protected function _merge (string $key, array $entities, $force = false) { |
|
| 54 | + protected function _merge(string $key, array $entities, $force = false) { |
|
| 55 | 55 | if ($force or isset($this->data[$key])) { |
| 56 | 56 | foreach ($entities as $entity) { |
| 57 | 57 | $this->data[$key][] = $entity; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param AbstractEntity[] $entities |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - protected function _remove (string $key, array $entities) { |
|
| 77 | + protected function _remove(string $key, array $entities) { |
|
| 78 | 78 | if (isset($this->data[$key])) { |
| 79 | 79 | $this->data[$key] = array_values(array_diff($this->data[$key], $entities)); |
| 80 | 80 | $this->api->getCache()->add($this); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param AbstractEntity $entity |
| 89 | 89 | * @return $this |
| 90 | 90 | */ |
| 91 | - public function merge (AbstractEntity $entity) { |
|
| 91 | + public function merge(AbstractEntity $entity) { |
|
| 92 | 92 | assert($entity->api); // hydrated |
| 93 | 93 | foreach ($entity->data as $key => $value) { |
| 94 | 94 | if (!array_key_exists($key, $this->data) and !isset($entity->diff[$key])) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param string $key |
| 105 | 105 | * @return $this |
| 106 | 106 | */ |
| 107 | - public function reload (string $key = null) { |
|
| 107 | + public function reload(string $key = null) { |
|
| 108 | 108 | if (isset($key)) { |
| 109 | 109 | $value = $this->api->get($this, [], ['fields' => $key])[$key]; |
| 110 | 110 | $map = $this->_getMap(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param AbstractEntity $entity |
| 34 | 34 | */ |
| 35 | - public function add (AbstractEntity $entity): void { |
|
| 35 | + public function add(AbstractEntity $entity): void { |
|
| 36 | 36 | if ($gid = $entity->getGid() and !$entity->isDiff()) { |
| 37 | 37 | $this->entities[$gid] = $entity; |
| 38 | 38 | foreach ($this->getKeys($entity) as $key) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param Closure $factory `fn($caller): null|AbstractEntity` |
| 53 | 53 | * @return null|mixed|AbstractEntity |
| 54 | 54 | */ |
| 55 | - public function get (string $key, $caller, Closure $factory) { |
|
| 55 | + public function get(string $key, $caller, Closure $factory) { |
|
| 56 | 56 | if ($gid = $this->gids[$key] ?? null) { |
| 57 | 57 | return $this->entities[$gid]; |
| 58 | 58 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param AbstractEntity $entity |
| 82 | 82 | * @return string[] |
| 83 | 83 | */ |
| 84 | - protected function getKeys (AbstractEntity $entity) { |
|
| 84 | + protected function getKeys(AbstractEntity $entity) { |
|
| 85 | 85 | if (!$gid = $entity->getGid() or $entity->isDiff()) { |
| 86 | 86 | return []; |
| 87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @param AbstractEntity $entity |
| 99 | 99 | */ |
| 100 | - public function remove (AbstractEntity $entity): void { |
|
| 100 | + public function remove(AbstractEntity $entity): void { |
|
| 101 | 101 | unset($this->entities[$entity->getGid()]); |
| 102 | 102 | foreach ($this->getKeys($entity) as $key) { |
| 103 | 103 | unset($this->gids[$key]); |
@@ -12,5 +12,5 @@ |
||
| 12 | 12 | * @param string $path |
| 13 | 13 | * @param null|array $payload |
| 14 | 14 | */ |
| 15 | - public function log (string $info, string $path, ?array $payload): void; |
|
| 15 | + public function log(string $info, string $path, ?array $payload): void; |
|
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | |
| 12 | 12 | const NAME = 'asana'; |
| 13 | 13 | |
| 14 | - public function boot () { |
|
| 14 | + public function boot() { |
|
| 15 | 15 | $this->mergeConfigFrom(App::configPath('asana.php'), self::NAME); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function register () { |
|
| 18 | + public function register() { |
|
| 19 | 19 | $this->app->singleton(self::NAME, function($app) { |
| 20 | 20 | $config = $app->config->get(self::NAME); |
| 21 | 21 | return new Api($config['token']); |
@@ -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 |
@@ -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 |