@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function register(Container $container) |
| 25 | 25 | { |
| 26 | 26 | $container->register(array( |
| 27 | - 'Darya\Database\Storage' => function ($container) { |
|
| 27 | + 'Darya\Database\Storage' => function($container) { |
|
| 28 | 28 | return new Storage($container->resolve('Darya\Database\Connection')); |
| 29 | 29 | }, |
| 30 | 30 | 'Darya\Storage\Readable' => 'Darya\Database\Storage', |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $listener = function ($result) { |
|
| 52 | + $listener = function($result) { |
|
| 53 | 53 | Chrome::log(array($result->query->string, json_encode($result->query->parameters))); |
| 54 | 54 | |
| 55 | 55 | if ($result->error) { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function register(Container $container) |
| 25 | 25 | { |
| 26 | 26 | $container->register(array( |
| 27 | - 'Darya\Http\Request' => function ($container) { |
|
| 27 | + 'Darya\Http\Request' => function($container) { |
|
| 28 | 28 | return Request::createFromGlobals($container->resolve('Darya\Http\Session')); |
| 29 | 29 | }, |
| 30 | 30 | 'Darya\Http\Response' => new Response, |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function register(Container $container) |
| 21 | 21 | { |
| 22 | 22 | $container->register(array( |
| 23 | - 'Darya\Routing\Router' => function ($container) { |
|
| 23 | + 'Darya\Routing\Router' => function($container) { |
|
| 24 | 24 | $config = $container->config; |
| 25 | 25 | |
| 26 | 26 | $routes = $config->get('routes', array( |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function register(Container $container) |
| 21 | 21 | { |
| 22 | 22 | $container->register(array( |
| 23 | - 'Darya\Smarty\ViewResolver' => function ($container) { |
|
| 23 | + 'Darya\Smarty\ViewResolver' => function($container) { |
|
| 24 | 24 | $basePath = $container->get('path'); |
| 25 | 25 | $realBasePath = realpath("{$basePath}/views/smarty"); |
| 26 | 26 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $filterer = $this; |
| 128 | 128 | |
| 129 | - return function ($row) use ($filterer, $filter, $or) { |
|
| 129 | + return function($row) use ($filterer, $filter, $or) { |
|
| 130 | 130 | return $filterer->matches($row, $filter, $or); |
| 131 | 131 | }; |
| 132 | 132 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | { |
| 481 | 481 | $value = preg_quote($value, '/'); |
| 482 | 482 | |
| 483 | - $pattern = '/' . preg_replace(array('/([^\\\])?_/', '/([^\\\])?%/'), array('$1.', '$1.*'), $value) . '/i'; |
|
| 483 | + $pattern = '/'.preg_replace(array('/([^\\\])?_/', '/([^\\\])?%/'), array('$1.', '$1.*'), $value).'/i'; |
|
| 484 | 484 | |
| 485 | 485 | return preg_match($pattern, $actual); |
| 486 | 486 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $path = preg_replace($pattern, $replacement, $path); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return '#/?^' . $path . '/?$#'; |
|
| 98 | + return '#/?^'.$path.'/?$#'; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | return $controller; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - return preg_replace_callback('/^(.)|-(.)/', function ($matches) {
|
|
| 117 | + return preg_replace_callback('/^(.)|-(.)/', function($matches) {
|
|
| 118 | 118 | return strtoupper($matches[1] ?: $matches[2]); |
| 119 | - }, $controller) . 'Controller'; |
|
| 119 | + }, $controller).'Controller'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public static function prepareAction($action) |
| 132 | 132 | {
|
| 133 | - return preg_replace_callback('/-(.)/', function ($matches) {
|
|
| 133 | + return preg_replace_callback('/-(.)/', function($matches) {
|
|
| 134 | 134 | return strtoupper($matches[1]); |
| 135 | 135 | }, $action); |
| 136 | 136 | } |
@@ -471,15 +471,15 @@ discard block |
||
| 471 | 471 | $controller = static::prepareController($route->controller); |
| 472 | 472 | |
| 473 | 473 | if ($route->namespace) {
|
| 474 | - $controller = $route->namespace . '\\' . $controller; |
|
| 474 | + $controller = $route->namespace.'\\'.$controller; |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | if (class_exists($controller)) {
|
| 478 | 478 | $route->controller = $controller; |
| 479 | 479 | } |
| 480 | 480 | } else {
|
| 481 | - $namespace = $route->namespace ? $route->namespace . '\\' : ''; |
|
| 482 | - $route->controller = $namespace . $this->defaults['controller']; |
|
| 481 | + $namespace = $route->namespace ? $route->namespace.'\\' : ''; |
|
| 482 | + $route->controller = $namespace.$this->defaults['controller']; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | return $route; |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | if (method_exists($route->controller, $action)) {
|
| 506 | 506 | $route->action = $action; |
| 507 | - } else if (method_exists($route->controller, $action . 'Action')) {
|
|
| 508 | - $route->action = $action . 'Action'; |
|
| 507 | + } else if (method_exists($route->controller, $action.'Action')) {
|
|
| 508 | + $route->action = $action.'Action'; |
|
| 509 | 509 | } |
| 510 | 510 | } else {
|
| 511 | 511 | $route->action = $this->defaults['action']; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $response = $this->dispatchCallable($request, $response, $callable, $arguments); |
| 727 | 727 | $this->unsubscribe($controller); |
| 728 | 728 | |
| 729 | - $response->header('X-Location: ' . $request->uri());
|
|
| 729 | + $response->header('X-Location: '.$request->uri());
|
|
| 730 | 730 | |
| 731 | 731 | return $response; |
| 732 | 732 | } |
@@ -762,11 +762,11 @@ discard block |
||
| 762 | 762 | */ |
| 763 | 763 | public function generate($path, array $parameters = array()) |
| 764 | 764 | {
|
| 765 | - return preg_replace_callback('#/(:[A-Za-z0-9_-]+(\??))#', function ($match) use ($parameters) {
|
|
| 765 | + return preg_replace_callback('#/(:[A-Za-z0-9_-]+(\??))#', function($match) use ($parameters) {
|
|
| 766 | 766 | $parameter = trim($match[1], '?:'); |
| 767 | 767 | |
| 768 | 768 | if ($parameter && isset($parameters[$parameter])) {
|
| 769 | - return '/' . $parameters[$parameter]; |
|
| 769 | + return '/'.$parameters[$parameter]; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ($parameter !== 'params' && $match[2] !== '?') {
|
@@ -813,6 +813,6 @@ discard block |
||
| 813 | 813 | */ |
| 814 | 814 | public function url($name, array $parameters = array()) |
| 815 | 815 | {
|
| 816 | - return $this->base . $this->path($name, $parameters); |
|
| 816 | + return $this->base.$this->path($name, $parameters); |
|
| 817 | 817 | } |
| 818 | 818 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public static function registerExtensions($extensions) |
| 107 | 107 | { |
| 108 | - $extensions = array_map(function ($extension) { |
|
| 109 | - return '.' . ltrim(trim($extension), '.'); |
|
| 108 | + $extensions = array_map(function($extension) { |
|
| 109 | + return '.'.ltrim(trim($extension), '.'); |
|
| 110 | 110 | }, (array) $extensions); |
| 111 | 111 | |
| 112 | 112 | static::$extensions = array_merge(static::$extensions, $extensions); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | foreach ($extensions as $extension) { |
| 224 | 224 | if (static::$basePath) { |
| 225 | - $paths[] = static::$basePath . "/$path$extension"; |
|
| 225 | + $paths[] = static::$basePath."/$path$extension"; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $paths[] = "$path$extension"; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function transform($value, $type = '') |
| 23 | 23 | { |
| 24 | - $method = 'transform' . ucfirst($type); |
|
| 24 | + $method = 'transform'.ucfirst($type); |
|
| 25 | 25 | |
| 26 | 26 | if (method_exists($this, $method)) { |
| 27 | 27 | return $this->$method($value); |