Passed
Push — master ( 097ab9...fbd180 )
by y
02:12
created
src/Base/AbstractEntity.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @return string
24 24
      */
25
-    abstract public function __toString (): string;
25
+    abstract public function __toString(): string;
26 26
 
27 27
     /**
28 28
      * Maps lazy-loaded / reloadable mapped {@see Data} to their proper expanded field expression.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param AbstractEntity $entity
43 43
      * @internal
44 44
      */
45
-    public function __set (string $from, self $entity) {
45
+    public function __set(string $from, self $entity) {
46 46
         if ($from === Cache::class and $entity !== $this) {
47 47
             foreach ($entity->data as $field => $value) {
48 48
                 if (!isset($this->diff[$field])) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @return $this
61 61
      * @internal
62 62
      */
63
-    protected function _addWithPost (string $addPath, array $data, string $field, array $diff) {
63
+    protected function _addWithPost(string $addPath, array $data, string $field, array $diff) {
64 64
         if ($this->hasGid()) {
65 65
             return $this->_setWithPost($addPath, $data, $field);
66 66
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @internal
74 74
      */
75
-    protected function _cache (): void {
75
+    protected function _cache(): void {
76 76
         $this->api->getCache()->add($this);
77 77
     }
78 78
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @internal
83 83
      */
84
-    protected function _delete (): void {
84
+    protected function _delete(): void {
85 85
         $this->api->delete($this);
86 86
         $this->api->getCache()->remove($this);
87 87
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string $field
93 93
      * @return mixed
94 94
      */
95
-    protected function _get (string $field) {
95
+    protected function _get(string $field) {
96 96
         if (!array_key_exists($field, $this->data) and $this->hasGid()) {
97 97
             $this->reload($field);
98 98
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * @return $this
108 108
      * @internal
109 109
      */
110
-    protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) {
110
+    protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) {
111 111
         if ($this->hasGid()) {
112 112
             return $this->_setWithPost($rmPath, $data, $field);
113 113
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @return $this
125 125
      * @internal
126 126
      */
127
-    protected function _save (string $dir = null) {
127
+    protected function _save(string $dir = null) {
128 128
         if (isset($dir)) {
129 129
             $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']);
130 130
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         return $this;
141 141
     }
142 142
 
143
-    protected function _setData (array $data): void {
143
+    protected function _setData(array $data): void {
144 144
         // make sure gid is consistently null|string across all entities.
145 145
         $data['gid'] = empty($data['gid']) ? null : (string)$data['gid'];
146 146
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @return $this
161 161
      * @internal
162 162
      */
163
-    protected function _setWithPost (string $path, array $data, string $field, $value = null) {
163
+    protected function _setWithPost(string $path, array $data, string $field, $value = null) {
164 164
         if ($this->hasGid()) {
165 165
             /** @var array $remote */
166 166
             $remote = $this->api->post($path, $data, ['fields' => static::$optFields[$field] ?? $field]);
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
      *
179 179
      * @return string[]
180 180
      */
181
-    public function getCacheKeys () {
181
+    public function getCacheKeys() {
182 182
         return [$this->getGid(), (string)$this];
183 183
     }
184 184
 
185 185
     /**
186 186
      * @return null|string
187 187
      */
188
-    final public function getGid (): ?string {
188
+    final public function getGid(): ?string {
189 189
         return $this->data['gid'];
190 190
     }
191 191
 
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
      *
195 195
      * @return string
196 196
      */
197
-    final public function getResourceType (): string {
197
+    final public function getResourceType(): string {
198 198
         return $this::TYPE;
199 199
     }
200 200
 
201 201
     /**
202 202
      * @return bool
203 203
      */
204
-    final public function hasGid (): bool {
204
+    final public function hasGid(): bool {
205 205
         return isset($this->data['gid']);
206 206
     }
207 207
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * @param string $field
213 213
      * @return $this
214 214
      */
215
-    public function reload (string $field = null) {
215
+    public function reload(string $field = null) {
216 216
         if (!$this->hasGid()) {
217 217
             throw new LogicException(static::class . " has no GID, it can't be reloaded.");
218 218
         }
Please login to merge, or discard this patch.