@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * resolve a file path by replace the mod: prefix |
| 57 | 57 | * |
| 58 | - * @param $path |
|
| 58 | + * @param string $path |
|
| 59 | 59 | * |
| 60 | 60 | * @return string|null the full filepath or null if file does not exists |
| 61 | 61 | */ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * load files e.g. config files |
| 78 | 78 | * |
| 79 | - * @param $file |
|
| 79 | + * @param string $file |
|
| 80 | 80 | * |
| 81 | 81 | * @return mixed|null |
| 82 | 82 | */ |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * static method to get files by directory and file filter |
| 112 | 112 | * |
| 113 | - * @param $directory |
|
| 113 | + * @param string $directory |
|
| 114 | 114 | * @param string $filter |
| 115 | 115 | * |
| 116 | 116 | * @return array |
@@ -202,6 +202,11 @@ discard block |
||
| 202 | 202 | * @return mixed |
| 203 | 203 | */ |
| 204 | 204 | // @codingStandardsIgnoreStart |
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * @param integer $min |
|
| 208 | + * @param integer $max |
|
| 209 | + */ |
|
| 205 | 210 | public static function crypto_rand_secure($min, $max) |
| 206 | 211 | { |
| 207 | 212 | // @codingStandardsIgnoreEnd |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | { |
| 160 | 160 | $config = Registry::get('Phile_Settings'); |
| 161 | 161 | |
| 162 | - return md5($config['encryptionKey'] . $value); |
|
| 162 | + return md5($config['encryptionKey'].$value); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | /** |
| 134 | 134 | * set content of page |
| 135 | 135 | * |
| 136 | - * @param $content |
|
| 136 | + * @param string $content |
|
| 137 | 137 | */ |
| 138 | 138 | public function setContent($content) |
| 139 | 139 | { |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | * get file path to plugin root (trailing slash) or to a sub-item |
| 129 | 129 | * |
| 130 | 130 | * @param string $subPath |
| 131 | - * @return null|string null if item does not exist |
|
| 131 | + * @return string null if item does not exist |
|
| 132 | 132 | */ |
| 133 | 133 | protected function getPluginPath($subPath = '') |
| 134 | 134 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->plugin['key'] = $pluginKey; |
| 53 | 53 | list($vendor, $name) = explode('\\', $this->plugin['key']); |
| 54 | 54 | $DS = DIRECTORY_SEPARATOR; |
| 55 | - $this->plugin['dir'] = PLUGINS_DIR . $vendor . $DS . $name . $DS; |
|
| 55 | + $this->plugin['dir'] = PLUGINS_DIR.$vendor.$DS.$name.$DS; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * init events |
@@ -132,6 +132,6 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function getPluginPath($subPath = '') |
| 134 | 134 | { |
| 135 | - return $this->plugin['dir'] . ltrim($subPath, DIRECTORY_SEPARATOR); |
|
| 135 | + return $this->plugin['dir'].ltrim($subPath, DIRECTORY_SEPARATOR); |
|
| 136 | 136 | } |
| 137 | 137 | } |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | /** |
| 80 | 80 | * wrapper to call the render engine |
| 81 | 81 | * |
| 82 | - * @param $engine |
|
| 82 | + * @param \Twig_Environment $engine |
|
| 83 | 83 | * @param $vars |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $template = 'index'; |
| 124 | 124 | } |
| 125 | 125 | if (!empty($this->config['template-extension'])) { |
| 126 | - $template .= '.' . $this->config['template-extension']; |
|
| 126 | + $template .= '.'.$this->config['template-extension']; |
|
| 127 | 127 | } |
| 128 | 128 | $templatePath = $this->getTemplatePath($template); |
| 129 | 129 | if (!file_exists($templatePath)) { |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function getTemplatePath($sub = '') |
| 145 | 145 | { |
| 146 | - $themePath = THEMES_DIR . $this->settings['theme']; |
|
| 146 | + $themePath = THEMES_DIR.$this->settings['theme']; |
|
| 147 | 147 | if (!empty($sub)) { |
| 148 | - $themePath .= '/' . ltrim($sub, DIRECTORY_SEPARATOR); |
|
| 148 | + $themePath .= '/'.ltrim($sub, DIRECTORY_SEPARATOR); |
|
| 149 | 149 | } |
| 150 | 150 | return $themePath; |
| 151 | 151 | } |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | 'base_url' => $this->settings['base_url'], |
| 168 | 168 | 'config' => $this->settings, |
| 169 | 169 | 'content_dir' => CONTENT_DIR, |
| 170 | - 'content_url' => $this->settings['base_url'] . '/' . basename(CONTENT_DIR), |
|
| 170 | + 'content_url' => $this->settings['base_url'].'/'.basename(CONTENT_DIR), |
|
| 171 | 171 | 'pages' => $repository->findAll(), |
| 172 | 172 | 'site_title' => $this->settings['site_title'], |
| 173 | - 'theme_dir' => THEMES_DIR . $this->settings['theme'], |
|
| 174 | - 'theme_url' => $this->settings['base_url'] . '/' . basename(THEMES_DIR) . '/' . $this->settings['theme'], |
|
| 173 | + 'theme_dir' => THEMES_DIR.$this->settings['theme'], |
|
| 174 | + 'theme_url' => $this->settings['base_url'].'/'.basename(THEMES_DIR).'/'.$this->settings['theme'], |
|
| 175 | 175 | ]; |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | public function offsetSet($offset, $value) |
| 77 | 77 | { |
| 78 | 78 | $this->load(); |
| 79 | - $this->pages[$offset] = $value; |
|
| 79 | + $this->pages[$offset] = $value; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function offsetUnset($offset) |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class Plugin extends AbstractPlugin |
| 23 | 23 | { |
| 24 | - const HANDLER_ERROR_LOG = 'error_log'; |
|
| 25 | - const HANDLER_DEVELOPMENT = 'development'; |
|
| 24 | + const HANDLER_ERROR_LOG = 'error_log'; |
|
| 25 | + const HANDLER_DEVELOPMENT = 'development'; |
|
| 26 | 26 | |
| 27 | 27 | protected $events = ['plugins_loaded' => 'onPluginsLoaded']; |
| 28 | 28 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | list($vendor, $pluginName) = explode('\\', $pluginKey); |
| 74 | 74 | // uppercase first letter convention |
| 75 | - $pluginClassName = '\\Phile\\Plugin\\' . ucfirst($vendor) . '\\' . ucfirst($pluginName) . '\\Plugin'; |
|
| 75 | + $pluginClassName = '\\Phile\\Plugin\\'.ucfirst($vendor).'\\'.ucfirst($pluginName).'\\Plugin'; |
|
| 76 | 76 | |
| 77 | 77 | if (!class_exists($pluginClassName)) { |
| 78 | 78 | throw new PluginException( |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $classNameParts |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | - $fileName = PLUGINS_DIR . implode(DIRECTORY_SEPARATOR, $classPath) . '.php'; |
|
| 128 | + $fileName = PLUGINS_DIR.implode(DIRECTORY_SEPARATOR, $classPath).'.php'; |
|
| 129 | 129 | if (file_exists($fileName)) { |
| 130 | 130 | include_once $fileName; |
| 131 | 131 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $pageId .= 'index'; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $file = $folder . $pageId . CONTENT_EXT; |
|
| 67 | + $file = $folder.$pageId.CONTENT_EXT; |
|
| 68 | 68 | if (!file_exists($file)) { |
| 69 | 69 | if (substr($pageId, -6) === '/index') { |
| 70 | 70 | // try to resolve sub-directory 'sub/' to page 'sub' |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // try to resolve page 'sub' to sub-directory 'sub/' |
| 74 | 74 | $pageId .= '/index'; |
| 75 | 75 | } |
| 76 | - $file = $folder . $pageId . CONTENT_EXT; |
|
| 76 | + $file = $folder.$pageId.CONTENT_EXT; |
|
| 77 | 77 | } |
| 78 | 78 | if (!file_exists($file)) { |
| 79 | 79 | return null; |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | public function findAll(array $options = array(), $folder = CONTENT_DIR) |
| 93 | 93 | { |
| 94 | 94 | return new PageCollection( |
| 95 | - function () use ($options, $folder) { |
|
| 95 | + function() use ($options, $folder) { |
|
| 96 | 96 | $options += $this->settings; |
| 97 | 97 | // ignore files with a leading '.' in its filename |
| 98 | 98 | $files = Utility::getFiles($folder, '\Phile\FilterIterator\ContentFileFilterIterator'); |
| 99 | 99 | $pages = array(); |
| 100 | 100 | foreach ($files as $file) { |
| 101 | - if (str_replace($folder, '', $file) == '404' . CONTENT_EXT) { |
|
| 101 | + if (str_replace($folder, '', $file) == '404'.CONTENT_EXT) { |
|
| 102 | 102 | // jump to next page if file is the 404 page |
| 103 | 103 | continue; |
| 104 | 104 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | $meta = $page->getMeta(); |
| 137 | 137 | if ($sort['type'] === 'page') { |
| 138 | - $method = 'get' . ucfirst($key); |
|
| 138 | + $method = 'get'.ucfirst($key); |
|
| 139 | 139 | $value = $page->$method(); |
| 140 | 140 | } elseif ($sort['type'] === 'meta') { |
| 141 | 141 | $value = $meta->get($key); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $column[] = $value; |
| 150 | 150 | } |
| 151 | 151 | $sortHelper[] = $column; |
| 152 | - $sortHelper[] = constant('SORT_' . strtoupper($sort['order'])); |
|
| 152 | + $sortHelper[] = constant('SORT_'.strtoupper($sort['order'])); |
|
| 153 | 153 | } |
| 154 | 154 | $sortHelper[] = &$pages; |
| 155 | 155 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | protected function getPage($filePath, $folder = CONTENT_DIR) |
| 193 | 193 | { |
| 194 | - $key = 'Phile_Model_Page_' . md5($filePath); |
|
| 194 | + $key = 'Phile_Model_Page_'.md5($filePath); |
|
| 195 | 195 | if (isset($this->storage[$key])) { |
| 196 | 196 | return $this->storage[$key]; |
| 197 | 197 | } |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | public function send() |
| 120 | 120 | { |
| 121 | 121 | if (!isset($this->headers['Content-Type'])) { |
| 122 | - $this->setHeader('Content-Type', 'text/html; charset=' . $this->charset); |
|
| 122 | + $this->setHeader('Content-Type', 'text/html; charset='.$this->charset); |
|
| 123 | 123 | } |
| 124 | 124 | $this->outputHeader(); |
| 125 | 125 | http_response_code($this->statusCode); |