| @@ -88,7 +88,7 @@ discard block | ||
| 88 | 88 | * Loop through sitemap items and see if one matches the requestUri. | 
| 89 | 89 | * If it does, add it tot the matchedSitemapItems array | 
| 90 | 90 | * | 
| 91 | - * @param $request | |
| 91 | + * @param Request $request | |
| 92 | 92 | */ | 
| 93 | 93 | private function sitemapMatching($request) | 
| 94 | 94 |  		{ | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | * @param string $template | 
| 151 | 151 | * @param array $parameters | 
| 152 | 152 | * | 
| 153 | - * @return mixed | |
| 153 | + * @return Component | |
| 154 | 154 | * @throws \Exception | 
| 155 | 155 | */ | 
| 156 | 156 | private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) | 
| @@ -65,12 +65,12 @@ discard block | ||
| 65 | 65 | */ | 
| 66 | 66 | private function config() | 
| 67 | 67 |  		{ | 
| 68 | - $configPath = __DIR__ . '/../../config.json'; | |
| 68 | + $configPath = __DIR__.'/../../config.json'; | |
| 69 | 69 |  			if (realpath($configPath) !== false) { | 
| 70 | 70 | $json = file_get_contents($configPath); | 
| 71 | 71 | $this->config = json_decode($json); | 
| 72 | 72 |  			} else { | 
| 73 | -				throw new \Exception('Couldn\'t find config file in path ' . $configPath); | |
| 73 | +				throw new \Exception('Couldn\'t find config file in path '.$configPath); | |
| 74 | 74 | } | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | private function sitemapMatching($request) | 
| 94 | 94 |  		{ | 
| 95 | 95 | $sitemap = $this->storage->getSitemap(); | 
| 96 | - $relativeUri = '/' . $request::$relativeUri; | |
| 96 | + $relativeUri = '/'.$request::$relativeUri; | |
| 97 | 97 | |
| 98 | 98 |  			foreach ($sitemap as $sitemapItem) { | 
| 99 | 99 |  				if ($sitemapItem->regex) { | 
| @@ -156,17 +156,17 @@ discard block | ||
| 156 | 156 | * @return mixed | 
| 157 | 157 | * @throws \Exception | 
| 158 | 158 | */ | 
| 159 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) | |
| 159 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) | |
| 160 | 160 |  		{ | 
| 161 | - $libraryComponentName = '\\library\\components\\' . $class; | |
| 162 | - $userComponentName = '\\components\\' . $class; | |
| 161 | + $libraryComponentName = '\\library\\components\\'.$class; | |
| 162 | + $userComponentName = '\\components\\'.$class; | |
| 163 | 163 | |
| 164 | 164 |  			if (\autoLoad($libraryComponentName, false)) { | 
| 165 | 165 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); | 
| 166 | 166 |  			} elseif (\autoLoad($userComponentName, false)) { | 
| 167 | 167 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); | 
| 168 | 168 |  			} else { | 
| 169 | -				throw new \Exception('Could not load component ' . $class); | |
| 169 | +				throw new \Exception('Could not load component '.$class); | |
| 170 | 170 | } | 
| 171 | 171 | |
| 172 | 172 |  			if (!$component instanceof Component) { | 
| @@ -225,7 +225,7 @@ discard block | ||
| 225 | 225 | public function setCachingHeaders() | 
| 226 | 226 |  		{ | 
| 227 | 227 |  			header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days | 
| 228 | -			header("Cache-Control: max-age=" . (60 * 60 * 24 * 2)); | |
| 228 | +			header("Cache-Control: max-age=".(60 * 60 * 24 * 2)); | |
| 229 | 229 | } | 
| 230 | 230 | |
| 231 | 231 | /** | 
| @@ -36,7 +36,7 @@ discard block | ||
| 36 | 36 |  					if (isset($this->parameters['document'])) { | 
| 37 | 37 | $this->parameters[$this->documentParameterName] = $storage->getDocumentBySlug($this->parameters['document']); | 
| 38 | 38 |  					} else { | 
| 39 | -						throw new \Exception('When not using a regex, you need to set the parameter `document` with the path to the document in this sitemap item: ' . $this->matchedSitemapItem->title); | |
| 39 | +						throw new \Exception('When not using a regex, you need to set the parameter `document` with the path to the document in this sitemap item: '.$this->matchedSitemapItem->title); | |
| 40 | 40 | } | 
| 41 | 41 |  				} else { | 
| 42 | 42 |  					if (isset($this->parameters['document'])) { | 
| @@ -45,9 +45,9 @@ discard block | ||
| 45 | 45 | $relativeDocumentUri = current($this->matchedSitemapItem->matches[1]); | 
| 46 | 46 |  						if (isset($this->parameters['folder'])) { | 
| 47 | 47 |  							if (substr($this->parameters['folder'], -1) !== '/') { | 
| 48 | - $this->parameters['folder'] = $this->parameters['folder'] . '/'; | |
| 48 | + $this->parameters['folder'] = $this->parameters['folder'].'/'; | |
| 49 | 49 | } | 
| 50 | - $relativeDocumentUri = $this->parameters['folder'] . $relativeDocumentUri; | |
| 50 | + $relativeDocumentUri = $this->parameters['folder'].$relativeDocumentUri; | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 | $document = $storage->getDocumentBySlug($relativeDocumentUri); | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | * @param array $parameters | 
| 42 | 42 | * @param $matchedSitemapItem | 
| 43 | 43 | */ | 
| 44 | - public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) | |
| 44 | + public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem) | |
| 45 | 45 |  		{ | 
| 46 | 46 | $this->template = $template; | 
| 47 | 47 | $this->request = $request; | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | * | 
| 68 | 68 | * @throws \Exception | 
| 69 | 69 | */ | 
| 70 | - public function render($application=null) | |
| 70 | + public function render($application = null) | |
| 71 | 71 |  		{ | 
| 72 | 72 | $this->renderedContent = $this->renderTemplate($this->template, true, $application); | 
| 73 | 73 | } | 
| @@ -93,9 +93,9 @@ discard block | ||
| 93 | 93 | * @return string | 
| 94 | 94 | * @throws \Exception | 
| 95 | 95 | */ | 
| 96 | - public function renderTemplate($template='', $obClean = true, $application=null) | |
| 96 | + public function renderTemplate($template = '', $obClean = true, $application = null) | |
| 97 | 97 |  		{ | 
| 98 | - $templatePath = __DIR__ . '/../../templates/' . $template . '.php'; | |
| 98 | + $templatePath = __DIR__.'/../../templates/'.$template.'.php'; | |
| 99 | 99 |  			if (realpath($templatePath) !== false) { | 
| 100 | 100 |  				if ($obClean) { | 
| 101 | 101 | ob_clean(); | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | return ob_get_contents(); | 
| 113 | 113 |  			} else { | 
| 114 | 114 |  				if ($template !== null) { // If template is null, its a application component, which doesnt have a template | 
| 115 | -					throw new \Exception('Couldnt find template ' . $templatePath); | |
| 115 | +					throw new \Exception('Couldnt find template '.$templatePath); | |
| 116 | 116 | } | 
| 117 | 117 | } | 
| 118 | 118 | } | 
| @@ -127,7 +127,7 @@ discard block | ||
| 127 | 127 | * @return string | 
| 128 | 128 | * @throws \Exception | 
| 129 | 129 | */ | 
| 130 | - public function includeTemplate($template='', $parameters = array()) | |
| 130 | + public function includeTemplate($template = '', $parameters = array()) | |
| 131 | 131 |  		{ | 
| 132 | 132 |  			if (is_array($parameters)) { | 
| 133 | 133 |  				foreach ($parameters as $name => $value) { |