@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * Configuration constructor. |
35 | 35 | * |
36 | 36 | * @param string $configFile |
37 | - * @param ConsoleInterface|OutputInterface|null $output |
|
37 | + * @param ConsoleInterface $output |
|
38 | 38 | */ |
39 | 39 | public function __construct($configFile, $output = null) |
40 | 40 | { |
@@ -83,11 +83,17 @@ discard block |
||
83 | 83 | return $base; |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @return string[] |
|
88 | + */ |
|
86 | 89 | public function getDataFolders () |
87 | 90 | { |
88 | 91 | return $this->returnConfigOption('data'); |
89 | 92 | } |
90 | 93 | |
94 | + /** |
|
95 | + * @return string[] |
|
96 | + */ |
|
91 | 97 | public function getDataSets () |
92 | 98 | { |
93 | 99 | return $this->returnConfigOption('datasets'); |
@@ -133,6 +139,9 @@ discard block |
||
133 | 139 | return $this->configuration['twig']['autoescape']; |
134 | 140 | } |
135 | 141 | |
142 | + /** |
|
143 | + * @param string $name |
|
144 | + */ |
|
136 | 145 | private function returnConfigOption ($name, $default = null) |
137 | 146 | { |
138 | 147 | return (isset($this->configuration[$name]) ? $this->configuration[$name] : $default); |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | try |
48 | 48 | { |
49 | 49 | $this->configuration = Yaml::parse(file_get_contents($configFile)); |
50 | - } |
|
51 | - catch (ParseException $e) |
|
50 | + } catch (ParseException $e) |
|
52 | 51 | { |
53 | 52 | $this->output->error("Parsing the configuration failed: {message}", array( |
54 | 53 | "message" => $e->getMessage() |
@@ -158,8 +157,7 @@ discard block |
||
158 | 157 | if (is_array($this->configuration)) |
159 | 158 | { |
160 | 159 | $this->configuration = ArrayUtilities::array_merge_defaults($defaultConfig, $this->configuration, 'name'); |
161 | - } |
|
162 | - else |
|
160 | + } else |
|
163 | 161 | { |
164 | 162 | $this->configuration = $defaultConfig; |
165 | 163 | } |
@@ -140,6 +140,9 @@ |
||
140 | 140 | return pathinfo($filename, PATHINFO_EXTENSION); |
141 | 141 | } |
142 | 142 | |
143 | + /** |
|
144 | + * @param string $folderPath |
|
145 | + */ |
|
143 | 146 | public function isDir ($folderPath) |
144 | 147 | { |
145 | 148 | return is_dir($folderPath); |
@@ -62,6 +62,10 @@ discard block |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $absolutePath |
|
67 | + * @param string $targetPath |
|
68 | + */ |
|
65 | 69 | public function copyFile ($absolutePath, $targetPath) |
66 | 70 | { |
67 | 71 | $targetPath = ltrim($targetPath, DIRECTORY_SEPARATOR); |
@@ -73,6 +77,10 @@ discard block |
||
73 | 77 | ); |
74 | 78 | } |
75 | 79 | |
80 | + /** |
|
81 | + * @param string $targetPath |
|
82 | + * @param string $fileContent |
|
83 | + */ |
|
76 | 84 | public function writeFile ($targetPath, $fileContent) |
77 | 85 | { |
78 | 86 | $outputFolder = $this->fs->getFolderPath($targetPath); |
@@ -98,6 +106,9 @@ discard block |
||
98 | 106 | )); |
99 | 107 | } |
100 | 108 | |
109 | + /** |
|
110 | + * @param string $pathFragments |
|
111 | + */ |
|
101 | 112 | private function buildPath ($pathFragments) |
102 | 113 | { |
103 | 114 | $paths = func_get_args(); |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | if (substr($folderPath, 0, 1) === DIRECTORY_SEPARATOR) |
26 | 26 | { |
27 | 27 | $this->absolutePath = $folderPath; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | $this->absolutePath = $this->fs->absolutePath($folderPath); |
32 | 31 | } |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | if (is_null($folderName) || empty($folderName)) |
56 | 55 | { |
57 | 56 | $this->targetDirectories = array(); |
58 | - } |
|
59 | - else |
|
57 | + } else |
|
60 | 58 | { |
61 | 59 | $this->targetDirectories[] = trim($folderName, DIRECTORY_SEPARATOR); |
62 | 60 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Returns a list of filters. |
17 | 17 | * |
18 | - * @return array |
|
18 | + * @return Twig_SimpleFilter[] |
|
19 | 19 | */ |
20 | 20 | public function getFilters() |
21 | 21 | { |
@@ -33,8 +33,7 @@ |
||
33 | 33 | $output->writeln(sprintf("Your site built successfully! It can be found at: %s", |
34 | 34 | $this->website->getConfiguration()->getTargetFolder() . DIRECTORY_SEPARATOR |
35 | 35 | )); |
36 | - } |
|
37 | - catch (\Exception $e) |
|
36 | + } catch (\Exception $e) |
|
38 | 37 | { |
39 | 38 | $output->writeln(sprintf("Your website failed to build with the following error: %s", |
40 | 39 | $e->getMessage() |
@@ -28,8 +28,7 @@ |
||
28 | 28 | )); |
29 | 29 | |
30 | 30 | $this->website->watch(); |
31 | - } |
|
32 | - catch (\Exception $e) |
|
31 | + } catch (\Exception $e) |
|
33 | 32 | { |
34 | 33 | $output->writeln(sprintf("Your website failed to build with the following error: %s", |
35 | 34 | $e->getMessage() |
@@ -88,8 +88,7 @@ |
||
88 | 88 | if ($newPageView->isDynamicPage()) |
89 | 89 | { |
90 | 90 | $this->dynamicPageViews[] = $newPageView; |
91 | - } |
|
92 | - else |
|
91 | + } else |
|
93 | 92 | { |
94 | 93 | $this->addToSiteMenu($newPageView->getFrontMatter()); |
95 | 94 | $this->staticPageViews[] = $newPageView; |
@@ -127,8 +127,7 @@ |
||
127 | 127 | { |
128 | 128 | $this->handleDependencies($ext); |
129 | 129 | $dataItems[$name] = $this->$fxnName($content); |
130 | - } |
|
131 | - else |
|
130 | + } else |
|
132 | 131 | { |
133 | 132 | $this->output->warning("There is no function to handle '$ext' file format."); |
134 | 133 | } |
@@ -20,18 +20,15 @@ |
||
20 | 20 | $valueMerged = true; |
21 | 21 | |
22 | 22 | break; |
23 | - } |
|
24 | - else if ($mergedKey == $key) |
|
23 | + } else if ($mergedKey == $key) |
|
25 | 24 | { |
26 | 25 | if (is_numeric($mergedKey)) |
27 | 26 | { |
28 | 27 | $merged[] = $value; |
29 | - } |
|
30 | - else if (is_array($item)) |
|
28 | + } else if (is_array($item)) |
|
31 | 29 | { |
32 | 30 | $item = array_unique(array_merge($item, $value)); |
33 | - } |
|
34 | - else |
|
31 | + } else |
|
35 | 32 | { |
36 | 33 | $item = $value; |
37 | 34 | } |