@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * A bitwise flag to have FileExplorer search files starting with a period as well |
| 22 | 22 | */ |
| 23 | - const ALLOW_DOT_FILES = 0x2; |
|
| 23 | + const ALLOW_DOT_FILES = 0x2; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * A list of common version control folders to ignore. |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @var string[] |
| 38 | 38 | */ |
| 39 | - public static $vcsPatterns = array('.git', '.hg', '.svn', '_svn'); |
|
| 39 | + public static $vcsPatterns = array('.git', '.hg', '.svn', '_svn'); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * A list of phrases to exclude from the search |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param array $includes |
| 68 | 68 | * @param int|null $flags |
| 69 | 69 | */ |
| 70 | - public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null) |
|
| 70 | + public function __construct (\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null) |
|
| 71 | 71 | { |
| 72 | 72 | parent::__construct($iterator); |
| 73 | 73 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | - public function __toString() |
|
| 82 | + public function __toString () |
|
| 83 | 83 | { |
| 84 | 84 | return $this->current()->getFilename(); |
| 85 | 85 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return SplFileInfo |
| 107 | 107 | */ |
| 108 | - public function current() |
|
| 108 | + public function current () |
|
| 109 | 109 | { |
| 110 | 110 | /** @var \SplFileInfo $current */ |
| 111 | 111 | $current = parent::current(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * {@inheritdoc} |
| 122 | 122 | */ |
| 123 | - public function getChildren() |
|
| 123 | + public function getChildren () |
|
| 124 | 124 | { |
| 125 | 125 | return (new self( |
| 126 | 126 | $this->getInnerIterator()->getChildren(), |
@@ -143,11 +143,17 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function matchesPattern ($filePath) |
| 145 | 145 | { |
| 146 | - if ($this->strpos_array($filePath, $this->includes)) { return true; } |
|
| 147 | - if (($this->flags & self::INCLUDE_ONLY_FILES) && !$this->current()->isDir()) { return false; } |
|
| 146 | + if ($this->strpos_array($filePath, $this->includes)) |
|
| 147 | + { |
|
| 148 | +return true; } |
|
| 149 | + if (($this->flags & self::INCLUDE_ONLY_FILES) && !$this->current()->isDir()) |
|
| 150 | + { |
|
| 151 | +return false; } |
|
| 148 | 152 | |
| 149 | 153 | if (!($this->flags & self::ALLOW_DOT_FILES) && |
| 150 | - preg_match('#(^|\\\\|\/)\..+(\\\\|\/|$)#', $filePath) === 1) { return false; } |
|
| 154 | + preg_match('#(^|\\\\|\/)\..+(\\\\|\/|$)#', $filePath) === 1) |
|
| 155 | + { |
|
| 156 | +return false; } |
|
| 151 | 157 | |
| 152 | 158 | return ($this->strpos_array($filePath, $this->excludes) === false); |
| 153 | 159 | } |
@@ -192,10 +198,13 @@ discard block |
||
| 192 | 198 | return true; |
| 193 | 199 | } |
| 194 | 200 | |
| 195 | - if (strpos($haystack, $query, $offset) !== false) // stop on first true result |
|
| 201 | + if (strpos($haystack, $query, $offset) !== false) |
|
| 202 | + { |
|
| 203 | + // stop on first true result |
|
| 196 | 204 | { |
| 197 | 205 | return true; |
| 198 | 206 | } |
| 207 | + } |
|
| 199 | 208 | } |
| 200 | 209 | |
| 201 | 210 | return false; |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | * FileExplorer constructor. |
| 64 | 64 | * |
| 65 | 65 | * @param \RecursiveIterator $iterator |
| 66 | - * @param array $excludes |
|
| 67 | - * @param array $includes |
|
| 66 | + * @param string[] $excludes |
|
| 67 | + * @param string[] $includes |
|
| 68 | 68 | * @param int|null $flags |
| 69 | 69 | */ |
| 70 | 70 | public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array(), $flags = null) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * Copy all of the assets |
| 48 | 48 | */ |
| 49 | - public function copyFiles() |
|
| 49 | + public function copyFiles () |
|
| 50 | 50 | { |
| 51 | 51 | $this->scanTrackableItems( |
| 52 | 52 | getcwd(), |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * {@inheritdoc} |
| 66 | 66 | */ |
| 67 | - public function isHandled($filePath) |
|
| 67 | + public function isHandled ($filePath) |
|
| 68 | 68 | { |
| 69 | 69 | return $this->fileExplorer->matchesPattern($filePath); |
| 70 | 70 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * {@inheritdoc} |
| 74 | 74 | */ |
| 75 | - public function createNewItem($filePath) |
|
| 75 | + public function createNewItem ($filePath) |
|
| 76 | 76 | { |
| 77 | 77 | return $this->handleTrackableItem($filePath, array( |
| 78 | 78 | 'prefix' => '' |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * {@inheritdoc} |
| 84 | 84 | */ |
| 85 | - protected function handleTrackableItem($file, $options = array()) |
|
| 85 | + protected function handleTrackableItem ($file, $options = array()) |
|
| 86 | 86 | { |
| 87 | 87 | if (is_string($file)) |
| 88 | 88 | { |
@@ -90,7 +90,9 @@ |
||
| 90 | 90 | $file = $this->fs->createSplFileInfo($file); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (!$this->fs->exists($file)) { return; } |
|
| 93 | + if (!$this->fs->exists($file)) |
|
| 94 | + { |
|
| 95 | +return; } |
|
| 94 | 96 | |
| 95 | 97 | $filePath = $file->getRealPath(); |
| 96 | 98 | $pathToStrip = $this->fs->appendPath(getcwd(), $options['prefix']); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * {@inheritdoc} |
| 42 | 42 | */ |
| 43 | - public function __construct($filePath) |
|
| 43 | + public function __construct ($filePath) |
|
| 44 | 44 | { |
| 45 | 45 | parent::__construct($filePath); |
| 46 | 46 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return PageView[] |
| 88 | 88 | */ |
| 89 | - public function &getChildren () |
|
| 89 | + public function &getChildren() |
|
| 90 | 90 | { |
| 91 | 91 | return $this->children; |
| 92 | 92 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | self::$fileSys = new Filesystem(); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $frontMatter = array( |
|
| 172 | + $frontMatter = array( |
|
| 173 | 173 | 'permalink' => $redirectFrom, |
| 174 | 174 | 'redirect' => $redirectTo, |
| 175 | 175 | 'menu' => false |
@@ -9,7 +9,9 @@ |
||
| 9 | 9 | foreach ($array as $element) |
| 10 | 10 | { |
| 11 | 11 | if (is_array($element)) |
| 12 | - return true; |
|
| 12 | + { |
|
| 13 | + return true; |
|
| 14 | + } |
|
| 13 | 15 | } |
| 14 | 16 | |
| 15 | 17 | return false; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * |
| 62 | 62 | * @param array $rawFrontMatter |
| 63 | 63 | */ |
| 64 | - public function __construct(&$rawFrontMatter) |
|
| 64 | + public function __construct (&$rawFrontMatter) |
|
| 65 | 65 | { |
| 66 | 66 | $this->expansionUsed = false; |
| 67 | 67 | $this->nestingLevel = 0; |
@@ -100,7 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | private function handleDateField () |
| 102 | 102 | { |
| 103 | - if (!isset($this->frontMatter['date'])) { return; } |
|
| 103 | + if (!isset($this->frontMatter['date'])) |
|
| 104 | + { |
|
| 105 | +return; } |
|
| 104 | 106 | |
| 105 | 107 | $date = &$this->frontMatter['date']; |
| 106 | 108 | |
@@ -119,7 +121,9 @@ discard block |
||
| 119 | 121 | { |
| 120 | 122 | $itemDate = new \DateTime($date); |
| 121 | 123 | } |
| 122 | - catch (\Exception $e) { return; } |
|
| 124 | + catch (\Exception $e) |
|
| 125 | + { |
|
| 126 | +return; } |
|
| 123 | 127 | } |
| 124 | 128 | |
| 125 | 129 | if (!$itemDate === false) |
@@ -271,7 +275,9 @@ discard block |
||
| 271 | 275 | |
| 272 | 276 | if (is_array($value) || is_bool($value)) |
| 273 | 277 | { |
| 274 | - if ($ignoreArrays) { continue; } |
|
| 278 | + if ($ignoreArrays) |
|
| 279 | + { |
|
| 280 | +continue; } |
|
| 275 | 281 | |
| 276 | 282 | throw new YamlUnsupportedVariableException("Yaml variable `$variable` for `$key` is not a supported data type."); |
| 277 | 283 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * {@inheritdoc} |
| 21 | 21 | */ |
| 22 | - public function __construct($filePath) |
|
| 22 | + public function __construct ($filePath) |
|
| 23 | 23 | { |
| 24 | 24 | parent::__construct($filePath); |
| 25 | 25 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * {@inheritdoc} |
| 21 | 21 | */ |
| 22 | - public function __construct($filePath) |
|
| 22 | + public function __construct ($filePath) |
|
| 23 | 23 | { |
| 24 | 24 | parent::__construct($filePath); |
| 25 | 25 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $this->highlighter = new Highlighter(); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - protected function blockHeader($line) |
|
| 16 | + protected function blockHeader ($line) |
|
| 17 | 17 | { |
| 18 | 18 | $Block = parent::blockHeader($line); |
| 19 | 19 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * PageManager constructor |
| 60 | 60 | */ |
| 61 | - public function __construct() |
|
| 61 | + public function __construct () |
|
| 62 | 62 | { |
| 63 | 63 | parent::__construct(); |
| 64 | 64 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | /** |
| 229 | 229 | * {@inheritdoc} |
| 230 | 230 | */ |
| 231 | - public function isTracked($filePath) |
|
| 231 | + public function isTracked ($filePath) |
|
| 232 | 232 | { |
| 233 | 233 | return (parent::isTracked($filePath) || isset($this->twigExtendsDeps[$filePath])); |
| 234 | 234 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | /** |
| 237 | 237 | * {@inheritdoc} |
| 238 | 238 | */ |
| 239 | - public function refreshItem($filePath) |
|
| 239 | + public function refreshItem ($filePath) |
|
| 240 | 240 | { |
| 241 | 241 | if (parent::isTracked($filePath)) |
| 242 | 242 | { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | /** |
| 257 | 257 | * {@inheritdoc} |
| 258 | 258 | */ |
| 259 | - protected function handleTrackableItem($filePath, $options = array()) |
|
| 259 | + protected function handleTrackableItem ($filePath, $options = array()) |
|
| 260 | 260 | { |
| 261 | 261 | $pageView = PageView::create($filePath); |
| 262 | 262 | $namespace = $pageView->getType(); |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | { |
| 535 | 535 | $filePath = $this->fs->getRelativePath($parent->getSourceContext()->getPath()); |
| 536 | 536 | |
| 537 | - $this->twigExtendsDeps[$filePath][(string)$pageView->getFilePath()] = &$pageView; |
|
| 537 | + $this->twigExtendsDeps[$filePath][(string) $pageView->getFilePath()] = &$pageView; |
|
| 538 | 538 | $parent = $parent->getParent(array()); |
| 539 | 539 | } |
| 540 | 540 | } |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function setCollections (&$collections) |
| 74 | 74 | { |
| 75 | - if (empty($collections)) { return; } |
|
| 75 | + if (empty($collections)) |
|
| 76 | + { |
|
| 77 | +return; } |
|
| 76 | 78 | |
| 77 | 79 | $this->collections = &$collections; |
| 78 | 80 | } |
@@ -123,7 +125,8 @@ discard block |
||
| 123 | 125 | { |
| 124 | 126 | static $jailedMenu = array(); |
| 125 | 127 | |
| 126 | - if (!empty($jailedMenu)) { |
|
| 128 | + if (!empty($jailedMenu)) |
|
| 129 | + { |
|
| 127 | 130 | return $jailedMenu; |
| 128 | 131 | } |
| 129 | 132 | |
@@ -143,7 +146,9 @@ discard block |
||
| 143 | 146 | */ |
| 144 | 147 | public function parsePageViews ($pageViewFolders) |
| 145 | 148 | { |
| 146 | - if (empty($pageViewFolders)) { return; } |
|
| 149 | + if (empty($pageViewFolders)) |
|
| 150 | + { |
|
| 151 | +return; } |
|
| 147 | 152 | |
| 148 | 153 | /** |
| 149 | 154 | * The name of the folder where PageViews are located |
@@ -303,7 +308,8 @@ discard block |
||
| 303 | 308 | { |
| 304 | 309 | $this->addToSiteMenu($pageView); |
| 305 | 310 | |
| 306 | - if (!empty($pageView->title)) { |
|
| 311 | + if (!empty($pageView->title)) |
|
| 312 | + { |
|
| 307 | 313 | $this->flatPages[$pageView->title] = $pageView->createJail(); |
| 308 | 314 | } |
| 309 | 315 | } |
@@ -550,7 +556,9 @@ discard block |
||
| 550 | 556 | */ |
| 551 | 557 | private function trackParentTwigTemplate ($template, &$pageView) |
| 552 | 558 | { |
| 553 | - if (!$this->tracking) { return; } |
|
| 559 | + if (!$this->tracking) |
|
| 560 | + { |
|
| 561 | +return; } |
|
| 554 | 562 | |
| 555 | 563 | /** @var Twig_Template $parent */ |
| 556 | 564 | $parent = $template->getParent(array()); |
@@ -90,6 +90,9 @@ |
||
| 90 | 90 | $this->targetDir = &$folder; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @param \allejo\stakx\Object\Configuration $configuration |
|
| 95 | + */ |
|
| 93 | 96 | public function configureTwig ($configuration, $options) |
| 94 | 97 | { |
| 95 | 98 | $this->twigOpts['configuration'] = $configuration; |