Passed
Push — master ( 5c8b3b...44149e )
by y
01:42
created
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
     }
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      * @uses _is()
45 45
      * @uses _set()
46 46
      */
47
-    public function __call (string $method, array $args) {
47
+    public function __call(string $method, array $args) {
48 48
         static $cache = [];
49
-        if (!$call =& $cache[$method]) {
49
+        if (!$call = & $cache[$method]) {
50 50
             preg_match('/^(get|has|is|set)(.+)$/', $method, $call);
51 51
             $call[1] = '_' . $call[1];
52 52
             $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         return $this->{$call[1]}($call[2], ...$args);
57 57
     }
58 58
 
59
-    public function __debugInfo (): array {
59
+    public function __debugInfo(): array {
60 60
         return $this->data;
61 61
     }
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param string $key
69 69
      * @return mixed
70 70
      */
71
-    protected function _get (string $key) {
71
+    protected function _get(string $key) {
72 72
         return $this->data[$key] ?? null;
73 73
     }
74 74
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return array
82 82
      */
83
-    protected function _getMap (): array {
83
+    protected function _getMap(): array {
84 84
         return [];
85 85
     }
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param null|self|array $value
90 90
      * @return null|Data|Data[]
91 91
      */
92
-    protected function _getMapped ($class, $value) {
92
+    protected function _getMapped($class, $value) {
93 93
         // use empty|Data|Data[] as-is
94 94
         if (!$value or $value instanceof self or current($value) instanceof self) {
95 95
             return $value;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return array
124 124
      */
125
-    protected function _getPatch (): array {
125
+    protected function _getPatch(): array {
126 126
         $convert = function($each) use (&$convert) {
127 127
             // convert existing entities to gids
128 128
             if ($each instanceof AbstractEntity and $each->hasGid()) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param string $key
153 153
      * @return bool
154 154
      */
155
-    protected function _has (string $key): bool {
155
+    protected function _has(string $key): bool {
156 156
         $value = $this->_get($key);
157 157
         if (isset($value)) {
158 158
             if (is_countable($value)) {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * @param string $key
176 176
      * @return bool
177 177
      */
178
-    protected function _is (string $key): bool {
178
+    protected function _is(string $key): bool {
179 179
         return !empty($this->_get($key));
180 180
     }
181 181
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      * @param mixed $value
189 189
      * @return $this
190 190
      */
191
-    protected function _set (string $key, $value) {
191
+    protected function _set(string $key, $value) {
192 192
         $this->data[$key] = $value;
193 193
         $this->diff[$key] = true;
194 194
         return $this;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param array $data
201 201
      * @return $this
202 202
      */
203
-    protected function _setData (array $data) {
203
+    protected function _setData(array $data) {
204 204
         $map = $this->_getMap();
205 205
         /** @var null|self|array $value */
206 206
         foreach (array_intersect_key($data, $map) as $key => $value) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param array $data
219 219
      * @return mixed
220 220
      */
221
-    final protected function factory (string $class, array $data = []) {
221
+    final protected function factory(string $class, array $data = []) {
222 222
         return $this->api->factory($class, $this, $data);
223 223
     }
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      *
228 228
      * @return bool
229 229
      */
230
-    final public function isDiff (): bool {
230
+    final public function isDiff(): bool {
231 231
         return (bool)$this->diff;
232 232
     }
233 233
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @see toArray()
236 236
      * @return array
237 237
      */
238
-    public function jsonSerialize (): array {
238
+    public function jsonSerialize(): array {
239 239
         return $this->toArray();
240 240
     }
241 241
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param array $query
250 250
      * @return null|mixed|AbstractEntity
251 251
      */
252
-    final protected function load (string $class, string $path, array $query = []) {
252
+    final protected function load(string $class, string $path, array $query = []) {
253 253
         return $this->api->load($class, $this, $path, $query);
254 254
     }
255 255
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @param int $pages
265 265
      * @return array|AbstractEntity[]
266 266
      */
267
-    final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) {
267
+    final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) {
268 268
         return $this->api->loadAll($class, $this, $path, $query, $pages);
269 269
     }
270 270
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      *
276 276
      * @return string
277 277
      */
278
-    public function serialize (): string {
278
+    public function serialize(): string {
279 279
         return serialize($this->toArray());
280 280
     }
281 281
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      *
285 285
      * @return array
286 286
      */
287
-    public function toArray (): array {
287
+    public function toArray(): array {
288 288
         if (!$this->api) {
289 289
             return $this->data;
290 290
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      *
311 311
      * @param $serialized
312 312
      */
313
-    public function unserialize ($serialized): void {
313
+    public function unserialize($serialized): void {
314 314
         $this->data = unserialize($serialized);
315 315
     }
316 316
 }
317 317
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Logger.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  */
8 8
 class Logger implements LoggerInterface {
9 9
 
10
-    public function log (string $info, string $path, ?array $payload): void {
10
+    public function log(string $info, string $path, ?array $payload): void {
11 11
         // stub
12 12
     }
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/SimpleCache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param Api $api
37 37
      * @param PSR16 $cache
38 38
      */
39
-    public function __construct (Api $api, PSR16 $cache) {
39
+    public function __construct(Api $api, PSR16 $cache) {
40 40
         $this->api = $api;
41 41
         $this->cache = $cache;
42 42
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param AbstractEntity $entity
46 46
      * @throws InvalidArgumentException
47 47
      */
48
-    public function add (AbstractEntity $entity): void {
48
+    public function add(AbstractEntity $entity): void {
49 49
         if ($gid = $entity->getGid() and !$entity->isDiff()) {
50 50
             parent::add($entity);
51 51
             foreach ($this->getKeys($entity) as $key) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         }
58 58
     }
59 59
 
60
-    public function get (string $key, $caller, Closure $factory) {
60
+    public function get(string $key, $caller, Closure $factory) {
61 61
         return parent::get($key, $caller, function($caller) use ($key, $factory) {
62 62
             /** @var null|string|AbstractEntity $entity */
63 63
             if ($entity = $this->cache->get($key)) { // hit?
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param Api|Data $caller
102 102
      * @return AbstractEntity
103 103
      */
104
-    protected function hydrate (AbstractEntity $proto, $caller) {
104
+    protected function hydrate(AbstractEntity $proto, $caller) {
105 105
         return $this->api->factory(get_class($proto), $caller, $proto->toArray());
106 106
     }
107 107
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param AbstractEntity $entity
110 110
      * @throws InvalidArgumentException
111 111
      */
112
-    public function remove (AbstractEntity $entity): void {
112
+    public function remove(AbstractEntity $entity): void {
113 113
         parent::remove($entity);
114 114
         $this->cache->deleteMultiple($this->getKeys($entity));
115 115
     }
Please login to merge, or discard this patch.