@@ -276,14 +276,14 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | - * Setting the route configuration using the configuration file |
|
| 280 | - * and additional configuration from param |
|
| 281 | - * @param array $overwriteConfig the additional configuration |
|
| 282 | - * to overwrite with the existing one |
|
| 283 | - * @param boolean $useConfigFile whether to use route configuration file |
|
| 284 | - * |
|
| 285 | - * @return object |
|
| 286 | - */ |
|
| 279 | + * Setting the route configuration using the configuration file |
|
| 280 | + * and additional configuration from param |
|
| 281 | + * @param array $overwriteConfig the additional configuration |
|
| 282 | + * to overwrite with the existing one |
|
| 283 | + * @param boolean $useConfigFile whether to use route configuration file |
|
| 284 | + * |
|
| 285 | + * @return object |
|
| 286 | + */ |
|
| 287 | 287 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
| 288 | 288 | $route = array(); |
| 289 | 289 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | //the URL like http://domain.com/module/controller/method/arg1/arg2/argn |
| 365 | 365 | if (!$this->controller) { |
| 366 | 366 | $this->logger->info('Cannot determine the routing information ' |
| 367 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
| 367 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
| 368 | 368 | //determine route parameters using the route URI param |
| 369 | 369 | $this->determineRouteParamsFromRequestUri(); |
| 370 | 370 | } |
@@ -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 |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | $this->logger->info( |
| 599 | 599 | 'After loop in predefined routes configuration,' |
| 600 | 600 | . 'the module name is set but the controller is not set,' |
| 601 | - . 'so we will use module as the controller' |
|
| 601 | + . 'so we will use module as the controller' |
|
| 602 | 602 | ); |
| 603 | 603 | $this->controller = $this->module; |
| 604 | 604 | } |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | break; |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | - $port = get_instance()->request->server('SERVER_PORT'); |
|
| 131 | + $port = get_instance()->request->server('SERVER_PORT'); |
|
| 132 | 132 | if ($port && !in_array($port, array(80, 443))) { |
| 133 | 133 | $domain .= ':' . $port; |
| 134 | 134 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] ' |
| 186 | 186 | . 'using the default location'); |
| 187 | 187 | } |
| 188 | - if (!$path) { |
|
| 188 | + if (!$path) { |
|
| 189 | 189 | $path = $this->getDefaultFilePathForView($viewFile); |
| 190 | 190 | } |
| 191 | 191 | $this->logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -261,12 +261,12 @@ discard block |
||
| 261 | 261 | return $this->finalPageContent; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - /** |
|
| 265 | - * Set the final page to be rendered |
|
| 266 | - * @param string $finalPage the content of the final page |
|
| 267 | - * |
|
| 268 | - * @return object |
|
| 269 | - */ |
|
| 264 | + /** |
|
| 265 | + * Set the final page to be rendered |
|
| 266 | + * @param string $finalPage the content of the final page |
|
| 267 | + * |
|
| 268 | + * @return object |
|
| 269 | + */ |
|
| 270 | 270 | public function setFinalPageContent($finalPage) { |
| 271 | 271 | $this->finalPageContent = $finalPage; |
| 272 | 272 | return $this; |
@@ -339,12 +339,12 @@ discard block |
||
| 339 | 339 | //@codeCoverageIgnoreEnd |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - /** |
|
| 343 | - * Dispatch the FINAL_VIEW_READY event |
|
| 344 | - * |
|
| 345 | - * @return string|null the final view content after processing by each listener |
|
| 346 | - * if they exists otherwise the same content will be returned |
|
| 347 | - */ |
|
| 342 | + /** |
|
| 343 | + * Dispatch the FINAL_VIEW_READY event |
|
| 344 | + * |
|
| 345 | + * @return string|null the final view content after processing by each listener |
|
| 346 | + * if they exists otherwise the same content will be returned |
|
| 347 | + */ |
|
| 348 | 348 | protected function dispatchFinalViewEvent() { |
| 349 | 349 | //dispatch |
| 350 | 350 | $event = get_instance()->eventdispatcher->dispatch( |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | && (bool) ini_get('zlib.output_compression') === false; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - /** |
|
| 392 | - * Return the default full file path for view |
|
| 393 | - * @param string $file the filename |
|
| 394 | - * |
|
| 395 | - * @return string|null the full file path |
|
| 396 | - */ |
|
| 391 | + /** |
|
| 392 | + * Return the default full file path for view |
|
| 393 | + * @param string $file the filename |
|
| 394 | + * |
|
| 395 | + * @return string|null the full file path |
|
| 396 | + */ |
|
| 397 | 397 | protected function getDefaultFilePathForView($file){ |
| 398 | 398 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
| 399 | 399 | $fullFilePath = null; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
| 427 | 427 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
| 428 | 428 | $this->logger->info('The cache page content is not yet expire for the ' |
| 429 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 429 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 430 | 430 | $this->sendHeaders(304); |
| 431 | 431 | return true; |
| 432 | 432 | } |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | protected function sendCachePageContentToBrowser(&$cache) { |
| 443 | 443 | $this->logger->info('The cache page content is expired or the browser does ' |
| 444 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 445 | - . 'send cache headers to tell the browser'); |
|
| 444 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 445 | + . 'send cache headers to tell the browser'); |
|
| 446 | 446 | $this->sendHeaders(200); |
| 447 | 447 | //current page cache key |
| 448 | 448 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -581,18 +581,18 @@ discard block |
||
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - /** |
|
| 585 | - * Set the mandory headers, like security, etc. |
|
| 586 | - */ |
|
| 584 | + /** |
|
| 585 | + * Set the mandory headers, like security, etc. |
|
| 586 | + */ |
|
| 587 | 587 | protected function setRequiredHeaders() { |
| 588 | 588 | $requiredHeaders = array( |
| 589 | 589 | 'X-XSS-Protection' => '1; mode=block', |
| 590 | 590 | 'X-Frame-Options' => 'SAMEORIGIN' |
| 591 | 591 | ); |
| 592 | 592 | foreach ($requiredHeaders as $key => $value) { |
| 593 | - if (!isset($this->headers[$key])) { |
|
| 593 | + if (!isset($this->headers[$key])) { |
|
| 594 | 594 | $this->headers[$key] = $value; |
| 595 | - } |
|
| 595 | + } |
|
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | } |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | private $driver = null; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * The database hostname |
|
| 47 | - * @var string |
|
| 48 | - */ |
|
| 45 | + /** |
|
| 46 | + * The database hostname |
|
| 47 | + * @var string |
|
| 48 | + */ |
|
| 49 | 49 | private $hostname = null; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * The database port |
|
| 53 | - * @var integer |
|
| 54 | - */ |
|
| 51 | + /** |
|
| 52 | + * The database port |
|
| 53 | + * @var integer |
|
| 54 | + */ |
|
| 55 | 55 | private $port = null; |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * The database username |
|
| 59 | - * @var string |
|
| 60 | - */ |
|
| 57 | + /** |
|
| 58 | + * The database username |
|
| 59 | + * @var string |
|
| 60 | + */ |
|
| 61 | 61 | private $username = null; |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * The database password |
|
| 65 | - * @var string |
|
| 66 | - */ |
|
| 63 | + /** |
|
| 64 | + * The database password |
|
| 65 | + * @var string |
|
| 66 | + */ |
|
| 67 | 67 | private $password = null; |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | private $databaseName = null; |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * The database charset |
|
| 77 | - * @var string |
|
| 78 | - */ |
|
| 75 | + /** |
|
| 76 | + * The database charset |
|
| 77 | + * @var string |
|
| 78 | + */ |
|
| 79 | 79 | private $charset = null; |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | private $collation = null; |
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * The database tables prefix |
|
| 89 | - * @var string |
|
| 90 | - */ |
|
| 87 | + /** |
|
| 88 | + * The database tables prefix |
|
| 89 | + * @var string |
|
| 90 | + */ |
|
| 91 | 91 | private $prefix = null; |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * This is method is used to connect to database |
|
| 118 | - * |
|
| 119 | - * @return boolean true in case of successfully connection false if error |
|
| 120 | - */ |
|
| 116 | + /** |
|
| 117 | + * This is method is used to connect to database |
|
| 118 | + * |
|
| 119 | + * @return boolean true in case of successfully connection false if error |
|
| 120 | + */ |
|
| 121 | 121 | public function connect() { |
| 122 | 122 | try { |
| 123 | 123 | $options = array( |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | ); |
| 177 | 177 | if ($port) { |
| 178 | 178 | $driversPort = array( |
| 179 | - 'mysql' => 'port=' . $port . ';', |
|
| 180 | - 'pgsql' => 'port=' . $port . ';', |
|
| 181 | - 'oracle' => ':' . $port |
|
| 179 | + 'mysql' => 'port=' . $port . ';', |
|
| 180 | + 'pgsql' => 'port=' . $port . ';', |
|
| 181 | + 'oracle' => ':' . $port |
|
| 182 | 182 | ); |
| 183 | 183 | if (isset($driversPort[$driver])) { |
| 184 | 184 | $port = $driversPort[$driver]; |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $this->populatePropertiesFromConfig(); |
| 417 | 417 | |
| 418 | 418 | if (!empty($this->config)) { |
| 419 | - //For logging |
|
| 419 | + //For logging |
|
| 420 | 420 | $configInfo = $this->config; |
| 421 | 421 | //Hide password from log |
| 422 | 422 | $configInfo['password'] = string_hidden($this->getPassword()); |
@@ -425,11 +425,10 @@ discard block |
||
| 425 | 425 | return $this; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - /** |
|
| 429 | - * Get the database configuration using the configuration file |
|
| 430 | - |
|
| 431 | - * @return array the database configuration from file |
|
| 432 | - */ |
|
| 428 | + /** |
|
| 429 | + * Get the database configuration using the configuration file |
|
| 430 | + * @return array the database configuration from file |
|
| 431 | + */ |
|
| 433 | 432 | public function getDatabaseConfigFromFile() { |
| 434 | 433 | $db = array(); |
| 435 | 434 | if (file_exists(CONFIG_PATH . 'database.php')) { |
@@ -440,11 +439,11 @@ discard block |
||
| 440 | 439 | return $db; |
| 441 | 440 | } |
| 442 | 441 | |
| 443 | - /** |
|
| 444 | - * Update the properties using the current database configuration |
|
| 445 | - * |
|
| 446 | - * @return object the current instance |
|
| 447 | - */ |
|
| 442 | + /** |
|
| 443 | + * Update the properties using the current database configuration |
|
| 444 | + * |
|
| 445 | + * @return object the current instance |
|
| 446 | + */ |
|
| 448 | 447 | protected function populatePropertiesFromConfig() { |
| 449 | 448 | foreach ($this->config as $key => $value) { |
| 450 | 449 | $setter = 'set' . ucfirst($key); |