@@ -178,20 +178,20 @@ |
||
178 | 178 | $config['log_logger_name'] = array(); |
179 | 179 | |
180 | 180 | /** |
181 | - * The logger name custom level to use for the log |
|
182 | - * |
|
183 | - * If this config is set so means the logger level will be used to overwrite |
|
184 | - * the default log level configuration above. |
|
185 | - * |
|
186 | - * Example: |
|
187 | - * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
188 | - * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
189 | - * will be saved for WARNING message and above |
|
190 | - * Note: You can also use an regular expression for the logger name. |
|
191 | - * Example: |
|
192 | - * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
193 | - * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
194 | - */ |
|
181 | + * The logger name custom level to use for the log |
|
182 | + * |
|
183 | + * If this config is set so means the logger level will be used to overwrite |
|
184 | + * the default log level configuration above. |
|
185 | + * |
|
186 | + * Example: |
|
187 | + * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
188 | + * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
189 | + * will be saved for WARNING message and above |
|
190 | + * Note: You can also use an regular expression for the logger name. |
|
191 | + * Example: |
|
192 | + * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
193 | + * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
194 | + */ |
|
195 | 195 | $config['log_logger_name_level'] = array(); |
196 | 196 | |
197 | 197 |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | die(); |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Function defined for PHP error message handling |
|
203 | - * |
|
204 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
205 | - * @param string $errstr the error message |
|
206 | - * @param string $errfile the file where the error occurred |
|
207 | - * @param int $errline the line number where the error occurred |
|
208 | - * @codeCoverageIgnore |
|
209 | - * |
|
210 | - * @return boolean |
|
211 | - */ |
|
201 | + /** |
|
202 | + * Function defined for PHP error message handling |
|
203 | + * |
|
204 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
205 | + * @param string $errstr the error message |
|
206 | + * @param string $errfile the file where the error occurred |
|
207 | + * @param int $errline the line number where the error occurred |
|
208 | + * @codeCoverageIgnore |
|
209 | + * |
|
210 | + * @return boolean |
|
211 | + */ |
|
212 | 212 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
213 | 213 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
214 | 214 | if ($isError) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | break; |
230 | 230 | } |
231 | 231 | show_error('An error is occurred in the file <b>' . $errfile . '</b> at line <b>' |
232 | - . $errline . '</b> raison : ' . $errstr, 'PHP ' . $errorType); |
|
232 | + . $errline . '</b> raison : ' . $errstr, 'PHP ' . $errorType); |
|
233 | 233 | } |
234 | 234 | if ($isError) { |
235 | 235 | die(); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $keysList = array(); |
415 | 415 | foreach ($keys as $k => $v) { |
416 | 416 | $v = $this->checkForNullValue($v); |
417 | - if (! is_numeric($v)) { |
|
417 | + if (!is_numeric($v)) { |
|
418 | 418 | $v = $this->connection->escape($v, $escape); |
419 | 419 | } |
420 | 420 | $keysList[] = $v; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string|null |
729 | 729 | */ |
730 | - protected function buildQueryPart($property, $command = ''){ |
|
730 | + protected function buildQueryPart($property, $command = '') { |
|
731 | 731 | if (!empty($this->{$property})) { |
732 | 732 | return $command . $this->{$property}; |
733 | 733 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | * @param string $clause the clause type "IS NULL", "IS NOT NULLs" |
743 | 743 | * @return object the current DatabaseQueryBuilder instance |
744 | 744 | */ |
745 | - protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL'){ |
|
745 | + protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL') { |
|
746 | 746 | if (is_array($field)) { |
747 | 747 | foreach ($field as $f) { |
748 | 748 | $this->whereIsNullAndNotNull($f, $andOr, $clause); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | * |
761 | 761 | * @return object the current instance |
762 | 762 | */ |
763 | - protected function setSelectStr($newSelect){ |
|
763 | + protected function setSelectStr($newSelect) { |
|
764 | 764 | $this->select = (($this->select == '*' || empty($this->select)) |
765 | 765 | ? $newSelect |
766 | 766 | : $this->select . ', ' . $newSelect); |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | * @return string the empty string if the value is null |
775 | 775 | * otherwise the same value will be returned |
776 | 776 | */ |
777 | - protected function checkForNullValue($value){ |
|
778 | - if(is_null($value)){ |
|
777 | + protected function checkForNullValue($value) { |
|
778 | + if (is_null($value)) { |
|
779 | 779 | return ''; |
780 | 780 | } |
781 | 781 | return $value; |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * Setting the route configuration using the configuration file |
|
281 | - * and additional configuration from param |
|
282 | - * @param array $overwriteConfig the additional configuration |
|
283 | - * to overwrite with the existing one |
|
284 | - * @param boolean $useConfigFile whether to use route configuration file |
|
285 | - * |
|
286 | - * @return object |
|
287 | - */ |
|
280 | + * Setting the route configuration using the configuration file |
|
281 | + * and additional configuration from param |
|
282 | + * @param array $overwriteConfig the additional configuration |
|
283 | + * to overwrite with the existing one |
|
284 | + * @param boolean $useConfigFile whether to use route configuration file |
|
285 | + * |
|
286 | + * @return object |
|
287 | + */ |
|
288 | 288 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
289 | 289 | $route = array(); |
290 | 290 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | //the URL like http://domain.com/module/controller/method/arg1/arg2 |
366 | 366 | if (!$this->controller) { |
367 | 367 | $this->logger->info('Cannot determine the routing information ' |
368 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
368 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
369 | 369 | //determine route parameters using the route URI param |
370 | 370 | $this->determineRouteParamsFromRequestUri(); |
371 | 371 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | - /** |
|
482 | - * Remove the URL suffix and query string values if exists |
|
483 | - * @param string $uri the route URI to process |
|
484 | - * @return string the final route uri after processed |
|
485 | - */ |
|
481 | + /** |
|
482 | + * Remove the URL suffix and query string values if exists |
|
483 | + * @param string $uri the route URI to process |
|
484 | + * @return string the final route uri after processed |
|
485 | + */ |
|
486 | 486 | protected function removeSuffixAndQueryStringFromUri($uri) { |
487 | 487 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
488 | 488 | //remove url suffix from the request URI |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $this->logger->info( |
597 | 597 | 'After loop in predefined routes configuration,' |
598 | 598 | . 'the module name is set but the controller is not set,' |
599 | - . 'so we will use module as the controller' |
|
599 | + . 'so we will use module as the controller' |
|
600 | 600 | ); |
601 | 601 | $this->controller = $this->module; |
602 | 602 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
451 | 451 | * @return void |
452 | 452 | */ |
453 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
453 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
454 | 454 | $segment = $this->segments; |
455 | 455 | $globals = & class_loader('GlobalVar', 'classes'); |
456 | 456 | $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos( |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | break; |
582 | 582 | } |
583 | 583 | } |
584 | - if($findIndex !== -1){ |
|
584 | + if ($findIndex !== -1) { |
|
585 | 585 | //$args[0] => full string captured by preg_match |
586 | 586 | //$args[1], $args[2], $args[n] => contains the value of |
587 | 587 | //(:num), (:alpha), (:alnum), (:any) |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * Find file path of the current controller using the current module |
607 | 607 | * @return boolean true if the file path is found otherwise false. |
608 | 608 | */ |
609 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
609 | + protected function findControllerFullPathUsingCurrentModule() { |
|
610 | 610 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
611 | 611 | if (!$path) { |
612 | 612 | $this->logger->info('The controller [' . $this->controller . '] not ' |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * or the current request does not use module |
624 | 624 | * @return void |
625 | 625 | */ |
626 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
626 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
627 | 627 | $segment = $this->segments; |
628 | 628 | //controller |
629 | 629 | if (isset($segment[0])) { |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | * or the current request use module |
645 | 645 | * @return void |
646 | 646 | */ |
647 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
647 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
648 | 648 | //get the module list |
649 | 649 | $modules = $this->moduleInstance->getModuleList(); |
650 | 650 | $segment = $this->segments; |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | $this->controller = $segment[0]; |
658 | 658 | |
659 | 659 | //check if the request use the same module name and controller |
660 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
660 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
661 | 661 | array_shift($segment); |
662 | 662 | } |
663 | 663 | } |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | //NOTE: here need put the show_error() "logging" to false |
141 | 141 | //to prevent self function loop call |
142 | 142 | show_error('Invalid config log level [' . $configLogLevel . '], ' |
143 | - . 'the value must be one of the following: ' |
|
144 | - . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
145 | - , 'Log Config Error', |
|
146 | - $logging = false |
|
147 | - ); |
|
143 | + . 'the value must be one of the following: ' |
|
144 | + . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
145 | + , 'Log Config Error', |
|
146 | + $logging = false |
|
147 | + ); |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | protected function levelCanSaveLog($level) { |
215 | 215 | $result = true; |
216 | 216 | $configLogLevel = get_config('log_level'); |
217 | - //check if can save log regarding the log level configuration |
|
217 | + //check if can save log regarding the log level configuration |
|
218 | 218 | $configLevel = self::getLevelValue($configLogLevel); |
219 | 219 | if ($configLevel > $level) { |
220 | 220 | //can't log |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | //NOTE: here need put the show_error() "logging" to false |
295 | 295 | //to prevent self function loop call |
296 | 296 | show_error('Error : the log dir does not exist or is not writable', |
297 | - 'Log directory error', $logging = false); |
|
297 | + 'Log directory error', $logging = false); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $path = $logSavePath . 'logs-' . date('Y-m-d') . '.log'; |