Completed
Branch master (067e88)
by John
02:23
created
src/cache/Memcached.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      *  Get Cache Object
51 51
      *
52
-     *  @return Memcache $memcacheObj
52
+     *  @return \Memcached $memcacheObj
53 53
      *  @note   Please do not modify data if you use the put function in this class
54 54
      */
55 55
     public function getObject()
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      *  Check if the key exists in cache
106 106
      *
107 107
      *  @parm mixed $key
108
-     *  @return true if the key exist in cache
109
-     *  @return false if the key does not exist in cache
108
+     *  @return boolean if the key exist in cache
109
+     *  @return boolean if the key does not exist in cache
110 110
      *
111 111
      */
112 112
     public function has($key)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
         $this->memcacheObj = new \Memcached;
32 32
 
33 33
         $config = \erdiko\core\Helper::getConfig("local/cache");
34
-        $host=$config["memcached"]["host"];
35
-        $port=$config["memcached"]["port"];
34
+        $host = $config["memcached"]["host"];
35
+        $port = $config["memcached"]["port"];
36 36
         $cacheAvailable = $this->memcacheObj->addServer($host, $port);
37 37
 
38 38
     }
Please login to merge, or discard this patch.
src/Controller.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Get Response object
189 189
      *
190
-     * @return ResponseObject
190
+     * @return Response
191 191
      */
192 192
     public function getResponse()
