@@ -17,7 +17,7 @@ |
||
17 | 17 | public function register(Container $container) |
18 | 18 | { |
19 | 19 | $container->register(array( |
20 | - 'Darya\Database\Connection' => function ($container) { |
|
20 | + 'Darya\Database\Connection' => function($container) { |
|
21 | 21 | $config = $container->config; |
22 | 22 | |
23 | 23 | $connection = new MySql( |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function register(Container $container) |
16 | 16 | { |
17 | 17 | $container->register(array( |
18 | - 'Darya\Routing\Router' => function ($container) { |
|
18 | + 'Darya\Routing\Router' => function($container) { |
|
19 | 19 | $config = $container->config; |
20 | 20 | |
21 | 21 | $routes = $config['routes'] ?: array( |
@@ -24,7 +24,7 @@ |
||
24 | 24 | public function register(Container $container) |
25 | 25 | { |
26 | 26 | $container->register(array( |
27 | - 'Darya\Foundation\Configuration' => function (Application $application) { |
|
27 | + 'Darya\Foundation\Configuration' => function(Application $application) { |
|
28 | 28 | $basePath = $application->basePath(); |
29 | 29 | |
30 | 30 | // Load the application's configuration |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | ini_set('display_errors', 1); |
34 | 34 | |
35 | - $listener = function ($result) { |
|
35 | + $listener = function($result) { |
|
36 | 36 | Chrome::log(array($result->query->string, json_encode($result->query->parameters))); |
37 | 37 | |
38 | 38 | if ($result->error) { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | /** |
484 | 484 | * Prepare table joins. |
485 | 485 | * |
486 | - * @param array $joins |
|
486 | + * @param Join[] $joins |
|
487 | 487 | * @return string |
488 | 488 | */ |
489 | 489 | protected function prepareJoins(array $joins) { |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * translateRead(). |
640 | 640 | * |
641 | 641 | * @param string $table |
642 | - * @param array|string $columns |
|
642 | + * @param string $columns |
|
643 | 643 | * @param string $joins [optional] |
644 | 644 | * @param string $where [optional] |
645 | 645 | * @param string $order [optional] |
@@ -823,8 +823,9 @@ |
||
823 | 823 | |
824 | 824 | $joinParameters = array(); |
825 | 825 | |
826 | - if ($storageQuery instanceof Database\Storage\Query) |
|
827 | - $joinParameters = $this->joinParameters($storageQuery->joins); |
|
826 | + if ($storageQuery instanceof Database\Storage\Query) { |
|
827 | + $joinParameters = $this->joinParameters($storageQuery->joins); |
|
828 | + } |
|
828 | 829 | |
829 | 830 | $parameters = array_merge( |
830 | 831 | $parameters, |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function translate(Storage\Query $storageQuery) { |
73 | 73 | $type = $storageQuery->type; |
74 | 74 | |
75 | - $method = 'translate' . ucfirst($type); |
|
75 | + $method = 'translate'.ucfirst($type); |
|
76 | 76 | |
77 | 77 | if (!method_exists($this, $method)) { |
78 | 78 | throw new InvalidArgumentException("Could not translate query of unknown type '$type'"); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function translateTranslatable($query) { |
230 | 230 | if (!$this->translatable($query)) { |
231 | - throw new InvalidArgumentException("Cannot translate query of type '" . get_class($query) . "'"); |
|
231 | + throw new InvalidArgumentException("Cannot translate query of type '".get_class($query)."'"); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | if ($query instanceof Storage\Query\Builder) { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | protected function prepareJoinType($type) { |
412 | 412 | if (in_array($type, array('left', 'right'))) { |
413 | - return strtoupper($type) . ' JOIN'; |
|
413 | + return strtoupper($type).' JOIN'; |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | return 'JOIN'; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | } |
536 | 536 | |
537 | 537 | if (is_array($value)) { |
538 | - $value = "(" . implode(", ", $value) . ")"; |
|
538 | + $value = "(".implode(", ", $value).")"; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | return "$column $operator $value"; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | foreach ($filter as $column => $value) { |
556 | 556 | if (strtolower($column) == 'or') { |
557 | - $conditions[] = '(' . $this->prepareWhere($value, 'OR', true) . ')'; |
|
557 | + $conditions[] = '('.$this->prepareWhere($value, 'OR', true).')'; |
|
558 | 558 | } else { |
559 | 559 | $conditions[] = $this->prepareFilterCondition($column, $value); |
560 | 560 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | - return count($conditions) ? 'ORDER BY ' . implode(', ', $conditions) : null; |
|
633 | + return count($conditions) ? 'ORDER BY '.implode(', ', $conditions) : null; |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | /** |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | $columns = $this->identifier(array_keys($data)); |
675 | 675 | $values = $this->value(array_values($data)); |
676 | 676 | |
677 | - $columns = "(" . implode(", ", $columns) . ")"; |
|
678 | - $values = "(" . implode(", ", $values) . ")"; |
|
677 | + $columns = "(".implode(", ", $columns).")"; |
|
678 | + $values = "(".implode(", ", $values).")"; |
|
679 | 679 | |
680 | 680 | return static::concatenate(array('INSERT INTO', $table, $columns, 'VALUES', $values)); |
681 | 681 | } |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | |
695 | 695 | if (!empty($columns)) { |
696 | 696 | $columns = $this->identifier($columns); |
697 | - $columns = "(" . implode(", ", $columns) . ")"; |
|
697 | + $columns = "(".implode(", ", $columns).")"; |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | $subquery = (string) $this->translate($subquery); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | * Instantiate a new join. |
54 | 54 | * |
55 | 55 | * @param string $type |
56 | - * @param string $to |
|
56 | + * @param string $resource |
|
57 | 57 | */ |
58 | 58 | public function __construct($type, $resource) |
59 | 59 | { |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | // Composer's autoloader |
3 | -if (is_file(__DIR__ . '/../../autoload.php')) { |
|
4 | - include __DIR__ . '/../../autoload.php'; |
|
3 | +if (is_file(__DIR__.'/../../autoload.php')) { |
|
4 | + include __DIR__.'/../../autoload.php'; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // Darya's autoloader |
8 | -include __DIR__ . '/src/Darya/Foundation/Autoloader.php'; |
|
8 | +include __DIR__.'/src/Darya/Foundation/Autoloader.php'; |
|
9 | 9 | |
10 | 10 | use Darya\Foundation\Autoloader; |
11 | 11 | |
12 | 12 | // Base path wherever it's included from, absolute path to the framework |
13 | 13 | $autoloader = new Autoloader(realpath('./'), array( |
14 | - 'Darya' => realpath(__DIR__ . '/src') |
|
14 | + 'Darya' => realpath(__DIR__.'/src') |
|
15 | 15 | )); |
16 | 16 | |
17 | 17 | $autoloader->register(); |
@@ -174,7 +174,7 @@ |
||
174 | 174 | $data['server']['request_method'] = strtoupper($method); |
175 | 175 | |
176 | 176 | if ($components['query']) { |
177 | - $data['server']['request_uri'] .= '?' . $components['query']; |
|
177 | + $data['server']['request_uri'] .= '?'.$components['query']; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $request = new Request( |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function closure(array $filter, $or = false) { |
121 | 121 | $filterer = $this; |
122 | 122 | |
123 | - return function ($row) use ($filterer, $filter, $or) { |
|
123 | + return function($row) use ($filterer, $filter, $or) { |
|
124 | 124 | return $filterer->matches($row, $filter, $or); |
125 | 125 | }; |
126 | 126 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | protected function like($actual, $value) { |
456 | 456 | $value = preg_quote($value, '/'); |
457 | 457 | |
458 | - $pattern = '/' . preg_replace(array('/([^\\\])?_/', '/([^\\\])?%/'), array('$1.', '$1.*'), $value) . '/i'; |
|
458 | + $pattern = '/'.preg_replace(array('/([^\\\])?_/', '/([^\\\])?%/'), array('$1.', '$1.*'), $value).'/i'; |
|
459 | 459 | |
460 | 460 | return preg_match($pattern, $actual); |
461 | 461 | } |