@@ -12,7 +12,7 @@ |
||
| 12 | 12 | * |
| 13 | 13 | * @return $this |
| 14 | 14 | */ |
| 15 | - public function update () { |
|
| 15 | + public function update() { |
|
| 16 | 16 | return $this->{'_save'}(); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -33,23 +33,23 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected $customField; |
| 35 | 35 | |
| 36 | - public function __construct (CustomField $customField, array $data = []) { |
|
| 36 | + public function __construct(CustomField $customField, array $data = []) { |
|
| 37 | 37 | parent::__construct($customField, $data); |
| 38 | 38 | $this->customField = $customField; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - final public function __toString (): string { |
|
| 41 | + final public function __toString(): string { |
|
| 42 | 42 | return "enum_options/{$this->getGid()}"; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - final protected function _getDir (): string { |
|
| 45 | + final protected function _getDir(): string { |
|
| 46 | 46 | return "{$this->customField}/enum_options"; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @return CustomField |
| 51 | 51 | */ |
| 52 | - public function getCustomField () { |
|
| 52 | + public function getCustomField() { |
|
| 53 | 53 | return $this->customField; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @param EnumOption $option |
| 59 | 59 | * @return $this |
| 60 | 60 | */ |
| 61 | - public function moveAfter (EnumOption $option) { |
|
| 61 | + public function moveAfter(EnumOption $option) { |
|
| 62 | 62 | $this->api->post("{$this->_getDir()}/insert", [ |
| 63 | 63 | 'after_enum_option' => $option->getGid(), |
| 64 | 64 | 'enum_option' => $this->getGid() |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param EnumOption $option |
| 73 | 73 | * @return $this |
| 74 | 74 | */ |
| 75 | - public function moveBefore (EnumOption $option) { |
|
| 75 | + public function moveBefore(EnumOption $option) { |
|
| 76 | 76 | $this->api->post("{$this->_getDir()}/insert", [ |
| 77 | 77 | 'before_enum_option' => $option->getGid(), |
| 78 | 78 | 'enum_option' => $this->getGid() |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * @return $this |
| 86 | 86 | */ |
| 87 | - public function moveFirst () { |
|
| 87 | + public function moveFirst() { |
|
| 88 | 88 | $first = $this->customField->getEnumOptions()[0]; |
| 89 | 89 | if ($first !== $this) { |
| 90 | 90 | $this->moveBefore($first); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * @return $this |
| 97 | 97 | */ |
| 98 | - public function moveLast () { |
|
| 98 | + public function moveLast() { |
|
| 99 | 99 | $options = $this->customField->getEnumOptions(); |
| 100 | 100 | $last = $options[count($options) - 1]; |
| 101 | 101 | if ($last !== $this) { |
@@ -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 | return $this->{'_set'}('workspace', $workspace); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | protected $task; |
| 26 | 26 | |
| 27 | - public function __construct (Task $task, array $data = []) { |
|
| 27 | + public function __construct(Task $task, array $data = []) { |
|
| 28 | 28 | parent::__construct($task, $data); |
| 29 | 29 | $this->task = $task; |
| 30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param mixed $value |
| 37 | 37 | * @return $this |
| 38 | 38 | */ |
| 39 | - protected function _set (string $field, $value) { |
|
| 39 | + protected function _set(string $field, $value) { |
|
| 40 | 40 | $this->task->diff['external'] = true; |
| 41 | 41 | return parent::_set($field, $value); |
| 42 | 42 | } |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return null|bool|number|string|array |
| 48 | 48 | */ |
| 49 | - public function getDataJsonDecoded () { |
|
| 49 | + public function getDataJsonDecoded() { |
|
| 50 | 50 | if (strlen($data = $this->getData())) { |
| 51 | - return json_decode($data, true, 512, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
| 51 | + return json_decode($data, true, 512, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
| 52 | 52 | } |
| 53 | 53 | return null; |
| 54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param mixed $data |
| 61 | 61 | * @return $this |
| 62 | 62 | */ |
| 63 | - public function setDataJsonEncoded ($data) { |
|
| 63 | + public function setDataJsonEncoded($data) { |
|
| 64 | 64 | if (isset($data)) { |
| 65 | 65 | return $this->setData(json_encode($data, JSON_THROW_ON_ERROR)); |
| 66 | 66 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @param PSR16 $psr |
| 36 | 36 | */ |
| 37 | - public function __construct (PSR16 $psr) { |
|
| 37 | + public function __construct(PSR16 $psr) { |
|
| 38 | 38 | $this->psr = $psr; |
| 39 | 39 | $this->ttl = new DateInterval('PT1H'); |
| 40 | 40 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string $key |
| 44 | 44 | * @throws InvalidArgumentException |
| 45 | 45 | */ |
| 46 | - protected function _delete (string $key) { |
|
| 46 | + protected function _delete(string $key) { |
|
| 47 | 47 | $this->psr->delete('asana/' . $key); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @return null|string|AbstractEntity |
| 53 | 53 | * @throws InvalidArgumentException |
| 54 | 54 | */ |
| 55 | - protected function _get (string $key) { |
|
| 55 | + protected function _get(string $key) { |
|
| 56 | 56 | return $this->psr->get('asana/' . $key); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param mixed $value |
| 62 | 62 | * @throws InvalidArgumentException |
| 63 | 63 | */ |
| 64 | - protected function _set (string $key, $value) { |
|
| 64 | + protected function _set(string $key, $value) { |
|
| 65 | 65 | $this->psr->set('asana/' . $key, $value, $this->ttl); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return bool |
| 71 | 71 | * @throws InvalidArgumentException |
| 72 | 72 | */ |
| 73 | - public function add (AbstractEntity $entity): bool { |
|
| 73 | + public function add(AbstractEntity $entity): bool { |
|
| 74 | 74 | if (parent::add($entity)) { |
| 75 | 75 | $this->_set($entity->getGid(), $entity); |
| 76 | 76 | return true; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string[] $keys |
| 84 | 84 | * @throws InvalidArgumentException |
| 85 | 85 | */ |
| 86 | - protected function addKeys (string $gid, array $keys): void { |
|
| 86 | + protected function addKeys(string $gid, array $keys): void { |
|
| 87 | 87 | parent::addKeys($gid, $keys); |
| 88 | 88 | // stash gid refs |
| 89 | 89 | foreach ($keys as $key) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @return null|AbstractEntity |
| 101 | 101 | * @throws InvalidArgumentException |
| 102 | 102 | */ |
| 103 | - public function get (string $key, $caller, Closure $factory) { |
|
| 103 | + public function get(string $key, $caller, Closure $factory) { |
|
| 104 | 104 | // POOL MISS && CACHE HIT |
| 105 | 105 | if (!isset($this->gids[$key]) and $entity = $this->_get($key)) { |
| 106 | 106 | if ($entity instanceof AbstractEntity) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * @return DateInterval |
| 125 | 125 | */ |
| 126 | - public function getTtl () { |
|
| 126 | + public function getTtl() { |
|
| 127 | 127 | return $this->ttl; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param AbstractEntity $entity |
| 132 | 132 | * @throws InvalidArgumentException |
| 133 | 133 | */ |
| 134 | - public function remove (AbstractEntity $entity): void { |
|
| 134 | + public function remove(AbstractEntity $entity): void { |
|
| 135 | 135 | parent::remove($entity); |
| 136 | 136 | foreach ($entity->getCacheKeys() as $key) { |
| 137 | 137 | $this->_delete($key); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param DateInterval $ttl |
| 143 | 143 | * @return $this |
| 144 | 144 | */ |
| 145 | - public function setTtl (DateInterval $ttl) { |
|
| 145 | + public function setTtl(DateInterval $ttl) { |
|
| 146 | 146 | $this->ttl = $ttl; |
| 147 | 147 | return $this; |
| 148 | 148 | } |
@@ -18,13 +18,13 @@ |
||
| 18 | 18 | 'user' => User::class |
| 19 | 19 | ]; |
| 20 | 20 | |
| 21 | - protected function _setData (array $data): void { |
|
| 21 | + protected function _setData(array $data): void { |
|
| 22 | 22 | // useless. likes aren't entities. |
| 23 | 23 | unset($data['gid'], $data['resource_type']); |
| 24 | 24 | parent::_setData($data); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - final public function getResourceType (): string { |
|
| 27 | + final public function getResourceType(): string { |
|
| 28 | 28 | return self::TYPE; |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -44,45 +44,45 @@ discard block |
||
| 44 | 44 | 'target' => Task::class |
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | - final public function __toString (): string { |
|
| 47 | + final public function __toString(): string { |
|
| 48 | 48 | return "stories/{$this->getGid()}"; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - final protected function _getDir (): string { |
|
| 51 | + final protected function _getDir(): string { |
|
| 52 | 52 | return "{$this->getTarget()}/stories"; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - protected function _setData (array $data): void { |
|
| 55 | + protected function _setData(array $data): void { |
|
| 56 | 56 | // hearts are deprecated in favor of likes |
| 57 | 57 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
| 58 | 58 | parent::_setData($data); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - final public function isAssignment (): bool { |
|
| 61 | + final public function isAssignment(): bool { |
|
| 62 | 62 | return $this->getResourceSubtype() === self::TYPE_ASSIGNED; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - final public function isComment (): bool { |
|
| 65 | + final public function isComment(): bool { |
|
| 66 | 66 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - final public function isDueDate (): bool { |
|
| 69 | + final public function isDueDate(): bool { |
|
| 70 | 70 | return $this->getResourceSubtype() === self::TYPE_DUE_DATE_CHANGED; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function isEdited (): bool { |
|
| 73 | + public function isEdited(): bool { |
|
| 74 | 74 | return $this->_is('is_edited'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function isFromApi (): bool { |
|
| 77 | + public function isFromApi(): bool { |
|
| 78 | 78 | return $this->getSource() === 'api'; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function isFromWeb (): bool { |
|
| 81 | + public function isFromWeb(): bool { |
|
| 82 | 82 | return $this->getSource() === 'web'; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function isPinned (): bool { |
|
| 85 | + public function isPinned(): bool { |
|
| 86 | 86 | return $this->_is('is_pinned'); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param bool $pinned |
| 91 | 91 | * @return $this |
| 92 | 92 | */ |
| 93 | - public function setPinned (bool $pinned) { |
|
| 93 | + public function setPinned(bool $pinned) { |
|
| 94 | 94 | return $this->_set('is_pinned', $pinned); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected $types = []; |
| 47 | 47 | |
| 48 | - public function __construct (Task $task, array $data = []) { |
|
| 48 | + public function __construct(Task $task, array $data = []) { |
|
| 49 | 49 | $this->task = $task; |
| 50 | 50 | parent::__construct($task, $data); |
| 51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @param array $data |
| 57 | 57 | */ |
| 58 | - protected function _setData (array $data): void { |
|
| 58 | + protected function _setData(array $data): void { |
|
| 59 | 59 | $this->index = []; |
| 60 | 60 | $this->optionNames = []; |
| 61 | 61 | $keys = array_flip(['gid', 'name', 'type', 'enum_options', 'enum_value', 'text_value', 'number_value']); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * @return int |
| 79 | 79 | */ |
| 80 | - public function count () { |
|
| 80 | + public function count() { |
|
| 81 | 81 | return count($this->data); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | * @param string $enumGid |
| 86 | 86 | * @return null|string |
| 87 | 87 | */ |
| 88 | - public function getCurrentOptionName (string $enumGid): ?string { |
|
| 88 | + public function getCurrentOptionName(string $enumGid): ?string { |
|
| 89 | 89 | return $this->getOptionName($enumGid, $this[$enumGid]); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function getDiff (): array { |
|
| 92 | + public function getDiff(): array { |
|
| 93 | 93 | $diff = []; |
| 94 | 94 | foreach (array_keys($this->diff) as $index) { |
| 95 | 95 | $gid = $this->index[$index]; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * @return Generator |
| 103 | 103 | */ |
| 104 | - public function getIterator () { |
|
| 104 | + public function getIterator() { |
|
| 105 | 105 | foreach (array_keys($this->index) as $gid) { |
| 106 | 106 | yield $gid => $this[$gid]; |
| 107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $fieldGid |
| 112 | 112 | * @return null|string |
| 113 | 113 | */ |
| 114 | - public function getName (string $fieldGid): ?string { |
|
| 114 | + public function getName(string $fieldGid): ?string { |
|
| 115 | 115 | return $this->data[$this->index[$fieldGid]]['name']; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return string[] |
| 122 | 122 | */ |
| 123 | - public function getNames () { |
|
| 123 | + public function getNames() { |
|
| 124 | 124 | return array_column($this->data, 'name', 'gid'); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param string $optionGid |
| 130 | 130 | * @return null|string |
| 131 | 131 | */ |
| 132 | - public function getOptionName (string $enumGid, string $optionGid): ?string { |
|
| 132 | + public function getOptionName(string $enumGid, string $optionGid): ?string { |
|
| 133 | 133 | return $this->optionNames[$enumGid][$optionGid]; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $enumGid |
| 140 | 140 | * @return string[] |
| 141 | 141 | */ |
| 142 | - public function getOptionNames (string $enumGid) { |
|
| 142 | + public function getOptionNames(string $enumGid) { |
|
| 143 | 143 | return $this->optionNames[$enumGid]; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $fieldGid |
| 148 | 148 | * @return null|number|string |
| 149 | 149 | */ |
| 150 | - public function getValue (string $fieldGid) { |
|
| 150 | + public function getValue(string $fieldGid) { |
|
| 151 | 151 | $field = $this->data[$this->index[$fieldGid]]; |
| 152 | 152 | if ($field['type'] === CustomField::TYPE_ENUM) { |
| 153 | 153 | return $field['enum_value']['gid']; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string $fieldGid |
| 160 | 160 | * @return bool |
| 161 | 161 | */ |
| 162 | - public function offsetExists ($fieldGid) { |
|
| 162 | + public function offsetExists($fieldGid) { |
|
| 163 | 163 | return array_key_exists($this->index[$fieldGid], $this->data); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param string $fieldGid |
| 168 | 168 | * @return null|number|string |
| 169 | 169 | */ |
| 170 | - public function offsetGet ($fieldGid) { |
|
| 170 | + public function offsetGet($fieldGid) { |
|
| 171 | 171 | return $this->getValue($fieldGid); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param string $fieldGid |
| 176 | 176 | * @param null|number|string $value |
| 177 | 177 | */ |
| 178 | - public function offsetSet ($fieldGid, $value) { |
|
| 178 | + public function offsetSet($fieldGid, $value) { |
|
| 179 | 179 | $this->setValue($fieldGid, $value); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @param string $fieldGid |
| 186 | 186 | */ |
| 187 | - public function offsetUnset ($fieldGid) { |
|
| 187 | + public function offsetUnset($fieldGid) { |
|
| 188 | 188 | $this->setValue($fieldGid, null); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param null|number|string $value |
| 194 | 194 | * @return $this |
| 195 | 195 | */ |
| 196 | - public function setValue (string $fieldGid, $value) { |
|
| 196 | + public function setValue(string $fieldGid, $value) { |
|
| 197 | 197 | $i = $this->index[$fieldGid]; |
| 198 | 198 | $type = $this->data[$i]['type']; |
| 199 | 199 | if ($type === CustomField::TYPE_ENUM) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | 'custom_field' => CustomField::class, |
| 20 | 20 | ]; |
| 21 | 21 | |
| 22 | - protected function _setData (array $data): void { |
|
| 22 | + protected function _setData(array $data): void { |
|
| 23 | 23 | // useless, settings aren't entities |
| 24 | 24 | unset($data['gid'], $data['resource_type']); |
| 25 | 25 | // deprecated |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | parent::_setData($data); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - final public function getResourceType (): string { |
|
| 32 | + final public function getResourceType(): string { |
|
| 33 | 33 | return self::TYPE; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |