Passed
Push — master ( 22dd1f...d25a5e )
by y
02:00
created
src/Base/AbstractEntity/CreateTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
      *
16 16
      * @return string
17 17
      */
18
-    abstract protected function _getDir (): string;
18
+    abstract protected function _getDir(): string;
19 19
 
20 20
     /**
21 21
      * `POST`
22 22
      *
23 23
      * @return $this
24 24
      */
25
-    public function create () {
25
+    public function create() {
26 26
         /** @var Api $api */
27 27
         $api = $this->api;
28 28
         $remote = $api->post($this->_getDir(), $this->getDiff(), ['expand' => 'this']);
Please login to merge, or discard this patch.
src/Base/Data.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
     }
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      * @param array $args
47 47
      * @return mixed
48 48
      */
49
-    public function __call (string $method, array $args) {
49
+    public function __call(string $method, array $args) {
50 50
         static $cache = [];
51
-        if (!$call =& $cache[$method]) {
51
+        if (!$call = & $cache[$method]) {
52 52
             preg_match('/^(get|has|is|set)(.+)$/', $method, $call);
53 53
             $call[1] = '_' . $call[1];
54 54
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         return $this->{$call[1]}($call[2], ...$args);
59 59
     }
60 60
 
61
-    public function __debugInfo (): array {
61
+    public function __debugInfo(): array {
62 62
         return $this->data;
63 63
     }
64 64
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param string $key
71 71
      * @return mixed
72 72
      */
73
-    protected function _get (string $key) {
73
+    protected function _get(string $key) {
74 74
         return $this->data[$key] ?? null;
75 75
     }
76 76
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return array
84 84
      */
85
-    protected function _getMap (): array {
85
+    protected function _getMap(): array {
86 86
         return [];
87 87
     }
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param null|self|array $value
92 92
      * @return null|Data|Data[]
93 93
      */
94
-    protected function _getMapped ($class, $value) {
94
+    protected function _getMapped($class, $value) {
95 95
         // use empty|Data|Data[] as-is
96 96
         if (!$value or $value instanceof self or current($value) instanceof self) {
97 97
             return $value;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param string $key
130 130
      * @return bool
131 131
      */
132
-    protected function _has (string $key): bool {
132
+    protected function _has(string $key): bool {
133 133
         $value = $this->_get($key);
134 134
         if (isset($value)) {
135 135
             if (is_countable($value)) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param string $key
153 153
      * @return bool
154 154
      */
155
-    protected function _is (string $key): bool {
155
+    protected function _is(string $key): bool {
156 156
         return !empty($this->_get($key));
157 157
     }
158 158
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param mixed $value
166 166
      * @return $this
167 167
      */
168
-    protected function _set (string $key, $value) {
168
+    protected function _set(string $key, $value) {
169 169
         $this->data[$key] = $value;
170 170
         $this->diff[$key] = true;
171 171
         return $this;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param array $data
178 178
      * @return $this
179 179
      */
180
-    protected function _setData (array $data) {
180
+    protected function _setData(array $data) {
181 181
         $map = $this->_getMap();
182 182
         /** @var null|self|array $value */
183 183
         foreach (array_intersect_key($data, $map) as $key => $value) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      * @param array $data
196 196
      * @return mixed
197 197
      */
198
-    final protected function factory (string $class, array $data = []) {
198
+    final protected function factory(string $class, array $data = []) {
199 199
         return $this->api->factory($class, $this, $data);
200 200
     }
201 201
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @return array
206 206
      */
207
-    public function getDiff (): array {
207
+    public function getDiff(): array {
208 208
         $convert = function($each) use (&$convert) {
209 209
             // convert existing entities to gids
210 210
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @return bool
231 231
      */
232
-    final public function isDiff (): bool {
232
+    final public function isDiff(): bool {
233 233
         return (bool)$this->diff;
234 234
     }
235 235
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      * @see toArray()
238 238
      * @return array
239 239
      */
240
-    public function jsonSerialize (): array {
240
+    public function jsonSerialize(): array {
241 241
         return $this->toArray();
242 242
     }
243 243
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      * @param array $query
252 252
      * @return null|mixed|AbstractEntity
253 253
      */
254
-    final protected function load (string $class, string $path, array $query = []) {
254
+    final protected function load(string $class, string $path, array $query = []) {
255 255
         return $this->api->load($class, $this, $path, $query);
256 256
     }
257 257
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * @param int $pages
267 267
      * @return array|AbstractEntity[]
268 268
      */
269
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
269
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
270 270
         return $this->api->loadAll($class, $this, $path, $query, $pages);
271 271
     }
272 272
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return string
279 279
      */
280
-    public function serialize (): string {
280
+    public function serialize(): string {
281 281
         return serialize($this->toArray());
282 282
     }
283 283
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      *
287 287
      * @return array
288 288
      */
289
-    public function toArray (): array {
289
+    public function toArray(): array {
290 290
         if (!$this->api) {
291 291
             return $this->data;
292 292
         }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      *
313 313
      * @param $serialized
314 314
      */
315
-    public function unserialize ($serialized): void {
315
+    public function unserialize($serialized): void {
316 316
         $this->data = unserialize($serialized);
317 317
     }
318 318
 }
319 319
\ No newline at end of file
Please login to merge, or discard this patch.