@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return bool |
36 | 36 | * @internal pool |
37 | 37 | */ |
38 | - final public function __merge (self $entity): bool { |
|
38 | + final public function __merge(self $entity): bool { |
|
39 | 39 | $old = $this->toArray(); |
40 | 40 | $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff)); |
41 | 41 | return $this->toArray() !== $old; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return string |
48 | 48 | */ |
49 | - final public function __toString (): string { |
|
49 | + final public function __toString(): string { |
|
50 | 50 | return static::DIR . '/' . $this->getGid(); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $field |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - protected function _get (string $field) { |
|
59 | + protected function _get(string $field) { |
|
60 | 60 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
61 | 61 | $this->_reload($field); |
62 | 62 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @param string $field |
68 | 68 | */ |
69 | - protected function _reload (string $field): void { |
|
69 | + protected function _reload(string $field): void { |
|
70 | 70 | assert($this->hasGid()); |
71 | 71 | $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]); |
72 | 72 | assert(array_key_exists($field, $remote)); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->api->getPool()->add($this); |
75 | 75 | } |
76 | 76 | |
77 | - protected function _setData (array $data): void { |
|
77 | + protected function _setData(array $data): void { |
|
78 | 78 | // meaningless once the entity is being created. it's constant. |
79 | 79 | unset($data['resource_type'], $data['type']); |
80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @return null|string |
86 | 86 | */ |
87 | - final public function getGid (): ?string { |
|
87 | + final public function getGid(): ?string { |
|
88 | 88 | return $this->data['gid'] ?? null; |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return string[] |
95 | 95 | */ |
96 | - public function getPoolKeys () { |
|
96 | + public function getPoolKeys() { |
|
97 | 97 | return [$this->getGid(), (string)$this]; |
98 | 98 | } |
99 | 99 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return string |
104 | 104 | */ |
105 | - final public function getResourceType (): string { |
|
105 | + final public function getResourceType(): string { |
|
106 | 106 | return static::TYPE; |
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return bool |
111 | 111 | */ |
112 | - final public function hasGid (): bool { |
|
112 | + final public function hasGid(): bool { |
|
113 | 113 | return isset($this->data['gid']); |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return $this |
120 | 120 | */ |
121 | - public function reload () { |
|
121 | + public function reload() { |
|
122 | 122 | assert($this->hasGid()); |
123 | 123 | $remote = $this->api->get($this, ['opt_expand' => 'this']); |
124 | 124 | if (!isset($remote['gid'])) { // deleted? |