@@ -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 |
@@ -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 | * @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); |
@@ -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(); |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | $this->data[$key] = array_values(array_unique($this->data[$key])); |
| 60 | 60 | if ($force) { |
| 61 | 61 | $this->diff[$key] = true; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | $this->api->getCache()->add($this); |
| 65 | 64 | } |
| 66 | 65 | } |
@@ -110,8 +109,7 @@ discard block |
||
| 110 | 109 | $map = $this->_getMap(); |
| 111 | 110 | $this->data[$key] = isset($map[$key]) ? $this->_getMapped($map[$key], $value) : $value; |
| 112 | 111 | unset($this->diff[$key]); |
| 113 | - } |
|
| 114 | - else { |
|
| 112 | + } else { |
|
| 115 | 113 | $this->_setData($this->api->get($this, [], ['expand' => 'this'])); |
| 116 | 114 | } |
| 117 | 115 | $this->api->getCache()->add($this); |
@@ -291,11 +291,9 @@ |
||
| 291 | 291 | $dehydrate = function($each) use (&$dehydrate) { |
| 292 | 292 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
| 293 | 293 | return $each->getGid(); |
| 294 | - } |
|
| 295 | - elseif ($each instanceof self) { |
|
| 294 | + } elseif ($each instanceof self) { |
|
| 296 | 295 | return $each->toArray(); |
| 297 | - } |
|
| 298 | - elseif (is_array($each)) { |
|
| 296 | + } elseif (is_array($each)) { |
|
| 299 | 297 | return array_map($dehydrate, $each); |
| 300 | 298 | } |
| 301 | 299 | return $each; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param Api|Data $caller |
| 31 | 31 | * @param array $data |
| 32 | 32 | */ |
| 33 | - public function __construct ($caller, array $data = []) { |
|
| 33 | + public function __construct($caller, array $data = []) { |
|
| 34 | 34 | $this->api = $caller instanceof self ? $caller->api : $caller; |
| 35 | 35 | $this->_setData($data); |
| 36 | 36 | } |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * @uses _is() |
| 45 | 45 | * @uses _set() |
| 46 | 46 | */ |
| 47 | - public function __call (string $method, array $args) { |
|
| 47 | + public function __call(string $method, array $args) { |
|
| 48 | 48 | static $cache = []; |
| 49 | - if (!$call =& $cache[$method]) { |
|
| 49 | + if (!$call = & $cache[$method]) { |
|
| 50 | 50 | preg_match('/^(get|has|is|set)(.+)$/', $method, $call); |
| 51 | 51 | $call[1] = '_' . $call[1]; |
| 52 | 52 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return $this->{$call[1]}($call[2], ...$args); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function __debugInfo (): array { |
|
| 59 | + public function __debugInfo(): array { |
|
| 60 | 60 | return $this->data; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string $key |
| 69 | 69 | * @return mixed |
| 70 | 70 | */ |
| 71 | - protected function _get (string $key) { |
|
| 71 | + protected function _get(string $key) { |
|
| 72 | 72 | return $this->data[$key] ?? null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - protected function _getMap (): array { |
|
| 83 | + protected function _getMap(): array { |
|
| 84 | 84 | return []; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param null|self|array $value |
| 90 | 90 | * @return null|Data|Data[] |
| 91 | 91 | */ |
| 92 | - protected function _getMapped ($class, $value) { |
|
| 92 | + protected function _getMapped($class, $value) { |
|
| 93 | 93 | // use empty|Data|Data[] as-is |
| 94 | 94 | if (!$value or $value instanceof self or current($value) instanceof self) { |
| 95 | 95 | return $value; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @return array |
| 124 | 124 | */ |
| 125 | - protected function _getPatch (): array { |
|
| 125 | + protected function _getPatch(): array { |
|
| 126 | 126 | $convert = function($each) use (&$convert) { |
| 127 | 127 | // convert existing entities to gids |
| 128 | 128 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param string $key |
| 153 | 153 | * @return bool |
| 154 | 154 | */ |
| 155 | - protected function _has (string $key): bool { |
|
| 155 | + protected function _has(string $key): bool { |
|
| 156 | 156 | $value = $this->_get($key); |
| 157 | 157 | if (isset($value)) { |
| 158 | 158 | if (is_countable($value)) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param string $key |
| 176 | 176 | * @return bool |
| 177 | 177 | */ |
| 178 | - protected function _is (string $key): bool { |
|
| 178 | + protected function _is(string $key): bool { |
|
| 179 | 179 | return !empty($this->_get($key)); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @param mixed $value |
| 189 | 189 | * @return $this |
| 190 | 190 | */ |
| 191 | - protected function _set (string $key, $value) { |
|
| 191 | + protected function _set(string $key, $value) { |
|
| 192 | 192 | $this->data[$key] = $value; |
| 193 | 193 | $this->diff[$key] = true; |
| 194 | 194 | return $this; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param array $data |
| 201 | 201 | * @return $this |
| 202 | 202 | */ |
| 203 | - protected function _setData (array $data) { |
|
| 203 | + protected function _setData(array $data) { |
|
| 204 | 204 | $map = $this->_getMap(); |
| 205 | 205 | /** @var null|self|array $value */ |
| 206 | 206 | foreach (array_intersect_key($data, $map) as $key => $value) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param array $data |
| 219 | 219 | * @return mixed |
| 220 | 220 | */ |
| 221 | - final protected function factory (string $class, array $data = []) { |
|
| 221 | + final protected function factory(string $class, array $data = []) { |
|
| 222 | 222 | return $this->api->factory($class, $this, $data); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return bool |
| 229 | 229 | */ |
| 230 | - final public function isDiff (): bool { |
|
| 230 | + final public function isDiff(): bool { |
|
| 231 | 231 | return (bool)$this->diff; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see toArray() |
| 236 | 236 | * @return array |
| 237 | 237 | */ |
| 238 | - public function jsonSerialize (): array { |
|
| 238 | + public function jsonSerialize(): array { |
|
| 239 | 239 | return $this->toArray(); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @param array $query |
| 250 | 250 | * @return null|mixed|AbstractEntity |
| 251 | 251 | */ |
| 252 | - final protected function load (string $class, string $path, array $query = []) { |
|
| 252 | + final protected function load(string $class, string $path, array $query = []) { |
|
| 253 | 253 | return $this->api->load($class, $this, $path, $query); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param int $pages |
| 265 | 265 | * @return array|AbstractEntity[] |
| 266 | 266 | */ |
| 267 | - final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) { |
|
| 267 | + final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) { |
|
| 268 | 268 | return $this->api->loadAll($class, $this, $path, $query, $pages); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return string |
| 277 | 277 | */ |
| 278 | - public function serialize (): string { |
|
| 278 | + public function serialize(): string { |
|
| 279 | 279 | return serialize($this->toArray()); |
| 280 | 280 | } |
| 281 | 281 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | - public function toArray (): array { |
|
| 287 | + public function toArray(): array { |
|
| 288 | 288 | if (!$this->api) { |
| 289 | 289 | return $this->data; |
| 290 | 290 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @param $serialized |
| 312 | 312 | */ |
| 313 | - public function unserialize ($serialized): void { |
|
| 313 | + public function unserialize($serialized): void { |
|
| 314 | 314 | $this->data = unserialize($serialized); |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -30,15 +30,15 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | const TYPE = 'portfolio'; |
| 32 | 32 | |
| 33 | - final public function __toString (): string { |
|
| 33 | + final public function __toString(): string { |
|
| 34 | 34 | return "portfolios/{$this->getGid()}"; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - final protected function _getDir (): string { |
|
| 37 | + final protected function _getDir(): string { |
|
| 38 | 38 | return 'portfolios'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - protected function _getMap (): array { |
|
| 41 | + protected function _getMap(): array { |
|
| 42 | 42 | return [ |
| 43 | 43 | 'created_by' => User::class, |
| 44 | 44 | 'owner' => User::class, |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param Project $item |
| 53 | 53 | * @return $this |
| 54 | 54 | */ |
| 55 | - public function addItem (Project $item) { |
|
| 55 | + public function addItem(Project $item) { |
|
| 56 | 56 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
| 57 | 57 | return $this; |
| 58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param User $user |
| 62 | 62 | * @return $this |
| 63 | 63 | */ |
| 64 | - public function addMember (User $user) { |
|
| 64 | + public function addMember(User $user) { |
|
| 65 | 65 | return $this->addMembers([$user]); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param User[] $users |
| 70 | 70 | * @return $this |
| 71 | 71 | */ |
| 72 | - public function addMembers (array $users) { |
|
| 72 | + public function addMembers(array $users) { |
|
| 73 | 73 | if ($this->hasGid()) { |
| 74 | 74 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
| 75 | 75 | $this->_merge('members', $users); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @after-create |
| 85 | 85 | * @return Project[] |
| 86 | 86 | */ |
| 87 | - public function getItems () { |
|
| 87 | + public function getItems() { |
|
| 88 | 88 | return $this->loadAll(Project::class, "{$this}/items"); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param Project $item |
| 94 | 94 | * @return $this |
| 95 | 95 | */ |
| 96 | - public function removeItem (Project $item) { |
|
| 96 | + public function removeItem(Project $item) { |
|
| 97 | 97 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param User $user |
| 103 | 103 | * @return $this |
| 104 | 104 | */ |
| 105 | - public function removeMember (User $user) { |
|
| 105 | + public function removeMember(User $user) { |
|
| 106 | 106 | return $this->removeMembers([$user]); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param User[] $users |
| 111 | 111 | * @return $this |
| 112 | 112 | */ |
| 113 | - public function removeMembers (array $users) { |
|
| 113 | + public function removeMembers(array $users) { |
|
| 114 | 114 | if ($this->hasGid()) { |
| 115 | 115 | $this->api->post("{$this}/removeMembers", ['members' => static::_getGids($users)]); |
| 116 | 116 | } |
@@ -73,8 +73,7 @@ |
||
| 73 | 73 | if ($this->hasGid()) { |
| 74 | 74 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
| 75 | 75 | $this->_merge('members', $users); |
| 76 | - } |
|
| 77 | - else { |
|
| 76 | + } else { |
|
| 78 | 77 | $this->_merge('members', $users, true); |
| 79 | 78 | } |
| 80 | 79 | return $this; |