Completed
Branch master (00145b)
by Maik
07:05
created
src/Mvc/Util/RequestParser.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      * Parse the context prefix variables to determine in which path
16 16
      * context the request has been performed.
17 17
      *
18
-     * @param Request $request            
18
+     * @param \Nkey\Caribu\Mvc\Controller\Request $request            
19 19
      */
20 20
     private static function parseContextPrefix(\Nkey\Caribu\Mvc\Controller\Request &$request, $serverVars = array())
21 21
     {
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * Parse the prepared uri into its parts
39 39
      *
40
-     * @param Request $request
40
+     * @param \Nkey\Caribu\Mvc\Controller\Request $request
41 41
      *            The unprepared request object
42 42
      * @param string $uri
43 43
      *            The prepared uri
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * Parse a single http header element into parameter for the request object
91 91
      *
92
-     * @param Request $req
92
+     * @param \Nkey\Caribu\Mvc\Controller\Request $req
93 93
      *            The destination request object
94 94
      * @param array $serverVars
95 95
      *            The server variables provided by sapi
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     /**
109 109
      * Parse the server variables which represents HTTP headers into parameter values for the request object
110 110
      *
111
-     * @param Request $req
111
+     * @param \Nkey\Caribu\Mvc\Controller\Request $req
112 112
      *            The request object
113 113
      *            
114 114
      * @param
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     /**
144 144
      * Parse the remote host variables to determine client address
145 145
      *
146
-     * @param Request $request            
146
+     * @param \Nkey\Caribu\Mvc\Controller\Request $request            
147 147
      */
148 148
     private static function parseRemoteHost(\Nkey\Caribu\Mvc\Controller\Request &$request, $serverVars = array())
149 149
     {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     /**
159 159
      * Parse the super globals for request parameters
160 160
      *
161
-     * @param Request $request
161
+     * @param \Nkey\Caribu\Mvc\Controller\Request $request
162 162
      *            Request object to put the parameters in
163 163
      */
164 164
     private static function parseGetPostSessionCookie(\Nkey\Caribu\Mvc\Controller\Request &$request)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      *
18 18
      * @param Request $request            
19 19
      */
20
-    private static function parseContextPrefix(\Nkey\Caribu\Mvc\Controller\Request &$request, $serverVars = array())
20
+    private static function parseContextPrefix(\Nkey\Caribu\Mvc\Controller\Request & $request, $serverVars = array())
21 21
     {
22 22
         // Since apache 2.3.13 we have now an additional index which provides the context
23 23
         if (isset($serverVars['CONTEXT_PREFIX']) && $serverVars['CONTEXT_PREFIX'] != '') {
24
-            $request->contextPrefix = $serverVars['CONTEXT_PREFIX'] . '/';
24
+            $request->contextPrefix = $serverVars['CONTEXT_PREFIX'].'/';
25 25
         } elseif (isset($serverVars['REDIRECT_BASE'])) {
26 26
             // Try to determine the context from redirect base
27 27
             $request->contextPrefix = $serverVars['REDIRECT_BASE'];
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *            
49 49
      * @return array Parsed parts for later usage
50 50
      */
51
-    private static function parseUri(\Nkey\Caribu\Mvc\Controller\Request &$request, $uri, $defaultController, $defaultAction)
51
+    private static function parseUri(\Nkey\Caribu\Mvc\Controller\Request & $request, $uri, $defaultController, $defaultAction)
52 52
     {
53 53
         // All beyond the context prefix is our application request uri
54 54
         $contextUri = $uri;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if (count($parts) > 0) {
70 70
             $request->controller = ucfirst(trim($parts[0]));
71 71
             array_shift($parts);
72
-            if (! $request->controller) {
72
+            if (!$request->controller) {
73 73
                 $request->controller = $defaultController;
74 74
             }
75 75
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         if (count($parts) > 0) {
79 79
             $request->action = trim($parts[0]);
80 80
             array_shift($parts);
81
-            if (! $request->action) {
81
+            if (!$request->action) {
82 82
                 $request->action = $defaultAction;
83 83
             }
84 84
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @param string $paramName
99 99
      *            The destination parameter name
100 100
      */
101
-    private static function parseElement(\Nkey\Caribu\Mvc\Controller\Request &$req, $serverVars, $elementName, $paramName)
101
+    private static function parseElement(\Nkey\Caribu\Mvc\Controller\Request & $req, $serverVars, $elementName, $paramName)
102 102
     {
103 103
         if (isset($serverVars[$elementName])) {
104 104
             $req->params[$paramName] = $serverVars[$elementName];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param
115 115
      *            array The server variables provided by sapi
116 116
      */
117
-    private static function parseParameters(\Nkey\Caribu\Mvc\Controller\Request &$req, $serverVars)
117
+    private static function parseParameters(\Nkey\Caribu\Mvc\Controller\Request & $req, $serverVars)
118 118
     {
119 119
         self::parseElement($req, $serverVars, 'HTTP_ACCEPT', 'Accept');
120 120
         self::parseElement($req, $serverVars, 'HTTP_ACCEPT_LANGUAGE', 'Accept-Language');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      *
146 146
      * @param Request $request            
147 147
      */
148
-    private static function parseRemoteHost(\Nkey\Caribu\Mvc\Controller\Request &$request, $serverVars = array())
148
+    private static function parseRemoteHost(\Nkey\Caribu\Mvc\Controller\Request & $request, $serverVars = array())
149 149
     {
150 150
         if (isset($serverVars['REMOTE_ADDR'])) {
151 151
             $request->remoteHost = $serverVars['REMOTE_ADDR'];
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param Request $request
162 162
      *            Request object to put the parameters in
163 163
      */
164
-    private static function parseGetPostSessionCookie(\Nkey\Caribu\Mvc\Controller\Request &$request)
164
+    private static function parseGetPostSessionCookie(\Nkey\Caribu\Mvc\Controller\Request & $request)
165 165
     {
166 166
         foreach ($_GET as $name => $value) {
167 167
             $request->params[$name] = $value;
Please login to merge, or discard this patch.
src/Mvc/Controller/AbstractController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         
81 81
         $param = $params[0];
82 82
         assert($param instanceof \ReflectionParameter);
83
-        if (! ($class = $param->getClass()) || $class->getName() != 'Nkey\Caribu\Mvc\Controller\Request') {
83
+        if (!($class = $param->getClass()) || $class->getName() != 'Nkey\Caribu\Mvc\Controller\Request') {
84 84
             return false;
85 85
         }
86 86
         
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             return;
107 107
         }
108 108
         
109
-        if (! $this->parseParameters($action)) {
109
+        if (!$this->parseParameters($action)) {
110 110
             return;
111 111
         }
112 112
         
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param View $view
206 206
      *            The View instance to use for rendering
207 207
      */
208
-    protected function addControls(Response &$response, Request $request, View $view)
208
+    protected function addControls(Response & $response, Request $request, View $view)
209 209
     {
210 210
         $matches = array();
211 211
         
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             $controlName = $matches[2];
215 215
             $currentBody = $response->getBody();
216 216
             
217
-            if (! isset($this->viewParams[$controlIdentifier][$controlName]) || ! $view->hasControl($controlIdentifier)) {
217
+            if (!isset($this->viewParams[$controlIdentifier][$controlName]) || !$view->hasControl($controlIdentifier)) {
218 218
                 $response->setBody(str_replace($matches[0], '', $currentBody));
219 219
                 continue;
220 220
             }
Please login to merge, or discard this patch.
src/Mvc/Controller/Request.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public static function parseFromServerRequest($serverVars, $defaultController = 'Index', $defaultAction = 'index')
151 151
     {
152
-        if (! isset($serverVars['REQUEST_URI'])) {
152
+        if (!isset($serverVars['REQUEST_URI'])) {
153 153
             throw new InvalidUrlException("No such uri provided");
154 154
         }
155 155
         return self::parse($serverVars['REQUEST_URI'], $serverVars, $defaultController, $defaultAction);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
             
245 245
             case 'bool':
246 246
             case 'boolean':
247
-                $result = function_exists('boolval') ? boolval($result) : (bool) $result;
247
+                $result = function_exists('boolval') ? boolval($result) : (bool)$result;
248 248
                 break;
249 249
             
250 250
             case 'double':
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function setParam($name, $value)
281 281
     {
282
-        if (! $this->hasParam($name)) {
282
+        if (!$this->hasParam($name)) {
283 283
             throw new ControllerException("Parameter {param} does not exist", array(
284 284
                 'param' => $name
285 285
             ));
Please login to merge, or discard this patch.
src/Mvc/View/Controls/Form.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     private function renderFields($rendered, $fields)
28 28
     {
29 29
         foreach ($fields as $field) {
30
-            if (! isset($field['name'])) {
30
+            if (!isset($field['name'])) {
31 31
                 throw new ControlException("Field must have at least a name!");
32 32
             }
33 33
             $fieldType = isset($field['type']) ? $field['type'] : 'text';
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     private function renderButtons($rendered, $buttons)
55 55
     {
56 56
         foreach ($buttons as $button) {
57
-            if (! isset($button['name'])) {
57
+            if (!isset($button['name'])) {
58 58
                 throw new ControlException("Button must have at least a name!");
59 59
             }
60 60
             $buttonType = isset($button['type']) ? $button['type'] : "submit";
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function render(Request $request, $parameters = array())
77 77
     {
78 78
         $contentPrefix = "/";
79
-        if (! is_null($request->getContextPrefix())) {
79
+        if (!is_null($request->getContextPrefix())) {
80 80
             $contentPrefix = $request->getContextPrefix();
81 81
         }
82 82
         
Please login to merge, or discard this patch.
src/Mvc/View/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      *            
29 29
      * @return void
30 30
      */
31
-    public function render(Response &$response, Request $request, $parameters = array());
31
+    public function render(Response & $response, Request $request, $parameters = array());
32 32
 
33 33
     /**
34 34
      * Retrieve the order of view in best-match list
Please login to merge, or discard this patch.
src/Mvc/View/AbstractView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      *
79 79
      * @see \Nkey\Caribu\Mvc\View\View::render()
80 80
      */
81
-    abstract public function render(Response &$response, Request $request, $parameters = array());
81
+    abstract public function render(Response & $response, Request $request, $parameters = array());
82 82
 
83 83
     /**
84 84
      * Retrieve the settings from view
Please login to merge, or discard this patch.
src/Mvc/View/DefaultView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      *
38 38
      * @see \Nkey\Caribu\Mvc\View\AbstractView::render()
39 39
      */
40
-    public function render(Response &$response, Request $request, $parameters = array())
40
+    public function render(Response & $response, Request $request, $parameters = array())
41 41
     {
42 42
         if ($response->getType() == 'text/html') {
43 43
             $html = sprintf("
Please login to merge, or discard this patch.
src/Mvc/Application.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function registerView($view, $order = null, $applicationName = 'default')
205 205
     {
206
-        if (! class_exists($view)) {
206
+        if (!class_exists($view)) {
207 207
             throw new ViewException("No such view class {view} found", array(
208 208
                 'view' => $view
209 209
             ));
210 210
         }
211 211
         
212 212
         $v = new $view();
213
-        if (! $v instanceof View) {
213
+        if (!$v instanceof View) {
214 214
             throw new ViewException("View {view} is not in application scope", array(
215 215
                 'view' => $view
216 216
             ));
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
      */
311 311
     public function registerController($controller, $applicationName = 'default')
312 312
     {
313
-        if (! class_exists($controller)) {
313
+        if (!class_exists($controller)) {
314 314
             throw new ControllerException("No such controller class {controller} found", array(
315 315
                 'controller' => $controller
316 316
             ));
317 317
         }
318 318
         $c = new $controller();
319
-        if (! ($c instanceof AbstractController)) {
319
+        if (!($c instanceof AbstractController)) {
320 320
             throw new ControllerException("Controller {controller} is not in application scope", array(
321 321
                 'controller' => $controller
322 322
             ));
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             'action' => $action
366 366
         ));
367 367
         
368
-        if (! isset($this->controllers[$applicationName][$controller])) {
368
+        if (!isset($this->controllers[$applicationName][$controller])) {
369 369
             $this->getLogger()->error("[{remote}] No such controller {controller}", array(
370 370
                 'remote' => $request->getRemoteHost(),
371 371
                 'controller' => $controller
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         
377 377
         $controllerInstance = $this->controllers[$applicationName][$controller];
378 378
         assert($controllerInstance instanceof AbstractController);
379
-        if (! $controllerInstance->hasAction($action)) {
379
+        if (!$controllerInstance->hasAction($action)) {
380 380
             $this->getLogger()->error("[{remote}] No such action {action}", array(
381 381
                 'remote' => $request->getRemoteHost(),
382 382
                 'action' => $action
Please login to merge, or discard this patch.
src/Mvc/Util/Session.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         if (null === $namespace) {
47 47
             $this->sessionData = $_SESSION;
48 48
         } else {
49
-            if (! isset($_SESSION[$namespace])) {
49
+            if (!isset($_SESSION[$namespace])) {
50 50
                 $_SESSION[$namespace] = array();
51 51
             }
52 52
             $this->sessionData = $_SESSION[$namespace];
Please login to merge, or discard this patch.