@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * @param null|string $value |
27 | 27 | * @return null|string |
28 | 28 | */ |
29 | - protected function _toEnumOptionGid ($value) { |
|
29 | + protected function _toEnumOptionGid($value) { |
|
30 | 30 | return $this->getEnumOptionValues()[$value] ?? $value; |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return string |
35 | 35 | */ |
36 | - public function getCurrentOptionName () { |
|
36 | + public function getCurrentOptionName() { |
|
37 | 37 | return $this->getEnumOptionNames()[$this->getValue()]; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string[] |
44 | 44 | */ |
45 | - public function getEnumOptionNames () { |
|
45 | + public function getEnumOptionNames() { |
|
46 | 46 | static $names = []; // shared |
47 | 47 | $gid = $this->data['gid']; |
48 | 48 | return $names[$gid] ?? $names[$gid] = array_column($this->data['enum_options'], 'name', 'gid'); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return string[] |
55 | 55 | */ |
56 | - public function getEnumOptionValues () { |
|
56 | + public function getEnumOptionValues() { |
|
57 | 57 | static $values = []; // shared |
58 | 58 | $gid = $this->data['gid']; |
59 | 59 | return $values[$gid] ?? $values[$gid] = array_column($this->data['enum_options'], 'gid', 'name'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @return null|number|string |
64 | 64 | */ |
65 | - public function getValue () { |
|
65 | + public function getValue() { |
|
66 | 66 | $type = $this->data['type']; |
67 | 67 | if ($type === CustomField::TYPE_ENUM) { |
68 | 68 | return $this->data['enum_value']['gid'] ?? null; |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | return $this->data["{$type}_value"]; |
71 | 71 | } |
72 | 72 | |
73 | - final public function isEnum (): bool { |
|
73 | + final public function isEnum(): bool { |
|
74 | 74 | return $this->getType() === CustomField::TYPE_ENUM; |
75 | 75 | } |
76 | 76 | |
77 | - final public function isNumber (): bool { |
|
77 | + final public function isNumber(): bool { |
|
78 | 78 | return $this->getType() === CustomField::TYPE_NUMBER; |
79 | 79 | } |
80 | 80 | |
81 | - final public function isText (): bool { |
|
81 | + final public function isText(): bool { |
|
82 | 82 | return $this->getType() === CustomField::TYPE_TEXT; |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param null|number|string $value |
87 | 87 | * @return $this |
88 | 88 | */ |
89 | - public function setValue ($value) { |
|
89 | + public function setValue($value) { |
|
90 | 90 | $type = $this->data['type']; |
91 | 91 | $this->diff["{$type}_value"] = true; |
92 | 92 | if ($type === CustomField::TYPE_ENUM) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function toArray (): array { |
|
105 | + public function toArray(): array { |
|
106 | 106 | // only strip if needed. |
107 | 107 | if (!isset($this->data['resource_subtype'])) { |
108 | 108 | return $this->data; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @param PSR16 $psr |
35 | 35 | */ |
36 | - public function __construct (PSR16 $psr) { |
|
36 | + public function __construct(PSR16 $psr) { |
|
37 | 37 | $this->psr = $psr; |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param AbstractEntity $entity |
42 | 42 | * @throws CacheException |
43 | 43 | */ |
44 | - protected function _add (AbstractEntity $entity): void { |
|
44 | + protected function _add(AbstractEntity $entity): void { |
|
45 | 45 | $this->psr->set("asana/{$entity->getGid()}", $entity, $this->_getTtl($entity)); |
46 | 46 | parent::_add($entity); |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param string[] $keys |
52 | 52 | * @throws CacheException |
53 | 53 | */ |
54 | - protected function _addKeys (AbstractEntity $entity, ...$keys): void { |
|
54 | + protected function _addKeys(AbstractEntity $entity, ...$keys): void { |
|
55 | 55 | $gid = $entity->getGid(); |
56 | 56 | $ttl = $this->_getTtl($entity); |
57 | 57 | foreach ($keys as $key) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return null|AbstractEntity |
69 | 69 | * @throws CacheException |
70 | 70 | */ |
71 | - protected function _get (string $key, $caller) { |
|
71 | + protected function _get(string $key, $caller) { |
|
72 | 72 | /** @var AbstractEntity $entity */ |
73 | 73 | if (!$entity = parent::_get($key, $caller) and $entity = $this->psr->get("asana/{$key}")) { |
74 | 74 | if (is_string($entity)) { // gid ref |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return $entity; |
85 | 85 | } |
86 | 86 | |
87 | - protected function _getTtl (AbstractEntity $entity): int { |
|
87 | + protected function _getTtl(AbstractEntity $entity): int { |
|
88 | 88 | if ($entity instanceof ImmutableInterface) { |
89 | 89 | return strtotime('tomorrow') - time(); |
90 | 90 | } |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | * @throws CacheException |
98 | 98 | */ |
99 | - protected function _has (string $key): bool { |
|
99 | + protected function _has(string $key): bool { |
|
100 | 100 | return parent::_has($key) or $this->psr->has("asana/{$key}"); |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * @return int |
105 | 105 | */ |
106 | - public function getTtl (): int { |
|
106 | + public function getTtl(): int { |
|
107 | 107 | return $this->ttl; |
108 | 108 | } |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string[] $keys |
112 | 112 | * @throws CacheException |
113 | 113 | */ |
114 | - public function remove (array $keys): void { |
|
114 | + public function remove(array $keys): void { |
|
115 | 115 | parent::remove($keys); |
116 | 116 | foreach ($keys as $key) { |
117 | 117 | $this->psr->delete("asana/{$key}"); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param int $ttl |
123 | 123 | * @return $this |
124 | 124 | */ |
125 | - public function setTtl (int $ttl) { |
|
125 | + public function setTtl(int $ttl) { |
|
126 | 126 | $this->ttl = $ttl; |
127 | 127 | return $this; |
128 | 128 | } |