@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return mixed |
78 | 78 | */ |
79 | 79 | public function get($attribute) { |
80 | - list($attribute, $subattribute) = array_pad(explode('.', $attribute, 2), 2, null); |
|
80 | + list($attribute, $subattribute) = array_pad(explode('.', $attribute, 2), 2, null); |
|
81 | 81 | |
82 | 82 | if ($this->hasRelation($attribute)) { |
83 | 83 | $related = $this->related($attribute); |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | $split = explode('\\', get_class($this)); |
126 | 126 | $class = end($split); |
127 | 127 | |
128 | - return preg_replace_callback('/([A-Z])/', function ($matches) { |
|
129 | - return '_' . strtolower($matches[1]); |
|
130 | - }, lcfirst($class)) . 's'; |
|
128 | + return preg_replace_callback('/([A-Z])/', function($matches) { |
|
129 | + return '_'.strtolower($matches[1]); |
|
130 | + }, lcfirst($class)).'s'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $storage = $instance->storage(); |
341 | 341 | |
342 | 342 | if (!$storage instanceof Searchable) { |
343 | - throw new Exception(get_class($instance) . ' storage is not searchable'); |
|
343 | + throw new Exception(get_class($instance).' storage is not searchable'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | $attributes = $attributes ?: $instance->defaultSearchAttributes(); |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | $storage = $instance->storage(); |
402 | 402 | |
403 | 403 | if (!$storage instanceof Queryable) { |
404 | - throw new Exception(get_class($instance) . ' storage is not queryable'); |
|
404 | + throw new Exception(get_class($instance).' storage is not queryable'); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | $query = new Query($instance->table()); |
408 | 408 | $builder = new Builder($query, $storage); |
409 | 409 | |
410 | - $builder->callback(function ($result) use ($instance) { |
|
410 | + $builder->callback(function($result) use ($instance) { |
|
411 | 411 | return $instance::hydrate($result->data); |
412 | 412 | }); |
413 | 413 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $class = get_class($this); |
426 | 426 | |
427 | 427 | if (!$storage instanceof Modifiable) { |
428 | - throw new Exception($class . ' storage is not modifiable'); |
|
428 | + throw new Exception($class.' storage is not modifiable'); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | $data = $this->prepareData(); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $item = array($index++, $item); |
76 | 76 | } |
77 | 77 | |
78 | - usort($data, function ($a, $b) use ($order) { |
|
78 | + usort($data, function($a, $b) use ($order) { |
|
79 | 79 | foreach ($order as $field => $direction) { |
80 | 80 | if (!isset($a[1][$field]) || !isset($b[1][$field])) { |
81 | 81 | continue; |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | protected static function snakeToCamel($string) |
78 | 78 | { |
79 | - return preg_replace_callback('/_(.)/', function ($matches) { |
|
79 | + return preg_replace_callback('/_(.)/', function($matches) { |
|
80 | 80 | return strtoupper($matches[1]); |
81 | 81 | }, $string); |
82 | 82 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param string|array $extensions |
85 | 85 | */ |
86 | 86 | public static function registerExtensions($extensions) { |
87 | - $extensions = array_map(function ($extension) { |
|
88 | - return '.' . ltrim(trim($extension), '.'); |
|
87 | + $extensions = array_map(function($extension) { |
|
88 | + return '.'.ltrim(trim($extension), '.'); |
|
89 | 89 | }, (array) $extensions); |
90 | 90 | |
91 | 91 | static::$extensions = array_merge(static::$extensions, $extensions); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | foreach ($extensions as $extension) { |
196 | 196 | if (static::$basePath) { |
197 | - $paths[] = static::$basePath . "/$path$extension"; |
|
197 | + $paths[] = static::$basePath."/$path$extension"; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $paths[] = "$path$extension"; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | protected static function concatenate($strings, $delimiter = ' ') |
44 | 44 | { |
45 | - $strings = array_filter($strings, function ($value) { |
|
45 | + $strings = array_filter($strings, function($value) { |
|
46 | 46 | return !empty($value); |
47 | 47 | }); |
48 | 48 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | $type = $storageQuery->type; |
77 | 77 | |
78 | - $method = 'translate' . ucfirst($type); |
|
78 | + $method = 'translate'.ucfirst($type); |
|
79 | 79 | |
80 | 80 | if (!method_exists($this, $method)) { |
81 | 81 | throw new InvalidArgumentException("Could not translate query of unknown type '$type'"); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | protected function translateTranslatable($query) |
240 | 240 | { |
241 | 241 | if (!$this->translatable($query)) { |
242 | - throw new InvalidArgumentException("Cannot translate query of type '" . get_class($query) . "'"); |
|
242 | + throw new InvalidArgumentException("Cannot translate query of type '".get_class($query)."'"); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if ($query instanceof Storage\Query\Builder) { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | protected function prepareJoinType($type) |
432 | 432 | { |
433 | 433 | if (in_array($type, array('left', 'right'))) { |
434 | - return strtoupper($type) . ' JOIN'; |
|
434 | + return strtoupper($type).' JOIN'; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | return 'JOIN'; |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | |
564 | 564 | if (is_array($value)) { |
565 | - $value = "(" . implode(", ", $value) . ")"; |
|
565 | + $value = "(".implode(", ", $value).")"; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | return "$column $operator $value"; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | foreach ($filter as $column => $value) { |
584 | 584 | if (strtolower($column) == 'or') { |
585 | - $conditions[] = '(' . $this->prepareWhere($value, 'OR', true) . ')'; |
|
585 | + $conditions[] = '('.$this->prepareWhere($value, 'OR', true).')'; |
|
586 | 586 | } else { |
587 | 587 | $conditions[] = $this->prepareFilterCondition($column, $value); |
588 | 588 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | } |
662 | 662 | } |
663 | 663 | |
664 | - return count($conditions) ? 'ORDER BY ' . implode(', ', $conditions) : null; |
|
664 | + return count($conditions) ? 'ORDER BY '.implode(', ', $conditions) : null; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | $columns = $this->identifier(array_keys($data)); |
707 | 707 | $values = $this->value(array_values($data)); |
708 | 708 | |
709 | - $columns = "(" . implode(", ", $columns) . ")"; |
|
710 | - $values = "(" . implode(", ", $values) . ")"; |
|
709 | + $columns = "(".implode(", ", $columns).")"; |
|
710 | + $values = "(".implode(", ", $values).")"; |
|
711 | 711 | |
712 | 712 | return static::concatenate(array('INSERT INTO', $table, $columns, 'VALUES', $values)); |
713 | 713 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | if (!empty($columns)) { |
729 | 729 | $columns = $this->identifier($columns); |
730 | - $columns = "(" . implode(", ", $columns) . ")"; |
|
730 | + $columns = "(".implode(", ", $columns).")"; |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | $subquery = (string) $this->translate($subquery); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | { |
55 | 55 | $this->touch($event); |
56 | 56 | |
57 | - $this->listeners[$event] = array_filter($this->listeners[$event], function ($value) use ($callable) { |
|
57 | + $this->listeners[$event] = array_filter($this->listeners[$event], function($value) use ($callable) { |
|
58 | 58 | return $value !== $callable; |
59 | 59 | }); |
60 | 60 | } |