@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function basePath($basePath = null) |
56 | 56 | { |
57 | - $this->basePath = $basePath ?: realpath(__DIR__ . '/../../'); |
|
57 | + $this->basePath = $basePath ?: realpath(__DIR__.'/../../'); |
|
58 | 58 | |
59 | 59 | return $this->basePath; |
60 | 60 | } |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | $nsBasePaths = array(''); |
132 | 132 | |
133 | 133 | if ($this->basePath) { |
134 | - $nsBasePaths[] = $this->basePath . '/'; |
|
134 | + $nsBasePaths[] = $this->basePath.'/'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | foreach ($nsBasePaths as $nsBasePath) { |
138 | 138 | if ($class === $ns) { |
139 | 139 | array_push($paths, "$nsBasePath$nsPath"); |
140 | 140 | array_push($paths, "$nsBasePath$nsPath/$className.php"); |
141 | - array_push($paths, "$nsBasePath" . strtolower($nsPath) . "/$className.php"); |
|
141 | + array_push($paths, "$nsBasePath".strtolower($nsPath)."/$className.php"); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (strpos($class, $ns) === 0) { |
145 | 145 | array_push($paths, "$nsBasePath$nsPath/$dir/$className.php"); |
146 | - array_push($paths, "$nsBasePath" . strtolower("$nsPath/$dir") . "/$className.php"); |
|
146 | + array_push($paths, "$nsBasePath".strtolower("$nsPath/$dir")."/$className.php"); |
|
147 | 147 | |
148 | 148 | $nsRemain = str_replace('\\', '/', substr($class, strlen($ns))); |
149 | 149 | array_push($paths, "$nsBasePath$nsPath/$nsRemain.php"); |
@@ -151,32 +151,32 @@ discard block |
||
151 | 151 | |
152 | 152 | $nsRemainDir = dirname($nsRemain); |
153 | 153 | $nsRemainFile = basename($nsRemain); |
154 | - array_push($paths, "$nsBasePath$nsPath/" . strtolower($nsRemainDir) . "/$nsRemainFile.php"); |
|
154 | + array_push($paths, "$nsBasePath$nsPath/".strtolower($nsRemainDir)."/$nsRemainFile.php"); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Try using the namespace as an exact directory mapping |
161 | - array_push($paths, $this->basePath . "/$dir/$className.php"); |
|
161 | + array_push($paths, $this->basePath."/$dir/$className.php"); |
|
162 | 162 | |
163 | 163 | // Try using the namespace in lowercase as a directory mapping, with |
164 | 164 | // only the class name in its original case |
165 | 165 | $dirLowercase = strtolower($dir); |
166 | - array_push($paths, $this->basePath . "/$dirLowercase/$className.php"); |
|
166 | + array_push($paths, $this->basePath."/$dirLowercase/$className.php"); |
|
167 | 167 | |
168 | 168 | // Last try using the last part of the namespace as a subdirectory, with |
169 | 169 | // and without a trailing 's', as well as any common subdirectory names |
170 | 170 | $subdirs = array_merge($this->commonSubdirs, array( |
171 | 171 | $className, |
172 | - $className . 's', |
|
172 | + $className.'s', |
|
173 | 173 | )); |
174 | 174 | |
175 | 175 | foreach ($subdirs as $subdir) { |
176 | - array_push($paths, $this->basePath . "/$dir/$subdir/$className.php"); |
|
176 | + array_push($paths, $this->basePath."/$dir/$subdir/$className.php"); |
|
177 | 177 | |
178 | 178 | $subdirLowercase = strtolower($subdir); |
179 | - array_push($paths, $this->basePath . "/$dirLowercase/$subdirLowercase/$className.php"); |
|
179 | + array_push($paths, $this->basePath."/$dirLowercase/$subdirLowercase/$className.php"); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // Finally, attempt to find the class |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $names = array($parent, $target); |
151 | 151 | sort($names); |
152 | 152 | |
153 | - $this->table = implode('_', $names) . 's'; |
|
153 | + $this->table = implode('_', $names).'s'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -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 | } |
@@ -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 | } |
@@ -391,7 +391,7 @@ |
||
391 | 391 | */ |
392 | 392 | public function setMany($values) |
393 | 393 | { |
394 | - foreach ((array) $values as $attribute => $value){ |
|
394 | + foreach ((array) $values as $attribute => $value) { |
|
395 | 395 | $this->set($attribute, $value); |
396 | 396 | } |
397 | 397 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * Normalise the given path. |
61 | 61 | * |
62 | 62 | * @param string $path |
63 | - * @return path |
|
63 | + * @return string |
|
64 | 64 | */ |
65 | 65 | public static function normalise($path) |
66 | 66 | { |
@@ -123,7 +123,7 @@ |
||
123 | 123 | public function registerExtensions($extensions) |
124 | 124 | { |
125 | 125 | foreach ((array) $extensions as $extension) { |
126 | - $this->extensions[] = '.' . ltrim($extension, '.'); |
|
126 | + $this->extensions[] = '.'.ltrim($extension, '.'); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected static function concatenate($strings, $delimiter = ' ') |
47 | 47 | { |
48 | - $strings = array_filter($strings, function ($value) { |
|
48 | + $strings = array_filter($strings, function($value) { |
|
49 | 49 | return !empty($value); |
50 | 50 | }); |
51 | 51 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $type = $storageQuery->type; |
80 | 80 | |
81 | - $method = 'translate' . ucfirst($type); |
|
81 | + $method = 'translate'.ucfirst($type); |
|
82 | 82 | |
83 | 83 | if (!method_exists($this, $method)) { |
84 | 84 | throw new InvalidArgumentException("Could not translate query of unknown type '$type'"); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | protected function translateTranslatable($query) |
249 | 249 | { |
250 | 250 | if (!$this->translatable($query)) { |
251 | - throw new InvalidArgumentException("Cannot translate query of type '" . get_class($query) . "'"); |
|
251 | + throw new InvalidArgumentException("Cannot translate query of type '".get_class($query)."'"); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | if ($query instanceof Storage\Query\Builder) { |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | return $this->translate($query); |
260 | 260 | } |
261 | 261 | |
262 | - throw new InvalidArgumentException("Cannot translate query of type '" . get_class($query) . "'"); |
|
262 | + throw new InvalidArgumentException("Cannot translate query of type '".get_class($query)."'"); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | protected function prepareJoinType($type) |
443 | 443 | { |
444 | 444 | if (in_array($type, array('left', 'right'))) { |
445 | - return strtoupper($type) . ' JOIN'; |
|
445 | + return strtoupper($type).' JOIN'; |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | return 'JOIN'; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | } |
574 | 574 | |
575 | 575 | if (is_array($value)) { |
576 | - $value = "(" . implode(", ", $value) . ")"; |
|
576 | + $value = "(".implode(", ", $value).")"; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | return "$column $operator $value"; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | |
594 | 594 | foreach ($filter as $column => $value) { |
595 | 595 | if (strtolower($column) == 'or') { |
596 | - $conditions[] = '(' . $this->prepareWhere($value, 'OR', true) . ')'; |
|
596 | + $conditions[] = '('.$this->prepareWhere($value, 'OR', true).')'; |
|
597 | 597 | } else { |
598 | 598 | $conditions[] = $this->prepareFilterCondition($column, $value); |
599 | 599 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | } |
673 | 673 | } |
674 | 674 | |
675 | - return count($conditions) ? 'ORDER BY ' . implode(', ', $conditions) : null; |
|
675 | + return count($conditions) ? 'ORDER BY '.implode(', ', $conditions) : null; |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | /** |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | */ |
693 | 693 | protected function prepareGroupBy(array $groupings) |
694 | 694 | { |
695 | - return count($groupings) ? 'GROUP BY ' . implode(', ', $this->identifier($groupings)) : null; |
|
695 | + return count($groupings) ? 'GROUP BY '.implode(', ', $this->identifier($groupings)) : null; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** |
@@ -757,8 +757,8 @@ discard block |
||
757 | 757 | $columns = $this->identifier(array_keys($data)); |
758 | 758 | $values = $this->value(array_values($data)); |
759 | 759 | |
760 | - $columns = '(' . implode(', ', $columns) . ')'; |
|
761 | - $values = '(' . implode(', ', $values) . ')'; |
|
760 | + $columns = '('.implode(', ', $columns).')'; |
|
761 | + $values = '('.implode(', ', $values).')'; |
|
762 | 762 | |
763 | 763 | return static::concatenate(array('INSERT INTO', $table, $columns, 'VALUES', $values)); |
764 | 764 | } |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | |
779 | 779 | if (!empty($columns)) { |
780 | 780 | $columns = $this->identifier($columns); |
781 | - $columns = "(" . implode(", ", $columns) . ")"; |
|
781 | + $columns = "(".implode(", ", $columns).")"; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | $subquery = (string) $this->translate($subquery); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | /** |
532 | 532 | * Prepare table joins. |
533 | 533 | * |
534 | - * @param array $joins |
|
534 | + * @param Join[] $joins |
|
535 | 535 | * @return string |
536 | 536 | */ |
537 | 537 | protected function prepareJoins(array $joins) |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * translateRead(). |
722 | 722 | * |
723 | 723 | * @param string $table |
724 | - * @param array|string $columns |
|
724 | + * @param string $columns |
|
725 | 725 | * @param string $joins [optional] |
726 | 726 | * @param string $where [optional] |
727 | 727 | * @param string $order [optional] |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $query .= "$offset, "; |
54 | 54 | } |
55 | 55 | |
56 | - return $query . $limit; |
|
56 | + return $query.$limit; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |