| @@ -49,7 +49,7 @@ discard block | ||
| 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 | ||
| 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) | 
| @@ -31,8 +31,8 @@ | ||
| 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 | } | 
| @@ -187,7 +187,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 |      { | 
| @@ -429,7 +429,7 @@ | ||
| 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 | } | 
| @@ -360,9 +360,9 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | /** | 
| @@ -360,10 +360,12 @@ discard block | ||
| 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 | ||
| 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 | /** | 
| @@ -120,8 +120,8 @@ discard block | ||
| 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 | ||
| 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 | */ | 
| @@ -22,10 +22,10 @@ | ||
| 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)) { | 
| @@ -29,10 +29,10 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | } | 
| @@ -86,8 +86,9 @@ | ||
| 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); | 
| @@ -22,6 +22,9 @@ | ||
| 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(); | 
| @@ -14,73 +14,73 @@ | ||
| 14 | 14 | |
| 15 | 15 | class ErrorHandler | 
| 16 | 16 |  { | 
| 17 | - public static function init() | |
| 18 | -	{ | |
| 19 | -		ini_set('html_errors',0); // @todo review this line | |
| 20 | - // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject | |
| 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); // @todo review this line | |
| 20 | + // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject | |
| 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 | 32 | $errorHook = "500"; | 
| 33 | 33 | |
| 34 | -		switch ( $errno ) { | |
| 35 | - case E_USER_ERROR: | |
| 36 | - $vars['msg_type'] = "USER ERROR"; | |
| 37 | - $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; | |
| 38 | -				$vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; | |
| 39 | - break; | |
| 34 | +        switch ( $errno ) { | |
| 35 | + case E_USER_ERROR: | |
| 36 | + $vars['msg_type'] = "USER ERROR"; | |
| 37 | + $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; | |
| 38 | +                $vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; | |
| 39 | + break; | |
| 40 | 40 | |
| 41 | - case E_USER_WARNING: | |
| 42 | - $vars['msg_type'] = "USER WARNING"; | |
| 43 | - break; | |
| 41 | + case E_USER_WARNING: | |
| 42 | + $vars['msg_type'] = "USER WARNING"; | |
| 43 | + break; | |
| 44 | 44 | |
| 45 | - case E_USER_NOTICE: | |
| 46 | - $vars['msg_type'] = "USER NOTICE"; | |
| 47 | - break; | |
| 45 | + case E_USER_NOTICE: | |
| 46 | + $vars['msg_type'] = "USER NOTICE"; | |
| 47 | + break; | |
| 48 | 48 | |
| 49 | - case E_ERROR: | |
| 50 | - $vars['msg_type'] = "ERROR"; | |
| 51 | - $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 52 | - break; | |
| 49 | + case E_ERROR: | |
| 50 | + $vars['msg_type'] = "ERROR"; | |
| 51 | + $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 52 | + break; | |
| 53 | 53 | |
| 54 | - default: | |
| 55 | - $vars['msg_type'] = "Type of error: [$errno] $errstr"; | |
| 56 | - $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 57 | - break; | |
| 58 | - } | |
| 54 | + default: | |
| 55 | + $vars['msg_type'] = "Type of error: [$errno] $errstr"; | |
| 56 | + $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 57 | + break; | |
| 58 | + } | |
| 59 | 59 | |
| 60 | - $vars['code'] = $errno; | |
| 61 | - $vars['error'] = trim($errstr); | |
| 62 | - $vars['path_info'] = $errfile . " on line " . $errline; | |
| 63 | - $vars['debug'] = $debug; | |
| 60 | + $vars['code'] = $errno; | |
| 61 | + $vars['error'] = trim($errstr); | |
| 62 | + $vars['path_info'] = $errfile . " on line " . $errline; | |
| 63 | + $vars['debug'] = $debug; | |
| 64 | 64 | |
| 65 | - ToroHook::fire($errorHook, $vars ); | |
| 65 | + ToroHook::fire($errorHook, $vars ); | |
| 66 | 66 | |
| 67 | - return false; | |
| 68 | - } | |
| 67 | + return false; | |
| 68 | + } | |
| 69 | 69 | |
| 70 | - public static function fatalErrorShutdownHandler() | |
| 71 | -	{ | |
| 72 | - $last_error = error_get_last(); | |
| 73 | - static::errorHandler(E_ERROR, | |
| 74 | - $last_error['message'], $last_error['file'], $last_error['line']); | |
| 75 | - } | |
| 70 | + public static function fatalErrorShutdownHandler() | |
| 71 | +    { | |
| 72 | + $last_error = error_get_last(); | |
| 73 | + static::errorHandler(E_ERROR, | |
| 74 | + $last_error['message'], $last_error['file'], $last_error['line']); | |
| 75 | + } | |
| 76 | 76 | |
| 77 | - /** | |
| 78 | - * isDebug | |
| 79 | - * | |
| 80 | - * @return bool | |
| 81 | - */ | |
| 82 | - public static function isDebug() | |
| 83 | -	{ | |
| 84 | -		return (getenv("ERDIKO_DEBUG")=='1'); | |
| 85 | - } | |
| 77 | + /** | |
| 78 | + * isDebug | |
| 79 | + * | |
| 80 | + * @return bool | |
| 81 | + */ | |
| 82 | + public static function isDebug() | |
| 83 | +    { | |
| 84 | +        return (getenv("ERDIKO_DEBUG")=='1'); | |
| 85 | + } | |
| 86 | 86 | } | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 |  { | 
| 17 | 17 | public static function init() | 
| 18 | 18 |  	{ | 
| 19 | -		ini_set('html_errors',0); // @todo review this line | |
| 19 | +		ini_set('html_errors', 0); // @todo review this line | |
| 20 | 20 | // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject | 
| 21 | 21 |  		set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler"); | 
| 22 | 22 |  		register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler"); | 
| @@ -25,17 +25,17 @@ discard block | ||
| 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 | 32 | $errorHook = "500"; | 
| 33 | 33 | |
| 34 | -		switch ( $errno ) { | |
| 34 | +		switch ($errno) { | |
| 35 | 35 | case E_USER_ERROR: | 
| 36 | 36 | $vars['msg_type'] = "USER ERROR"; | 
| 37 | 37 | $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; | 
| 38 | -				$vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; | |
| 38 | +				$vars['msg_description'] .= ", PHP ".PHP_VERSION." (".PHP_OS.")"; | |
| 39 | 39 | break; | 
| 40 | 40 | |
| 41 | 41 | case E_USER_WARNING: | 
| @@ -48,21 +48,21 @@ discard block | ||
| 48 | 48 | |
| 49 | 49 | case E_ERROR: | 
| 50 | 50 | $vars['msg_type'] = "ERROR"; | 
| 51 | - $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 51 | + $vars['msg_description'] = print_r(debug_backtrace(), 1); | |
| 52 | 52 | break; | 
| 53 | 53 | |
| 54 | 54 | default: | 
| 55 | 55 | $vars['msg_type'] = "Type of error: [$errno] $errstr"; | 
| 56 | - $vars['msg_description'] = print_r(debug_backtrace(),1); | |
| 56 | + $vars['msg_description'] = print_r(debug_backtrace(), 1); | |
| 57 | 57 | break; | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | $vars['code'] = $errno; | 
| 61 | 61 | $vars['error'] = trim($errstr); | 
| 62 | - $vars['path_info'] = $errfile . " on line " . $errline; | |
| 63 | - $vars['debug'] = $debug; | |
| 62 | + $vars['path_info'] = $errfile." on line ".$errline; | |
| 63 | + $vars['debug'] = $debug; | |
| 64 | 64 | |
| 65 | - ToroHook::fire($errorHook, $vars ); | |
| 65 | + ToroHook::fire($errorHook, $vars); | |
| 66 | 66 | |
| 67 | 67 | return false; | 
| 68 | 68 | } | 
| @@ -81,6 +81,6 @@ discard block | ||
| 81 | 81 | */ | 
| 82 | 82 | public static function isDebug() | 
| 83 | 83 |  	{ | 
| 84 | -		return (getenv("ERDIKO_DEBUG")=='1'); | |
| 84 | +		return (getenv("ERDIKO_DEBUG") == '1'); | |
| 85 | 85 | } | 
| 86 | 86 | } | 
| @@ -34,7 +34,7 @@ discard block | ||
| 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 | ||
| 97 | 97 | /** | 
| 98 | 98 | * Get Theme Root Folder | 
| 99 | 99 | * | 
| 100 | - * @param string $folder | |
| 101 | 100 | */ | 
| 102 | 101 | public function getThemeRootFolder() | 
| 103 | 102 |      { | 
| @@ -171,7 +171,7 @@ | ||
| 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 { | 
| @@ -40,7 +40,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 |      { | 
| @@ -56,7 +56,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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']; | 
| @@ -65,8 +65,9 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | } | 
| @@ -52,7 +52,6 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 119 | 117 | |
| 120 | 118 | /** | 
| 121 | 119 | * Set Template folder | 
| 120 | + * @param string $templateFolder | |
| 122 | 121 | */ | 
| 123 | 122 | public function setTemplateFolder($templateFolder) | 
| 124 | 123 |      { | 
| @@ -163,7 +163,7 @@ discard block | ||
| 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 | ||
| 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; | 
| @@ -174,8 +174,9 @@ | ||
| 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 | } | 
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | * Constructor | 
| 19 | 19 | * @param string $template | 
| 20 | 20 | * @param mixed $data | 
| 21 | - * @param string $templateFolder | |
| 21 | + * @param string $templateRootFolder | |
| 22 | 22 | */ | 
| 23 | 23 | public function __construct($template = null, $data = null, $templateRootFolder = ERDIKO_APP) | 
| 24 | 24 |      { | 
| @@ -21,19 +21,19 @@ | ||
| 21 | 21 | class ApiController extends Controller | 
| 22 | 22 |  { | 
| 23 | 23 | |
| 24 | - /** | |
| 25 | - * Contructor | |
| 26 | - */ | |
| 24 | + /** | |
| 25 | + * Contructor | |
| 26 | + */ | |
| 27 | 27 | public function __construct() | 
| 28 | 28 |      { | 
| 29 | 29 | $this->_webroot = ERDIKO_ROOT; | 
| 30 | 30 | $this->_response = new \erdiko\core\ApiResponse; | 
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | - /** | |
| 34 | - * setStatusCode | |
| 35 | - * | |
| 36 | - */ | |
| 33 | + /** | |
| 34 | + * setStatusCode | |
| 35 | + * | |
| 36 | + */ | |
| 37 | 37 | public function setStatusCode($code = null) | 
| 38 | 38 |      { | 
| 39 | 39 |          if (!empty($code)) { |