@@ -99,7 +99,7 @@ |
||
99 | 99 | array_push($this->listeners[$eventName], $event); |
100 | 100 | |
101 | 101 | if (count($this->listeners[$eventName]) > 1) { |
102 | - usort($this->listeners[$eventName], function ($a, $b) |
|
102 | + usort($this->listeners[$eventName], function($a, $b) |
|
103 | 103 | { |
104 | 104 | if ($a['priority'] == $b['priority']) { |
105 | 105 | return 0; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $this->dispatch(Events::MABS_HANDLE_REQUEST, $request); |
157 | 157 | |
158 | 158 | $response = $this->container['router']->handleRequest($request); |
159 | - if (! $response instanceof Response) { |
|
159 | + if (!$response instanceof Response) { |
|
160 | 160 | $response = new Response($response, 200); |
161 | 161 | } |
162 | 162 | |
@@ -265,15 +265,15 @@ discard block |
||
265 | 265 | */ |
266 | 266 | protected function load() |
267 | 267 | { |
268 | - $this->container['event_dispatcher'] = function (Container $container) { |
|
268 | + $this->container['event_dispatcher'] = function(Container $container) { |
|
269 | 269 | return new EventDispatcher($container); |
270 | 270 | }; |
271 | 271 | |
272 | - $this->container['request'] = function () { |
|
272 | + $this->container['request'] = function() { |
|
273 | 273 | return Request::createFromGlobals(); |
274 | 274 | }; |
275 | 275 | |
276 | - $this->container['router'] = function (Container $container) { |
|
276 | + $this->container['router'] = function(Container $container) { |
|
277 | 277 | return new Router(); |
278 | 278 | }; |
279 | 279 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | public function getName() |
63 | 63 | { |
64 | 64 | if ($this->name == null) { |
65 | - $this->name = spl_object_hash($this); |
|
65 | + $this->name = spl_object_hash($this); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $this->name; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $path = $route->getPath(); |
115 | 115 | |
116 | 116 | foreach ($params as $key => $value) { |
117 | - $path = str_replace(array('(' . $key . ')', '(' . $key . '?)'), $value, $path); |
|
117 | + $path = str_replace(array('('.$key.')', '('.$key.'?)'), $value, $path); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $path; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if ($currentPath == $routePath) { |
136 | 136 | |
137 | 137 | return true; |
138 | - } else if (!empty($regex) && preg_match('#^' . $regex . '\/?$#', $currentPath, $matches)) { |
|
138 | + } else if (!empty($regex) && preg_match('#^'.$regex.'\/?$#', $currentPath, $matches)) { |
|
139 | 139 | $request->query->add($route->getNamesParameters($matches)); |
140 | 140 | |
141 | 141 | return true; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return $this->routes[$routeName]; |
151 | 151 | } |
152 | 152 | |
153 | - throw new \RuntimeException('route ' . $routeName . ' not found'); |
|
153 | + throw new \RuntimeException('route '.$routeName.' not found'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | private function getCurrentPath(Request $request) |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | |
3 | 3 | // autoload.php |
4 | 4 | |
5 | -spl_autoload_register(function ($class) { |
|
5 | +spl_autoload_register(function($class) { |
|
6 | 6 | |
7 | 7 | // project-specific namespace prefix |
8 | 8 | $prefix = 'Mabs\\'; |
9 | 9 | |
10 | 10 | // base directory for the namespace prefix |
11 | - $base_dir = __DIR__ . '/../src/'; |
|
11 | + $base_dir = __DIR__.'/../src/'; |
|
12 | 12 | |
13 | 13 | // does the class use the namespace prefix? |
14 | 14 | $len = strlen($prefix); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // replace the namespace prefix with the base directory, replace namespace |
24 | 24 | // separators with directory separators in the relative class name, append |
25 | 25 | // with .php |
26 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
26 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
27 | 27 | |
28 | 28 | // if the file exists, require it |
29 | 29 | if (file_exists($file)) { |
@@ -38,4 +38,4 @@ |
||
38 | 38 | public function load(Container $container); |
39 | 39 | public function boot(Container $container); |
40 | 40 | } |
41 | - |
|
42 | 41 | \ No newline at end of file |
42 | + |
|
43 | 43 | \ No newline at end of file |
@@ -49,18 +49,18 @@ |
||
49 | 49 | $container['session.default_locale'] = 'en'; |
50 | 50 | $container['session.storage.save_path'] = '/tmp'; |
51 | 51 | |
52 | - $container['session.storage.handler'] = function (Container $c) { |
|
52 | + $container['session.storage.handler'] = function(Container $c) { |
|
53 | 53 | return new NativeFileSessionHandler($c['session.storage.save_path']); |
54 | 54 | }; |
55 | 55 | |
56 | - $container['session.storage.native'] = function (Container $c) { |
|
56 | + $container['session.storage.native'] = function(Container $c) { |
|
57 | 57 | return new NativeSessionStorage( |
58 | 58 | $c['session.storage.options'], |
59 | 59 | $c['session.storage.handler'] |
60 | 60 | ); |
61 | 61 | }; |
62 | 62 | |
63 | - $container['session'] = function (Container $app) { |
|
63 | + $container['session'] = function(Container $app) { |
|
64 | 64 | if (!isset($app['session.storage'])) { |
65 | 65 | $app['session.storage'] = $app['session.storage.native']; |
66 | 66 | } |
@@ -42,4 +42,4 @@ |
||
42 | 42 | const MABS_ON_TERMINATE = 'mabs.on.terminate'; |
43 | 43 | const MABS_ON_FINISH = 'mabs.on.finish'; |
44 | 44 | } |
45 | - |
|
46 | 45 | \ No newline at end of file |
46 | + |
|
47 | 47 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function testGetMethodMountsRoute() |
45 | 45 | { |
46 | - $this->app->get('example', function () { |
|
46 | + $this->app->get('example', function() { |
|
47 | 47 | return new Response('Hello, World!'); |
48 | 48 | }); |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $eventCalled = false; |
59 | 59 | |
60 | - $this->app->on('test.event', function () use (&$eventCalled) { |
|
60 | + $this->app->on('test.event', function() use (&$eventCalled) { |
|
61 | 61 | $eventCalled = true; |
62 | 62 | }); |
63 | 63 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $eventCalled = false; |
72 | 72 | |
73 | - $callback = function () use (&$eventCalled) { |
|
73 | + $callback = function() use (&$eventCalled) { |
|
74 | 74 | $eventCalled = true; |
75 | 75 | }; |
76 | 76 |