@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | const TYPE_NUMBER = 'number'; |
| 38 | 38 | const TYPE_TEXT = 'text'; |
| 39 | 39 | |
| 40 | - final public function __toString (): string { |
|
| 40 | + final public function __toString(): string { |
|
| 41 | 41 | return "custom_fields/{$this->getGid()}"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - final protected function _getDir (): string { |
|
| 44 | + final protected function _getDir(): string { |
|
| 45 | 45 | return 'custom_fields'; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - protected function _getMap (): array { |
|
| 48 | + protected function _getMap(): array { |
|
| 49 | 49 | return [ |
| 50 | 50 | 'enum_options' => [EnumOption::class], |
| 51 | 51 | 'enum_value' => EnumOption::class |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $name |
| 57 | 57 | * @return EnumOption |
| 58 | 58 | */ |
| 59 | - public function addEnumOption (string $name) { |
|
| 59 | + public function addEnumOption(string $name) { |
|
| 60 | 60 | /** @var EnumOption $option */ |
| 61 | 61 | $option = $this->factory(EnumOption::class); |
| 62 | 62 | $option->setName($name); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| 80 | - public function getValue () { |
|
| 80 | + public function getValue() { |
|
| 81 | 81 | switch ($this->getResourceSubtype()) { |
| 82 | 82 | case self::TYPE_ENUM: |
| 83 | 83 | return $this->getEnumValue()->getName(); |
@@ -89,28 +89,28 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | - public function hasNotificationsEnabled (): bool { |
|
| 92 | + public function hasNotificationsEnabled(): bool { |
|
| 93 | 93 | return $this->_is('has_notifications_enabled'); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * @return bool |
| 98 | 98 | */ |
| 99 | - public function isEnum (): bool { |
|
| 99 | + public function isEnum(): bool { |
|
| 100 | 100 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return bool |
| 105 | 105 | */ |
| 106 | - public function isGlobalToWorkspace (): bool { |
|
| 106 | + public function isGlobalToWorkspace(): bool { |
|
| 107 | 107 | return $this->_is('is_global_to_workspace'); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @return bool |
| 112 | 112 | */ |
| 113 | - final public function isText (): bool { |
|
| 113 | + final public function isText(): bool { |
|
| 114 | 114 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param bool $flag |
| 119 | 119 | * @return $this |
| 120 | 120 | */ |
| 121 | - public function setGlobalToWorkspace (bool $flag) { |
|
| 121 | + public function setGlobalToWorkspace(bool $flag) { |
|
| 122 | 122 | return $this->_set('is_global_to_workspace', $flag); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param bool $flag |
| 127 | 127 | * @return $this |
| 128 | 128 | */ |
| 129 | - public function setNotificationsEnabled (bool $flag) { |
|
| 129 | + public function setNotificationsEnabled(bool $flag) { |
|
| 130 | 130 | return $this->_set('has_notifications_enabled', $flag); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param string $value |
| 139 | 139 | * @return $this |
| 140 | 140 | */ |
| 141 | - public function setValue (string $value) { |
|
| 141 | + public function setValue(string $value) { |
|
| 142 | 142 | if ($this->isEnum()) { |
| 143 | 143 | foreach ($this->getEnumOptions() as $option) { |
| 144 | 144 | if ($value === $option->getName()) { |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | const TYPE = 'user_task_list'; |
| 27 | 27 | |
| 28 | - final public function __toString (): string { |
|
| 28 | + final public function __toString(): string { |
|
| 29 | 29 | return "user_task_lists/{$this->getGid()}"; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function _getMap (): array { |
|
| 32 | + protected function _getMap(): array { |
|
| 33 | 33 | return [ |
| 34 | 34 | 'owner' => User::class, |
| 35 | 35 | 'workspace' => Workspace::class |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @return Task[] |
| 41 | 41 | */ |
| 42 | - public function getIncompleteTasks () { |
|
| 42 | + public function getIncompleteTasks() { |
|
| 43 | 43 | return $this->loadAll(Task::class, "{$this}/tasks", ['completed_since' => 'now']); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return ArrayIterator|Task[] |
| 50 | 50 | */ |
| 51 | - public function getIterator () { |
|
| 51 | + public function getIterator() { |
|
| 52 | 52 | return new ArrayIterator($this->getTasks()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @return Task[] |
| 57 | 57 | */ |
| 58 | - public function getTasks () { |
|
| 58 | + public function getTasks() { |
|
| 59 | 59 | return $this->loadAll(Task::class, "{$this}/tasks"); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Like extends Data { |
| 14 | 14 | |
| 15 | - public function _getMap (): array { |
|
| 15 | + public function _getMap(): array { |
|
| 16 | 16 | return [ |
| 17 | 17 | 'user' => User::class |
| 18 | 18 | ]; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Membership extends Data { |
| 18 | 18 | |
| 19 | - protected function _getMap (): array { |
|
| 19 | + protected function _getMap(): array { |
|
| 20 | 20 | return [ |
| 21 | 21 | 'project' => Project::class, |
| 22 | 22 | 'section' => Section::class |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | const TYPE = 'attachment'; |
| 30 | 30 | |
| 31 | - final public function __toString (): string { |
|
| 31 | + final public function __toString(): string { |
|
| 32 | 32 | return "attachments/{$this->getGid()}"; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - protected function _getMap (): array { |
|
| 35 | + protected function _getMap(): array { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'parent' => Task::class |
| 38 | 38 | ]; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $file |
| 45 | 45 | * @return $this |
| 46 | 46 | */ |
| 47 | - public function upload (string $file) { |
|
| 47 | + public function upload(string $file) { |
|
| 48 | 48 | // api returns compact version. reload. |
| 49 | 49 | $remote = $this->api->upload("{$this->getParent()}/attachments", $file); |
| 50 | 50 | $this->data['gid'] = $remote['gid']; |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | const TYPE_LIKED = 'liked'; |
| 40 | 40 | const TYPE_TAGGED = 'added_to_tag'; |
| 41 | 41 | |
| 42 | - final public function __toString (): string { |
|
| 42 | + final public function __toString(): string { |
|
| 43 | 43 | return "stories/{$this->getGid()}"; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - final protected function _getDir (): string { |
|
| 46 | + final protected function _getDir(): string { |
|
| 47 | 47 | return "{$this->getTask()}/stories"; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function _getMap (): array { |
|
| 50 | + protected function _getMap(): array { |
|
| 51 | 51 | return [ |
| 52 | 52 | 'created_by' => User::class, |
| 53 | 53 | 'likes' => [User::class], |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | ]; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function isComment (): bool { |
|
| 58 | + final public function isComment(): bool { |
|
| 59 | 59 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function isEdited (): bool { |
|
| 62 | + public function isEdited(): bool { |
|
| 63 | 63 | return $this->_is('is_edited'); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function isPinned (): bool { |
|
| 66 | + public function isPinned(): bool { |
|
| 67 | 67 | return $this->_is('is_pinned'); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param bool $pinned |
| 72 | 72 | * @return $this |
| 73 | 73 | */ |
| 74 | - public function setPinned (bool $pinned) { |
|
| 74 | + public function setPinned(bool $pinned) { |
|
| 75 | 75 | return $this->_set('is_pinned', $pinned); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | const TYPE = 'tag'; |
| 28 | 28 | |
| 29 | - final public function __toString (): string { |
|
| 29 | + final public function __toString(): string { |
|
| 30 | 30 | return "tags/{$this->getGid()}"; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - final protected function _getDir (): string { |
|
| 33 | + final protected function _getDir(): string { |
|
| 34 | 34 | return 'tags'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - protected function _getMap (): array { |
|
| 37 | + protected function _getMap(): array { |
|
| 38 | 38 | return [ |
| 39 | 39 | 'followers' => [User::class], |
| 40 | 40 | 'workspace' => Workspace::class |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * @return Task[] |
| 46 | 46 | */ |
| 47 | - public function getTasks () { |
|
| 47 | + public function getTasks() { |
|
| 48 | 48 | return $this->loadAll(Task::class, "{$this}/tasks"); |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -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(); |