@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param OutputInterface $output |
107 | 107 | */ |
108 | - public function __construct (OutputInterface $output) |
|
108 | + public function __construct(OutputInterface $output) |
|
109 | 109 | { |
110 | 110 | $this->output = new ConsoleInterface($output); |
111 | 111 | $this->cm = new CollectionManager(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @param bool $cleanDirectory Clean the target directing before rebuilding |
121 | 121 | */ |
122 | - public function build ($cleanDirectory) |
|
122 | + public function build($cleanDirectory) |
|
123 | 123 | { |
124 | 124 | // Parse DataItems |
125 | 125 | $this->dm->setConsoleOutput($this->output); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | ); |
160 | 160 | } |
161 | 161 | |
162 | - public function watch () |
|
162 | + public function watch() |
|
163 | 163 | { |
164 | 164 | $this->build(true); |
165 | 165 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @throws \LogicException |
209 | 209 | */ |
210 | - public function setConfiguration ($configFile) |
|
210 | + public function setConfiguration($configFile) |
|
211 | 211 | { |
212 | 212 | if (!$this->fs->exists($configFile) && !$this->getConfLess()) |
213 | 213 | { |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | $this->configuration = new Configuration($configFile, $this->output); |
226 | 226 | } |
227 | 227 | |
228 | - public function handleSingleFile ($filePath) |
|
228 | + public function handleSingleFile($filePath) |
|
229 | 229 | { |
230 | 230 | $filePath = ltrim($filePath, DIRECTORY_SEPARATOR); |
231 | 231 | $pageViewDirs = $this->configuration->getPageViewFolders(); |
232 | - $collectionDirs = array_map(function ($a) { return $a["folder"]; }, $this->configuration->getCollectionsFolders()); |
|
232 | + $collectionDirs = array_map(function($a) { return $a["folder"]; }, $this->configuration->getCollectionsFolders()); |
|
233 | 233 | |
234 | 234 | $_paths = explode(DIRECTORY_SEPARATOR, $filePath); |
235 | 235 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return bool True when being built with no configuration file |
250 | 250 | */ |
251 | - public function getConfLess () |
|
251 | + public function getConfLess() |
|
252 | 252 | { |
253 | 253 | return $this->confLess; |
254 | 254 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @param bool $status True when a website should be built without a configuration |
260 | 260 | */ |
261 | - public function setConfLess ($status) |
|
261 | + public function setConfLess($status) |
|
262 | 262 | { |
263 | 263 | $this->confLess = $status; |
264 | 264 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return bool True when the website is being built in safe mode |
272 | 272 | */ |
273 | - public function getSafeMode () |
|
273 | + public function getSafeMode() |
|
274 | 274 | { |
275 | 275 | return $this->safeMode; |
276 | 276 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param bool $bool True if a website should be built in safe mode |
282 | 282 | */ |
283 | - public function setSafeMode ($bool) |
|
283 | + public function setSafeMode($bool) |
|
284 | 284 | { |
285 | 285 | $this->safeMode = $bool; |
286 | 286 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param bool $cleanDirectory Clean the target directory |
292 | 292 | */ |
293 | - private function createFolderStructure ($cleanDirectory) |
|
293 | + private function createFolderStructure($cleanDirectory) |
|
294 | 294 | { |
295 | 295 | $tarDir = $this->fs->absolutePath($this->configuration->getTargetFolder()); |
296 | 296 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @todo Load custom Twig extensions from _config.yml |
312 | 312 | */ |
313 | - private function configureTwig () |
|
313 | + private function configureTwig() |
|
314 | 314 | { |
315 | 315 | $loader = new Twig_Loader_Filesystem(array( |
316 | 316 | getcwd() |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | /** |
363 | 363 | * Copy static files from a theme to the compiled website |
364 | 364 | */ |
365 | - private function copyThemeAssets () |
|
365 | + private function copyThemeAssets() |
|
366 | 366 | { |
367 | 367 | $theme = $this->configuration->getTheme(); |
368 | 368 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * - Does not start with an underscore or is inside of a directory starting with an underscore |
405 | 405 | * - Does not start with a period or is inside of a directory starting with a period |
406 | 406 | */ |
407 | - private function copyStaticFiles () |
|
407 | + private function copyStaticFiles() |
|
408 | 408 | { |
409 | 409 | $finder = $this->fs->getFinder( |
410 | 410 | $this->getConfiguration()->getIncludes(), |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param SplFileInfo $file The relative path of the file to be copied |
426 | 426 | * @param string $prefix |
427 | 427 | */ |
428 | - private function copyToCompiledSite ($file, $prefix = "") |
|
428 | + private function copyToCompiledSite($file, $prefix = "") |
|
429 | 429 | { |
430 | 430 | if (!$this->fs->exists($file)) { return; } |
431 | 431 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @return string Twig body |
9 | 9 | */ |
10 | - public function getContent () |
|
10 | + public function getContent() |
|
11 | 11 | { |
12 | 12 | return $this->bodyContent; |
13 | 13 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return bool |
19 | 19 | */ |
20 | - public function isDynamicPage () |
|
20 | + public function isDynamicPage() |
|
21 | 21 | { |
22 | 22 | return isset($this->frontMatter['collection']); |
23 | 23 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->handleDeprecations(); |
62 | 62 | } |
63 | 63 | |
64 | - public function isDebug () |
|
64 | + public function isDebug() |
|
65 | 65 | { |
66 | 66 | return $this->returnConfigOption('debug', false); |
67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return mixed|null |
73 | 73 | */ |
74 | - public function getBaseUrl () |
|
74 | + public function getBaseUrl() |
|
75 | 75 | { |
76 | 76 | $base = $this->returnConfigOption('base'); |
77 | 77 | |
@@ -83,62 +83,62 @@ discard block |
||
83 | 83 | return $base; |
84 | 84 | } |
85 | 85 | |
86 | - public function getDataFolders () |
|
86 | + public function getDataFolders() |
|
87 | 87 | { |
88 | 88 | return $this->returnConfigOption('data'); |
89 | 89 | } |
90 | 90 | |
91 | - public function getDataSets () |
|
91 | + public function getDataSets() |
|
92 | 92 | { |
93 | 93 | return $this->returnConfigOption('datasets'); |
94 | 94 | } |
95 | 95 | |
96 | - public function getIncludes () |
|
96 | + public function getIncludes() |
|
97 | 97 | { |
98 | 98 | return $this->returnConfigOption('include', array()); |
99 | 99 | } |
100 | 100 | |
101 | - public function getExcludes () |
|
101 | + public function getExcludes() |
|
102 | 102 | { |
103 | 103 | return $this->returnConfigOption('exclude', array()); |
104 | 104 | } |
105 | 105 | |
106 | - public function getTheme () |
|
106 | + public function getTheme() |
|
107 | 107 | { |
108 | 108 | return $this->returnConfigOption('theme'); |
109 | 109 | } |
110 | 110 | |
111 | - public function getConfiguration () |
|
111 | + public function getConfiguration() |
|
112 | 112 | { |
113 | 113 | return $this->configuration; |
114 | 114 | } |
115 | 115 | |
116 | - public function getPageViewFolders () |
|
116 | + public function getPageViewFolders() |
|
117 | 117 | { |
118 | 118 | return $this->returnConfigOption('pageviews'); |
119 | 119 | } |
120 | 120 | |
121 | - public function getTargetFolder () |
|
121 | + public function getTargetFolder() |
|
122 | 122 | { |
123 | 123 | return $this->returnConfigOption('target'); |
124 | 124 | } |
125 | 125 | |
126 | - public function getCollectionsFolders () |
|
126 | + public function getCollectionsFolders() |
|
127 | 127 | { |
128 | 128 | return $this->returnConfigOption('collections'); |
129 | 129 | } |
130 | 130 | |
131 | - public function getTwigAutoescape () |
|
131 | + public function getTwigAutoescape() |
|
132 | 132 | { |
133 | 133 | return $this->configuration['twig']['autoescape']; |
134 | 134 | } |
135 | 135 | |
136 | - private function returnConfigOption ($name, $default = null) |
|
136 | + private function returnConfigOption($name, $default = null) |
|
137 | 137 | { |
138 | 138 | return (isset($this->configuration[$name]) ? $this->configuration[$name] : $default); |
139 | 139 | } |
140 | 140 | |
141 | - private function defaultConfiguration () |
|
141 | + private function defaultConfiguration() |
|
142 | 142 | { |
143 | 143 | $defaultConfig = array( |
144 | 144 | 'baseurl' => '', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - private function handleDeprecations () |
|
168 | + private function handleDeprecations() |
|
169 | 169 | { |
170 | 170 | // @TODO 1.0.0 handle 'base' deprecation in _config.yml |
171 | 171 | $base = $this->returnConfigOption('base'); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return mixed|null |
123 | 123 | */ |
124 | - public function __get ($name) |
|
124 | + public function __get($name) |
|
125 | 125 | { |
126 | 126 | return (array_key_exists($name, $this->frontMatter) ? $this->frontMatter[$name] : null); |
127 | 127 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return bool |
136 | 136 | */ |
137 | - public function __isset ($name) |
|
137 | + public function __isset($name) |
|
138 | 138 | { |
139 | 139 | return array_key_exists($name, $this->frontMatter); |
140 | 140 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * @param array|null $variables An array of YAML variables to use in evaluating the `$permalink` value |
144 | 144 | */ |
145 | - public function evaluateFrontMatter ($variables = null) |
|
145 | + public function evaluateFrontMatter($variables = null) |
|
146 | 146 | { |
147 | 147 | if (!is_null($variables)) |
148 | 148 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return string |
159 | 159 | */ |
160 | - public function getContent () |
|
160 | + public function getContent() |
|
161 | 161 | { |
162 | 162 | if (!$this->bodyContentEvaluated) |
163 | 163 | { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $this->bodyContentEvaluated = true; |
186 | 186 | } |
187 | 187 | |
188 | - return (string)$this->bodyContent; |
|
188 | + return (string) $this->bodyContent; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array |
197 | 197 | */ |
198 | - final public function getFrontMatter ($evaluateYaml = true) |
|
198 | + final public function getFrontMatter($evaluateYaml = true) |
|
199 | 199 | { |
200 | 200 | if ($this->frontMatter === null) |
201 | 201 | { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - final public function getPermalink () |
|
218 | + final public function getPermalink() |
|
219 | 219 | { |
220 | 220 | if ($this->permalinkEvaluated) { |
221 | 221 | return $this->frontMatter['permalink']; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - final public function getTargetFile () |
|
241 | + final public function getTargetFile() |
|
242 | 242 | { |
243 | 243 | $extension = $this->fs->getExtension($this->getPermalink()); |
244 | 244 | $targetFile = $this->getPermalink(); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return string |
257 | 257 | */ |
258 | - final public function getFilePath () |
|
258 | + final public function getFilePath() |
|
259 | 259 | { |
260 | 260 | return $this->filePath; |
261 | 261 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @throws YamlVariableUndefinedException A FrontMatter variable used does not exist |
269 | 269 | */ |
270 | - final protected function evaluateYaml (&$yaml) |
|
270 | + final protected function evaluateYaml(&$yaml) |
|
271 | 271 | { |
272 | 272 | foreach ($yaml as $key => $value) |
273 | 273 | { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @throws YamlVariableUndefinedException A FrontMatter variable used does not exist |
294 | 294 | */ |
295 | - final protected static function evaluateYamlVar ($string, $yaml) |
|
295 | + final protected static function evaluateYamlVar($string, $yaml) |
|
296 | 296 | { |
297 | 297 | $variables = array(); |
298 | 298 | $varRegex = '/(%[a-zA-Z]+)/'; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | /** |
321 | 321 | * Handle special front matter values that need special treatment or have special meaning to a Content Item |
322 | 322 | */ |
323 | - private function handleSpecialFrontMatter () |
|
323 | + private function handleSpecialFrontMatter() |
|
324 | 324 | { |
325 | 325 | if (isset($this->frontMatter['date'])) |
326 | 326 | { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - private function getPathPermalink () |
|
353 | + private function getPathPermalink() |
|
354 | 354 | { |
355 | 355 | // Remove the protocol of the path, if there is one and prepend a '/' to the beginning |
356 | 356 | $cleanPath = preg_replace('/[\w|\d]+:\/\//', '', $this->filePath); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @return string $permalink The sanitized permalink |
377 | 377 | */ |
378 | - private function sanitizePermalink ($permalink) |
|
378 | + private function sanitizePermalink($permalink) |
|
379 | 379 | { |
380 | 380 | // Remove multiple '/' together |
381 | 381 | $permalink = preg_replace('/\/+/', '/', $permalink); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | class WhereFilter |
6 | 6 | { |
7 | - public function __invoke ($array, $key, $comparison, $value) |
|
7 | + public function __invoke($array, $key, $comparison, $value) |
|
8 | 8 | { |
9 | 9 | $results = array(); |
10 | 10 | $this->search_r($array, $key, $comparison, $value, $results); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | return new \Twig_SimpleFilter('where', new self()); |
18 | 18 | } |
19 | 19 | |
20 | - private function search_r ($array, $key, $comparison, $value, &$results) |
|
20 | + private function search_r($array, $key, $comparison, $value, &$results) |
|
21 | 21 | { |
22 | 22 | if (!is_array($array)) |
23 | 23 | { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - private function compare ($array, $key, $comparison, $value) |
|
38 | + private function compare($array, $key, $comparison, $value) |
|
39 | 39 | { |
40 | 40 | if ($comparison === "==") |
41 | 41 | { |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | class TwigExtension extends \Twig_Extension |
6 | 6 | { |
7 | - public function getFilters () |
|
7 | + public function getFilters() |
|
8 | 8 | { |
9 | 9 | return array( |
10 | 10 | GroupByFilter::get(), |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | ); |
14 | 14 | } |
15 | 15 | |
16 | - public function getFunctions () |
|
16 | + public function getFunctions() |
|
17 | 17 | { |
18 | 18 | return array( |
19 | 19 | BaseUrlFunction::get(), |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string The extension name |
28 | 28 | */ |
29 | - public function getName () |
|
29 | + public function getName() |
|
30 | 30 | { |
31 | 31 | return 'stakx_core_extension'; |
32 | 32 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class BaseUrlFunction |
8 | 8 | { |
9 | - public function __invoke (Twig_Environment $env, $assetPath) |
|
9 | + public function __invoke(Twig_Environment $env, $assetPath) |
|
10 | 10 | { |
11 | 11 | $globals = $env->getGlobals(); |
12 | 12 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | return ($baseURL . $url); |
20 | 20 | } |
21 | 21 | |
22 | - public static function get () |
|
22 | + public static function get() |
|
23 | 23 | { |
24 | 24 | return new \Twig_SimpleFunction('url', new self(), array( |
25 | 25 | 'needs_environment' => true |
@@ -13,7 +13,7 @@ |
||
13 | 13 | return file_get_contents($this->path); |
14 | 14 | } |
15 | 15 | |
16 | - public static function get () |
|
16 | + public static function get() |
|
17 | 17 | { |
18 | 18 | return new \Twig_SimpleFunction('file', new self(), array( |
19 | 19 | 'needs_environment' => true |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | |
5 | 5 | class FilesystemExtension extends \Twig_Extension |
6 | 6 | { |
7 | - public function getFilters () |
|
7 | + public function getFilters() |
|
8 | 8 | { |
9 | 9 | return array(); |
10 | 10 | } |
11 | 11 | |
12 | - public function getFunctions () |
|
12 | + public function getFunctions() |
|
13 | 13 | { |
14 | 14 | return array( |
15 | 15 | FinderFunction::get() |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return string The extension name |
23 | 23 | */ |
24 | - public function getName () |
|
24 | + public function getName() |
|
25 | 25 | { |
26 | 26 | return 'stakx_fs_extension'; |
27 | 27 | } |