193 193
     {
@@ -248,7 +248,6 @@  discard block
 block discarded – undo
248 248
     /**
249 249
      * Get page content title to be themed in a layout or view
250 250
      *
251
-     * @param string $title
252 251
      */
253 252
     public function getBodyTitle()
254 253
     {
@@ -267,7 +266,6 @@  discard block
 block discarded – undo
267 266
 
268 267
     /**
269 268
      * Set both the title (header) and page title (body) at the same time
270
-     * @param string $title
271 269
      */
272 270
     public function getTitle()
273 271
     {
@@ -323,6 +321,8 @@  discard block
 block discarded – undo
323 321
     /**
324 322
      * Modify the action name coming from the URL into proper action name
325 323
      * @param string $name: The raw controller action name
324
+     * @param string $name
325
+     * @param string $httpMethod
326 326
      * @return string
327 327
      */
328 328
     public function urlToActionName($name, $httpMethod)
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      *
339 339
      * @param string $viewName
340 340
      * @param array $data
341
-     * @return string $html, view contents
341
+     * @return View $html, view contents
342 342
      */
343 343
     public function getView($viewName, $data = null, $templateRootFolder = null)
344 344
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@
 block discarded – undo
429 429
      */
430 430
     public function addCss($name, $file, $order = 10, $active = 1)
431 431
     {
432
-       $this->getResponse()
432
+        $this->getResponse()
433 433
             ->getTheme()
434 434
             ->addCss($name, $file, $order,$active);
435 435
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function addView($view, $data = null)
362 362
     {
363
-        if(!is_object($view))
363
+        if (!is_object($view))
364 364
             $view = new \erdiko\core\View($view, $data);
365
-        if($data != null)
365
+        if ($data != null)
366 366
             $view->setData($data);
367 367
         
368 368
         $this->appendContent($view->toHtml());
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      */
416 416
     public function setMeta($meta)
417 417
     {
418
-        foreach($meta as $name => $content)
418
+        foreach ($meta as $name => $content)
419 419
             $this->getResponse()->getTheme()->addMeta($name, $content);
420 420
     }
421 421
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     {
432 432
        $this->getResponse()
433 433
             ->getTheme()
434
-            ->addCss($name, $file, $order,$active);
434
+            ->addCss($name, $file, $order, $active);
435 435
     }
436 436
 
437 437
     /**
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     {
447 447
         $this->getResponse()
448 448
             ->getTheme()
449
-            ->addJs($name, $file, $order,$active);
449
+            ->addJs($name, $file, $order, $active);
450 450
     }
451 451
     
452 452
     /**
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -360,10 +360,12 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function addView($view, $data = null)
362 362
     {
363
-        if(!is_object($view))
364
-            $view = new \erdiko\core\View($view, $data);
365
-        if($data != null)
366
-            $view->setData($data);
363
+        if(!is_object($view)) {
364
+                    $view = new \erdiko\core\View($view, $data);
365
+        }
366
+        if($data != null) {
367
+                    $view->setData($data);
368
+        }
367 369
         
368 370
         $this->appendContent($view->toHtml());
369 371
     }
@@ -415,8 +417,9 @@  discard block
 block discarded – undo
415 417
      */
416 418
     public function setMeta($meta)
417 419
     {
418
-        foreach($meta as $name => $content)
419
-            $this->getResponse()->getTheme()->addMeta($name, $content);
420
+        foreach($meta as $name => $content) {
421
+                    $this->getResponse()->getTheme()->addMeta($name, $content);
422
+        }
420 423
     }
421 424
 
422 425
     /**
Please login to merge, or discard this patch.
src/datasource/File.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      *
121 121
      * @param string $filename
122 122
      * @param string $pathTo
123
-     * @param string $pathToFrom
124
-     * @return bool
123
+     * @param string $pathFrom
124
+     * @return boolean|null
125 125
      */
126 126
     public function move($filename, $pathTo, $pathFrom = null)
127 127
     {
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
      * Rename a file
141 141
      *
142 142
      * @param string $oldName
143
-     * @param string $pathTo
144
-     * @param string $pathToFrom
143
+     * @param string $pathToFile
144
+     * @param string $pathToFile
145 145
      * @return bool
146 146
      * @todo consider merging rename() and move() into one method
147 147
      */
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
     protected $_filePath = null;
23 23
     
24 24
     /**
25
-    * Contructor
26
-    *
27
-    * @param string $defaultPath
28
-    */
25
+     * Contructor
26
+     *
27
+     * @param string $defaultPath
28
+     */
29 29
     public function __construct($defaultPath = null)
30 30
     {
31 31
         if (isset($defaultPath)) {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
     public function __construct($defaultPath = null)
30 30
     {
31 31
         if (isset($defaultPath)) {
32
-            $this->_filePath=$defaultPath;
32
+            $this->_filePath = $defaultPath;
33 33
         } else {
34
-            $rootFolder=dirname(dirname(dirname(__DIR__)));
35
-            $this->_filePath=$rootFolder."/var";
34
+            $rootFolder = dirname(dirname(dirname(__DIR__)));
35
+            $this->_filePath = $rootFolder."/var";
36 36
         }
37 37
         if (!is_dir($this->_filePath)) {
38 38
             mkdir($this->_filePath, 0775, true);
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function read($filename, $pathToFile = null)
88 88
     {
89
-        if(!$this->fileExists($filename, $pathToFile))
89
+        if (!$this->fileExists($filename, $pathToFile))
90 90
             throw new \Exception("File, '{$filename}', does not exist.");
91 91
 
92
-        if ($pathToFile==null) {
92
+        if ($pathToFile == null) {
93 93
             return file_get_contents($this->_filePath."/".$filename);
94 94
         } else {
95 95
             return file_get_contents($pathToFile."/".$filename);
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function delete($filename, $pathToFile = null)
107 107
     {
108
-        if ($pathToFile==null) {
109
-            $pathToFile=$this->_filePath;
108
+        if ($pathToFile == null) {
109
+            $pathToFile = $this->_filePath;
110 110
         }
111 111
         if (file_exists($pathToFile."/".$filename)) {
112 112
             return unlink($pathToFile."/".$filename);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function move($filename, $pathTo, $pathFrom = null)
127 127
     {
128
-        if ($pathFrom==null) {
129
-            $pathFrom=$this->_filePath;
128
+        if ($pathFrom == null) {
129
+            $pathFrom = $this->_filePath;
130 130
         }
131 131
         if (file_exists($pathFrom."/".$filename)) {
132 132
             $this->createDir($pathTo);
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function rename($oldName, $newName, $pathToFile = null)
149 149
     {
150
-        if ($pathToFile==null) {
151
-            $pathToFile=$this->_filePath;
150
+        if ($pathToFile == null) {
151
+            $pathToFile = $this->_filePath;
152 152
         }
153 153
         if (file_exists($pathToFile."/".$oldName)) {
154 154
             $this->createDir($pathToFile);
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function copy($filename, $newFilePath, $newFileName = null, $pathToFile = null)
171 171
     {
172
-        if ($pathToFile==null) {
173
-            $pathToFile=$this->_filePath;
172
+        if ($pathToFile == null) {
173
+            $pathToFile = $this->_filePath;
174 174
         }
175
-        if ($newFileName==null) {
176
-            $newFileName=$filename;
175
+        if ($newFileName == null) {
176
+            $newFileName = $filename;
177 177
         }
178 178
         if (file_exists($pathToFile."/".$filename)) {
179 179
             return copy($pathToFile."/".$filename, $newFilePath."/".$newFileName);
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function fileExists($filename, $pathToFile = null)
193 193
     {
194
-        if ($pathToFile==null) {
195
-            $pathToFile=$this->_filePath;
194
+        if ($pathToFile == null) {
195
+            $pathToFile = $this->_filePath;
196 196
         }
197 197
         return file_exists($pathToFile."/".$filename);
198 198
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@
 block discarded – undo
86 86
      */
87 87
     public function read($filename, $pathToFile = null)
88 88
     {
89
-        if(!$this->fileExists($filename, $pathToFile))
90
-            throw new \Exception("File, '{$filename}', does not exist.");
89
+        if(!$this->fileExists($filename, $pathToFile)) {
90
+                    throw new \Exception("File, '{$filename}', does not exist.");
91
+        }
91 92
 
92 93
         if ($pathToFile==null) {
93 94
             return file_get_contents($this->_filePath."/".$filename);
Please login to merge, or discard this patch.
src/ErrorHandler.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -22,6 +22,9 @@
 block discarded – undo
22 22
 		register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler");
23 23
 	}
24 24
 
25
+	/**
26
+	 * @param integer $errno
27
+	 */
25 28
 	public static function errorHandler($errno, $errstr, $errfile, $errline)
26 29
 	{
27 30
 		$debug = \erdiko\core\ErrorHandler::isDebug();
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,70 +14,70 @@
 block discarded – undo
14 14
 
15 15
 class ErrorHandler 
16 16
 {
17
-	public static function init()
18
-	{
19
-		ini_set('html_errors',0);
20
-		error_reporting((E_ALL | E_STRICT));
21
-		set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler");
22
-		register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler");
23
-	}
17
+    public static function init()
18
+    {
19
+        ini_set('html_errors',0);
20
+        error_reporting((E_ALL | E_STRICT));
21
+        set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler");
22
+        register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler");
23
+    }
24 24
 
25
-	public static function errorHandler($errno, $errstr, $errfile, $errline)
26
-	{
27
-		$debug = \erdiko\core\ErrorHandler::isDebug();
28
-		if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) {
29
-			return null;
30
-		}
25
+    public static function errorHandler($errno, $errstr, $errfile, $errline)
26
+    {
27
+        $debug = \erdiko\core\ErrorHandler::isDebug();
28
+        if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) {
29
+            return null;
30
+        }
31 31
 
32
-		switch ( $errno ) {
33
-			case E_USER_ERROR:
34
-				$vars['msg_type']        = "USER ERROR";
35
-				$vars['msg_description'] = " Fatal error in line $errline of $errfile file";
36
-				$vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")";
37
-				break;
32
+        switch ( $errno ) {
33
+            case E_USER_ERROR:
34
+                $vars['msg_type']        = "USER ERROR";
35
+                $vars['msg_description'] = " Fatal error in line $errline of $errfile file";
36
+                $vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")";
37
+                break;
38 38
 
39
-			case E_USER_WARNING:
40
-				$vars['msg_type'] = "USER WARNING";
41
-				break;
39
+            case E_USER_WARNING:
40
+                $vars['msg_type'] = "USER WARNING";
41
+                break;
42 42
 
43
-			case E_USER_NOTICE:
44
-				$vars['msg_type'] = "USER NOTICE";
45
-				break;
43
+            case E_USER_NOTICE:
44
+                $vars['msg_type'] = "USER NOTICE";
45
+                break;
46 46
 
47
-			case E_ERROR:
48
-				$vars['msg_type'] = "ERROR";
49
-				$vars['msg_description'] = print_r(debug_backtrace(),1);
50
-				break;
47
+            case E_ERROR:
48
+                $vars['msg_type'] = "ERROR";
49
+                $vars['msg_description'] = print_r(debug_backtrace(),1);
50
+                break;
51 51
 
52
-			default:
53
-				$vars['msg_type'] = "Type of error: [$errno] $errstr";
54
-				$vars['msg_description'] = print_r(debug_backtrace(),1);
55
-				break;
56
-		}
52
+            default:
53
+                $vars['msg_type'] = "Type of error: [$errno] $errstr";
54
+                $vars['msg_description'] = print_r(debug_backtrace(),1);
55
+                break;
56
+        }
57 57
 
58
-		$vars['code']               = $errno;
59
-		$vars['error']              = trim($errstr);
60
-		$vars['path_info']          = $errfile . " on line " . $errline;
61
-		$vars['debug']              = $debug;
62
-		ToroHook::fire( "general_error", $vars );
58
+        $vars['code']               = $errno;
59
+        $vars['error']              = trim($errstr);
60
+        $vars['path_info']          = $errfile . " on line " . $errline;
61
+        $vars['debug']              = $debug;
62
+        ToroHook::fire( "general_error", $vars );
63 63
 
64
-		return false;
65
-	}
64
+        return false;
65
+    }
66 66
 
67
-	public static function fatalErrorShutdownHandler()
68
-	{
69
-		$last_error = error_get_last();
70
-		self::errorHandler(E_ERROR, 
71
-			$last_error['message'], $last_error['file'], $last_error['line']);
72
-	}
67
+    public static function fatalErrorShutdownHandler()
68
+    {
69
+        $last_error = error_get_last();
70
+        self::errorHandler(E_ERROR, 
71
+            $last_error['message'], $last_error['file'], $last_error['line']);
72
+    }
73 73
 
74
-	/**
75
-	 * isDebug
76
-	 *
77
-	 * @return bool
78
-	 */
79
-	public static function isDebug()
80
-	{
81
-		return (getenv("ERDIKO_DEBUG")=='1');
82
-	}
74
+    /**
75
+     * isDebug
76
+     *
77
+     * @return bool
78
+     */
79
+    public static function isDebug()
80
+    {
81
+        return (getenv("ERDIKO_DEBUG")=='1');
82
+    }
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 {
17 17
 	public static function init()
18 18
 	{
19
-		ini_set('html_errors',0);
19
+		ini_set('html_errors', 0);
20 20
 		error_reporting((E_ALL | E_STRICT));
21 21
 		set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler");
22 22
 		register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler");
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 	public static function errorHandler($errno, $errstr, $errfile, $errline)
26 26
 	{
27 27
 		$debug = \erdiko\core\ErrorHandler::isDebug();
28
-		if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) {
28
+		if (!(error_reporting() & $errno) || empty($errstr)) {
29 29
 			return null;
30 30
 		}
31 31
 
32
-		switch ( $errno ) {
32
+		switch ($errno) {
33 33
 			case E_USER_ERROR:
34 34
 				$vars['msg_type']        = "USER ERROR";
35 35
 				$vars['msg_description'] = " Fatal error in line $errline of $errfile file";
36
-				$vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")";
36
+				$vars['msg_description'] .= ", PHP ".PHP_VERSION." (".PHP_OS.")";
37 37
 				break;
38 38
 
39 39
 			case E_USER_WARNING:
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 
47 47
 			case E_ERROR:
48 48
 				$vars['msg_type'] = "ERROR";
49
-				$vars['msg_description'] = print_r(debug_backtrace(),1);
49
+				$vars['msg_description'] = print_r(debug_backtrace(), 1);
50 50
 				break;
51 51
 
52 52
 			default:
53 53
 				$vars['msg_type'] = "Type of error: [$errno] $errstr";
54
-				$vars['msg_description'] = print_r(debug_backtrace(),1);
54
+				$vars['msg_description'] = print_r(debug_backtrace(), 1);
55 55
 				break;
56 56
 		}
57 57
 
58 58
 		$vars['code']               = $errno;
59 59
 		$vars['error']              = trim($errstr);
60
-		$vars['path_info']          = $errfile . " on line " . $errline;
60
+		$vars['path_info']          = $errfile." on line ".$errline;
61 61
 		$vars['debug']              = $debug;
62
-		ToroHook::fire( "general_error", $vars );
62
+		ToroHook::fire("general_error", $vars);
63 63
 
64 64
 		return false;
65 65
 	}
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function isDebug()
80 80
 	{
81
-		return (getenv("ERDIKO_DEBUG")=='1');
81
+		return (getenv("ERDIKO_DEBUG") == '1');
82 82
 	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
src/Helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     /**
39 39
      * Read JSON config file and return array
40 40
      *
41
-     * @param string $file
41
+     * @param string $filename
42 42
      * @return array $config
43 43
      */
44 44
     public static function getConfigFile($filename)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * Log Object
19 19
      */
20
-    protected static $_logObject=null; // @todo get rid of this
20
+    protected static $_logObject = null; // @todo get rid of this
21 21
 
22 22
     /**
23 23
      * Load a view from the current theme with the given data
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public static function getConfig($name = 'application', $context = null)
66 66
     {
67
-        if($context == null)
67
+        if ($context == null)
68 68
             $context = getenv('ERDIKO_CONTEXT');
69 69
 
70 70
         $filename = ERDIKO_APP."/config/{$context}/{$name}.json";
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public static function getRoutes($context = null)
80 80
     {
81
-        if($context == null)
81
+        if ($context == null)
82 82
             $context = getenv('ERDIKO_CONTEXT');
83 83
         $file = ERDIKO_APP."/config/{$context}/routes.json";
84 84
         $applicationConfig = self::getConfigFile($file);
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public static function sendEmail($toEmail, $subject, $body, $fromEmail)
94 94
     {
95
-        $headers = "From: $fromEmail\r\n" .
96
-            "Reply-To: $fromEmail\r\n" .
97
-            "X-Mailer: PHP/" . phpversion();
95
+        $headers = "From: $fromEmail\r\n".
96
+            "Reply-To: $fromEmail\r\n".
97
+            "X-Mailer: PHP/".phpversion();
98 98
         
99 99
         return mail($toEmail, $subject, $body, $headers);
100 100
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function log($level, $message, array $context = array())
114 114
     {
115
-        if(self::$_logObject==null)
115
+        if (self::$_logObject == null)
116 116
         {
117 117
             $erdikoContext = getenv('ERDIKO_CONTEXT');
118 118
             $config = self::getConfig("application", $erdikoContext);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             self::$_logObject = new \erdiko\core\Logger($logFiles, $logDir);
123 123
         }
124 124
 
125
-        if(empty($level))
125
+        if (empty($level))
126 126
             $level = \Psr\Log\LogLevel::DEBUG; // Default to debug for convenience
127 127
 
128 128
         return self::$_logObject->log($level, $message, $context);
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public static function getConfig($name = 'application', $context = null)
66 66
     {
67
-        if($context == null)
68
-            $context = getenv('ERDIKO_CONTEXT');
67
+        if($context == null) {
68
+                    $context = getenv('ERDIKO_CONTEXT');
69
+        }
69 70
 
70 71
         $filename = ERDIKO_APP."/config/{$context}/{$name}.json";
71 72
         return self::getConfigFile($filename);
@@ -78,8 +79,9 @@  discard block
 block discarded – undo
78 79
      */
79 80
     public static function getRoutes($context = null)
80 81
     {
81
-        if($context == null)
82
-            $context = getenv('ERDIKO_CONTEXT');
82
+        if($context == null) {
83
+                    $context = getenv('ERDIKO_CONTEXT');
84
+        }
83 85
         $file = ERDIKO_APP."/config/{$context}/routes.json";
84 86
         $applicationConfig = self::getConfigFile($file);
85 87
         
@@ -122,8 +124,10 @@  discard block
 block discarded – undo
122 124
             self::$_logObject = new \erdiko\core\Logger($logFiles, $logDir);
123 125
         }
124 126
 
125
-        if(empty($level))
126
-            $level = \Psr\Log\LogLevel::DEBUG; // Default to debug for convenience
127
+        if(empty($level)) {
128
+                    $level = \Psr\Log\LogLevel::DEBUG;
129
+        }
130
+        // Default to debug for convenience
127 131
 
128 132
         return self::$_logObject->log($level, $message, $context);
129 133
     }
Please login to merge, or discard this patch.
src/Layout.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param string $template , Theme Object (Contaier)
36 36
      * @param mixed $data
37
-     * @param string $theme
37
+     * @param string $themeName
38 38
      */
39 39
     public function __construct($template = null, $data = array(), $themeName = null)
40 40
     {
@@ -97,7 +97,6 @@  discard block
 block discarded – undo
97 97
     /**
98 98
      * Get Theme Root Folder
99 99
      *
100
-     * @param string $folder
101 100
      */
102 101
     public function getThemeRootFolder()
103 102
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@
 block discarded – undo
171 171
      */
172 172
     public function getRegion($name)
173 173
     {
174
-        if(array_key_exists($name, $this->_regions)) {
174
+        if (array_key_exists($name, $this->_regions)) {
175 175
             $html = (is_subclass_of($this->_regions[$name], 'erdiko\core\Container')) ?
176 176
                 $this->_regions[$name]->toHtml() : $this->_regions[$name];
177 177
         } else {
Please login to merge, or discard this patch.
src/Logger.php 3 patches
Doc Comments   +14 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param string $level
60 60
      * @param string or an object with a __toString() method$ message
61 61
      * @param array $context
62
-     * @return bool
62
+     * @return integer|null
63 63
      */
64 64
     public function log($level, $message, array $context = array())
65 65
     {
@@ -103,7 +103,8 @@  discard block
 block discarded – undo
103 103
      * @param string $level
104 104
      * @param string or an object with a __toString() method$ message
105 105
      * @param array $context
106
-     * @return bool
106
+     * @param string $message
107
+     * @return integer
107 108
      */
108 109
     public function addRecord($level, $message, array $context = array())
109 110
     {
@@ -119,10 +120,10 @@  discard block
 block discarded – undo
119 120
      * The message MAY contain placeholders which implementors MAY replace with values from the context array.
120 121
      * Placeholder names MUST correspond to keys in the context array.
121 122
      *
122
-     * @param string $level
123 123
      * @param string or an object with a __toString() method$ message
124 124
      * @param array $context
125
-     * @return bool
125
+     * @param string $message
126
+     * @return string
126 127
      */
127 128
     function interpolate($message, array $context = array())
128 129
     {
@@ -146,7 +147,7 @@  discard block
 block discarded – undo
146 147
      *
147 148
      * @param mixed $key
148 149
      * @param string $logFileName
149
-     * @return bool
150
+     * @return string
150 151
      */
151 152
     public function addLogFile($key, $logFileName)
152 153
     {
@@ -202,7 +203,7 @@  discard block
 block discarded – undo
202 203
      * @param string $message
203 204
      * @param array $context
204 205
      *
205
-     * @return null
206
+     * @return integer
206 207
      */
207 208
     public function emergency($message, array $context = array())
208 209
     {
@@ -219,7 +220,7 @@  discard block
 block discarded – undo
219 220
      * @param string $message
220 221
      * @param array $context
221 222
      *
222
-     * @return null
223
+     * @return integer
223 224
      */
224 225
     public function alert($message, array $context = array())
225 226
     {
@@ -235,7 +236,7 @@  discard block
 block discarded – undo
235 236
      * @param string $message
236 237
      * @param array $context
237 238
      *
238
-     * @return null
239
+     * @return integer
239 240
      */
240 241
     public function critical($message, array $context = array())
241 242
     {
@@ -250,7 +251,7 @@  discard block
 block discarded – undo
250 251
      * @param string $message
251 252
      * @param array $context
252 253
      *
253
-     * @return null
254
+     * @return integer
254 255
      */
255 256
     public function error($message, array $context = array())
256 257
     {
@@ -267,7 +268,7 @@  discard block
 block discarded – undo
267 268
      * @param string $message
268 269
      * @param array $context
269 270
      *
270
-     * @return null
271
+     * @return integer
271 272
      */
272 273
     public function warning($message, array $context = array())
273 274
     {
@@ -281,7 +282,7 @@  discard block
 block discarded – undo
281 282
      * @param string $message
282 283
      * @param array $context
283 284
      *
284
-     * @return null
285
+     * @return integer
285 286
      */
286 287
     public function notice($message, array $context = array())
287 288
     {
@@ -297,7 +298,7 @@  discard block
 block discarded – undo
297 298
      * @param string $message
298 299
      * @param array $context
299 300
      *
300
-     * @return null
301
+     * @return integer
301 302
      */
302 303
     public function info($message, array $context = array())
303 304
     {
@@ -311,7 +312,7 @@  discard block
 block discarded – undo
311 312
      * @param string $message
312 313
      * @param array $context
313 314
      *
314
-     * @return null
315
+     * @return integer
315 316
      */
316 317
     public function debug($message, array $context = array())
317 318
     {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -162,17 +162,17 @@
 block discarded – undo
162 162
      */
163 163
     public function removeLogFile($key)
164 164
     {
165
-         $arrayKey=strtolower($key);
166
-         unset($this->_logFiles[$arrayKey]);
167
-         return true;
165
+            $arrayKey=strtolower($key);
166
+            unset($this->_logFiles[$arrayKey]);
167
+            return true;
168 168
     }
169 169
 
170
-     /**
171
-      * Clear Log
172
-      *
173
-      * @param string $logKey
174
-      * @return bool
175
-      */
170
+        /**
171
+         * Clear Log
172
+         *
173
+         * @param string $logKey
174
+         * @return bool
175
+         */
176 176
     public function clearLog($logKey = null)
177 177
     {
178 178
         $ret=true;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
     public function addRecord($level, $message, array $context = array())
109 109
     {
110 110
         $message = (string) $message;
111
-        $logString=date('Y-m-d H:i:s')." ".$level.": ".$this->interpolate($message, $context).PHP_EOL;
112
-        $logFileName=$this->_logFiles["default"]; // If log key is null use the default log file
111
+        $logString = date('Y-m-d H:i:s')." ".$level.": ".$this->interpolate($message, $context).PHP_EOL;
112
+        $logFileName = $this->_logFiles["default"]; // If log key is null use the default log file
113 113
 
114 114
         return $this->write($logString, $logFileName, null, "a");
115 115
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
         $replace = array();
131 131
         foreach ($context as $key => $val) {
132 132
             if ($key == "exception" && $val instanceof \Exception) {
133
-                $replace['{' . $key . '}'] = $val->getMessage();
133
+                $replace['{'.$key.'}'] = $val->getMessage();
134 134
             } else {
135
-                $replace['{' . $key . '}'] = $val;
135
+                $replace['{'.$key.'}'] = $val;
136 136
             }
137 137
         }
138 138
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function addLogFile($key, $logFileName)
152 152
     {
153
-        $arrayKey=strtolower($key);
153
+        $arrayKey = strtolower($key);
154 154
         return $this->_logFiles[$arrayKey] = $logFileName;
155 155
     }
156 156
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function removeLogFile($key)
164 164
     {
165
-         $arrayKey=strtolower($key);
165
+         $arrayKey = strtolower($key);
166 166
          unset($this->_logFiles[$arrayKey]);
167 167
          return true;
168 168
     }
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
       */
176 176
     public function clearLog($logKey = null)
177 177
     {
178
-        $ret=true;
179
-        if ($logKey==null) {
178
+        $ret = true;
179
+        if ($logKey == null) {
180 180
             foreach ($this->_logFiles as $key => $logFile) {
181 181
                 $ret = $ret && $this->write("", $logFile);
182 182
             }
183 183
             return $ret;
184 184
         } else {
185
-            $arrayKey=strtolower($logKey);
185
+            $arrayKey = strtolower($logKey);
186 186
             if (isset($this->_logFiles[$arrayKey])) {
187 187
                 return $this->write("", $this->_logFiles[$arrayKey]);
188 188
             } else {
Please login to merge, or discard this patch.
src/Response.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * Set key value data
42 42
      *
43
-     * @param mixed $key
43
+     * @param string $key
44 44
      * @param mixed $value
45 45
      */
46 46
     public function setKeyValue($key, $value)
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * Get data value by key
53 53
      *
54
-     * @param mixed $key
54
+     * @param string $key
55 55
      * @return mixed
56 56
      */
57 57
     public function getKeyValue($key)
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * Set theme
75 75
      *
76
-     * @param Theme object $theme - Theme Object (Container)
76
+     * @param Theme Theme $theme - Theme Object (Container)
77 77
      */
78 78
     public function setTheme($theme)
79 79
     {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     /**
125 125
      * Set Theme Template
126 126
      *
127
-     * @param string $tamplate
127
+     * @param string $template
128 128
      */
129 129
     public function setThemeTemplate($template)
130 130
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function getKeyValue($key)
58 58
     {
59
-        return empty($this->_data[$key]) ? null: $this->_data[$key];
59
+        return empty($this->_data[$key]) ? null : $this->_data[$key];
60 60
     }
61 61
 
62 62
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function addTypedKeyValue($type, $key, $value)
67 67
     {
68
-        if(empty($this->_data[$type]))
68
+        if (empty($this->_data[$type]))
69 69
             $this->_data[$type] = array();
70 70
         $this->_data[$type][$key] = $value;
71 71
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function getTheme()
89 89
     {
90
-        if($this->_theme === null)
90
+        if ($this->_theme === null)
91 91
             $this->_theme = new \erdiko\core\Theme($this->getThemeName(), null, $this->getThemeTemplate());
92 92
 
93 93
         return $this->_theme;
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function getThemeName()
113 113
     {
114
-        if(!empty($this->_themeName))
114
+        if (!empty($this->_themeName))
115 115
             $name = $this->_themeName;
116
-        elseif(!empty($this->_theme))
116
+        elseif (!empty($this->_theme))
117 117
             $name = $this->_theme->getName();
118 118
         else
119 119
             $name = Helper::getConfig()['theme']['name'];
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function addTypedKeyValue($type, $key, $value)
67 67
     {
68
-        if(empty($this->_data[$type]))
69
-            $this->_data[$type] = array();
68
+        if(empty($this->_data[$type])) {
69
+                    $this->_data[$type] = array();
70
+        }
70 71
         $this->_data[$type][$key] = $value;
71 72
     }
72 73
 
@@ -87,8 +88,9 @@  discard block
 block discarded – undo
87 88
      */
88 89
     public function getTheme()
89 90
     {
90
-        if($this->_theme === null)
91
-            $this->_theme = new \erdiko\core\Theme($this->getThemeName(), null, $this->getThemeTemplate());
91
+        if($this->_theme === null) {
92
+                    $this->_theme = new \erdiko\core\Theme($this->getThemeName(), null, $this->getThemeTemplate());
93
+        }
92 94
 
93 95
         return $this->_theme;
94 96
     }
@@ -111,12 +113,13 @@  discard block
 block discarded – undo
111 113
      */
112 114
     public function getThemeName()
113 115
     {
114
-        if(!empty($this->_themeName))
115
-            $name = $this->_themeName;
116
-        elseif(!empty($this->_theme))
117
-            $name = $this->_theme->getName();
118
-        else
119
-            $name = Helper::getConfig()['theme']['name'];
116
+        if(!empty($this->_themeName)) {
117
+                    $name = $this->_themeName;
118
+        } elseif(!empty($this->_theme)) {
119
+                    $name = $this->_theme->getName();
120
+        } else {
121
+                    $name = Helper::getConfig()['theme']['name'];
122
+        }
120 123
         
121 124
         return $name;
122 125
     }
Please login to merge, or discard this patch.
src/Template.php 3 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,6 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * Get template
54 54
      *
55
-     * @param string $template
56 55
      */
57 56
     public function getTemplate()
58 57
     {
@@ -62,7 +61,6 @@  discard block
 block discarded – undo
62 61
     /**
63 62
      * Get default template name
64 63
      *
65
-     * @param string $template
66 64
      */
67 65
     public function getDefaultTemplate()
68 66
     {
@@ -82,7 +80,7 @@  discard block
 block discarded – undo
82 80
     /**
83 81
      * Set template root folder
84 82
      *
85
-     * @param string $TemplateRootFolder
83
+     * @param string $templateRootFolder
86 84
      */
87 85
     public function setTemplateRootFolder($templateRootFolder)
88 86
     {
@@ -119,6 +117,7 @@  discard block
 block discarded – undo
119 117
 
120 118
     /**
121 119
      * Set Template folder
120
+     * @param string $templateFolder
122 121
      */
123 122
     public function setTemplateFolder($templateFolder)
124 123
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     {
164 164
         // Capitalize first letter of the key to preserve camel case convention naming
165 165
         $method = 'set'.ucfirst($key);
166
-        if(is_callable(array($this, $method))) {
166
+        if (is_callable(array($this, $method))) {
167 167
             $this->$method($value); // Execute the native setter function
168 168
         } else {
169 169
             $this->_data[$key] = $value;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $value = null;
176 176
 
177
-        if(array_key_exists($key, $this->_data))
177
+        if (array_key_exists($key, $this->_data))
178 178
             $value = $this->_data[$key];
179 179
 
180 180
         return $value;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,8 +174,9 @@
 block discarded – undo
174 174
     {
175 175
         $value = null;
176 176
 
177
-        if(array_key_exists($key, $this->_data))
178
-            $value = $this->_data[$key];
177
+        if(array_key_exists($key, $this->_data)) {
178
+                    $value = $this->_data[$key];
179
+        }
179 180
 
180 181
         return $value;
181 182
     }
Please login to merge, or discard this patch.