@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class TwigExtension extends \Twig_Extension |
11 | 11 | { |
12 | - public function getFilters() |
|
12 | + public function getFilters () |
|
13 | 13 | { |
14 | 14 | return array( |
15 | 15 | GroupByFilter::get(), |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | ); |
19 | 19 | } |
20 | 20 | |
21 | - public function getFunctions() |
|
21 | + public function getFunctions () |
|
22 | 22 | { |
23 | 23 | return array( |
24 | 24 | BaseUrlFunction::get(), |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return string The extension name |
33 | 33 | */ |
34 | - public function getName() |
|
34 | + public function getName () |
|
35 | 35 | { |
36 | 36 | return 'stakx_core_extension'; |
37 | 37 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | protected $dir; |
19 | 19 | protected $path; |
20 | 20 | |
21 | - public function __invoke(Twig_Environment $env, $location) |
|
21 | + public function __invoke (Twig_Environment $env, $location) |
|
22 | 22 | { |
23 | 23 | $this->fs = new Filesystem(); |
24 | 24 | $this->globs = $env->getGlobals(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | class FinderFunction extends TwigFilesystem |
14 | 14 | { |
15 | - public function __invoke(Twig_Environment $env, $folderLocation) |
|
15 | + public function __invoke (Twig_Environment $env, $folderLocation) |
|
16 | 16 | { |
17 | 17 | parent::__invoke($env, $folderLocation); |
18 | 18 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | return $finder; |
23 | 23 | } |
24 | 24 | |
25 | - public static function get() |
|
25 | + public static function get () |
|
26 | 26 | { |
27 | 27 | return new \Twig_SimpleFunction('finder', new self(), array( |
28 | 28 | 'needs_environment' => true, |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class BaseUrlFunction |
13 | 13 | { |
14 | - public function __invoke(Twig_Environment $env, $assetPath) |
|
14 | + public function __invoke (Twig_Environment $env, $assetPath) |
|
15 | 15 | { |
16 | 16 | $globals = $env->getGlobals(); |
17 | 17 | $assetPath = $this->guessAssetPath($assetPath); |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | return $baseURL . $url; |
26 | 26 | } |
27 | 27 | |
28 | - public static function get() |
|
28 | + public static function get () |
|
29 | 29 | { |
30 | 30 | return new \Twig_SimpleFunction('url', new self(), array( |
31 | 31 | 'needs_environment' => true, |
32 | 32 | )); |
33 | 33 | } |
34 | 34 | |
35 | - private function guessAssetPath($assetPath) |
|
35 | + private function guessAssetPath ($assetPath) |
|
36 | 36 | { |
37 | 37 | if (is_array($assetPath) || ($assetPath instanceof \ArrayAccess)) |
38 | 38 | { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $assetPath; |
47 | 47 | } |
48 | 48 | |
49 | - private function trimSlashes($url) |
|
49 | + private function trimSlashes ($url) |
|
50 | 50 | { |
51 | 51 | $url = ltrim($url, '/'); |
52 | 52 |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | |
10 | 10 | class FilesystemExtension extends \Twig_Extension |
11 | 11 | { |
12 | - public function getFilters() |
|
12 | + public function getFilters () |
|
13 | 13 | { |
14 | 14 | return array(); |
15 | 15 | } |
16 | 16 | |
17 | - public function getFunctions() |
|
17 | + public function getFunctions () |
|
18 | 18 | { |
19 | 19 | return array( |
20 | 20 | FinderFunction::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_fs_extension'; |
32 | 32 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return array |
42 | 42 | */ |
43 | - public function __invoke($array, $key, $comparison, $value) |
|
43 | + public function __invoke ($array, $key, $comparison, $value) |
|
44 | 44 | { |
45 | 45 | $results = array(); |
46 | 46 | $this->search_r($array, $key, $comparison, $value, $results); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @return \Twig_SimpleFilter |
53 | 53 | */ |
54 | - public static function get() |
|
54 | + public static function get () |
|
55 | 55 | { |
56 | 56 | return new \Twig_SimpleFilter('where', new self()); |
57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string $value The value we're searching for |
66 | 66 | * @param array $results The reference to where to keep the filtered elements |
67 | 67 | */ |
68 | - private function search_r($array, $key, $comparison, $value, &$results) |
|
68 | + private function search_r ($array, $key, $comparison, $value, &$results) |
|
69 | 69 | { |
70 | 70 | if (!is_array($array) && !($array instanceof \ArrayAccess)) |
71 | 71 | { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool |
97 | 97 | */ |
98 | - private function compare($array, $key, $comparison, $value) |
|
98 | + private function compare ($array, $key, $comparison, $value) |
|
99 | 99 | { |
100 | 100 | if ($this->compareNullValues($array, $key, $comparison, $value)) |
101 | 101 | { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - private function compareNullValues($array, $key, $comparison, $value) |
|
123 | + private function compareNullValues ($array, $key, $comparison, $value) |
|
124 | 124 | { |
125 | 125 | if ($comparison != '==' && $comparison != '!=') |
126 | 126 | { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
150 | - private function comparisonSymbol($lhs, $comparison, $rhs) |
|
150 | + private function comparisonSymbol ($lhs, $comparison, $rhs) |
|
151 | 151 | { |
152 | 152 | switch ($comparison) |
153 | 153 | { |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - private function contains($haystack, $needle) |
|
186 | + private function contains ($haystack, $needle) |
|
187 | 187 | { |
188 | 188 | return |
189 | 189 | (is_array($haystack) && in_array($needle, $haystack)) || |
190 | 190 | (is_string($haystack) && strpos($haystack, $needle) !== false); |
191 | 191 | } |
192 | 192 | |
193 | - private function containsCaseInsensitive($haystack, $needle) |
|
193 | + private function containsCaseInsensitive ($haystack, $needle) |
|
194 | 194 | { |
195 | 195 | if (is_array($haystack)) |
196 | 196 | { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | return is_string($haystack) && strpos(strtolower($haystack), strtolower($needle)) !== false; |
203 | 203 | } |
204 | 204 | |
205 | - private function regexMatches($haystack, $regex) |
|
205 | + private function regexMatches ($haystack, $regex) |
|
206 | 206 | { |
207 | 207 | return preg_match($regex, $haystack) === 1; |
208 | 208 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | - public function getFilters() |
|
26 | + public function getFilters () |
|
27 | 27 | { |
28 | 28 | return array( |
29 | 29 | new Twig_SimpleFilter('summary', 'twig_summary_filter'), |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public function getName() |
|
40 | + public function getName () |
|
41 | 41 | { |
42 | 42 | return 'Text'; |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | -function twig_summary_filter($value, $paragraphCount = 1) |
|
46 | +function twig_summary_filter ($value, $paragraphCount = 1) |
|
47 | 47 | { |
48 | 48 | if (function_exists('simplexml_load_string')) |
49 | 49 | { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $value; |
65 | 65 | } |
66 | 66 | |
67 | -function twig_truncate_filter(Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...') |
|
67 | +function twig_truncate_filter (Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...') |
|
68 | 68 | { |
69 | 69 | if (mb_strlen($value, $env->getCharset()) > $length) |
70 | 70 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return $value; |
86 | 86 | } |
87 | 87 | |
88 | -function twig_wordwrap_filter(Twig_Environment $env, $value, $length = 80, $separator = "\n", $preserve = false) |
|
88 | +function twig_wordwrap_filter (Twig_Environment $env, $value, $length = 80, $separator = "\n", $preserve = false) |
|
89 | 89 | { |
90 | 90 | $sentences = array(); |
91 | 91 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function absolutePath($pathFragments) |
|
28 | + public function absolutePath ($pathFragments) |
|
29 | 29 | { |
30 | 30 | if ($this->isAbsolutePath($pathFragments)) |
31 | 31 | { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return string |
47 | 47 | */ |
48 | - public function appendPath($pathFragments) |
|
48 | + public function appendPath ($pathFragments) |
|
49 | 49 | { |
50 | 50 | return implode(DIRECTORY_SEPARATOR, func_get_args()); |
51 | 51 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @throws FileNotFoundException When originFile doesn't exist |
61 | 61 | * @throws IOException When copy fails |
62 | 62 | */ |
63 | - public function copy($originFile, $targetFile, $overwriteNewerFiles = false) |
|
63 | + public function copy ($originFile, $targetFile, $overwriteNewerFiles = false) |
|
64 | 64 | { |
65 | 65 | if ($this->isDir($originFile)) |
66 | 66 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return SplFileInfo |
99 | 99 | */ |
100 | - public function createSplFileInfo($filePath) |
|
100 | + public function createSplFileInfo ($filePath) |
|
101 | 101 | { |
102 | 102 | return new SplFileInfo( |
103 | 103 | $this->absolutePath($filePath), |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - public function getRelativePath($path) |
|
116 | + public function getRelativePath ($path) |
|
117 | 117 | { |
118 | 118 | return str_replace(getcwd() . DIRECTORY_SEPARATOR, '', $path); |
119 | 119 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return string |
127 | 127 | */ |
128 | - public function getBaseName($filePath) |
|
128 | + public function getBaseName ($filePath) |
|
129 | 129 | { |
130 | 130 | return pathinfo($filePath, PATHINFO_FILENAME); |
131 | 131 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function getFileName($filePath) |
|
140 | + public function getFileName ($filePath) |
|
141 | 141 | { |
142 | 142 | return pathinfo($filePath, PATHINFO_BASENAME); |
143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - public function getFolderPath($filePath) |
|
152 | + public function getFolderPath ($filePath) |
|
153 | 153 | { |
154 | 154 | return pathinfo($filePath, PATHINFO_DIRNAME); |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return string The extension of the file |
163 | 163 | */ |
164 | - public function getExtension($filename) |
|
164 | + public function getExtension ($filename) |
|
165 | 165 | { |
166 | 166 | return pathinfo($filename, PATHINFO_EXTENSION); |
167 | 167 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return bool |
175 | 175 | */ |
176 | - public function isDir($folderPath) |
|
176 | + public function isDir ($folderPath) |
|
177 | 177 | { |
178 | 178 | return is_dir($folderPath); |
179 | 179 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function removeExtension($filename) |
|
188 | + public function removeExtension ($filename) |
|
189 | 189 | { |
190 | 190 | return $this->appendPath( |
191 | 191 | $this->getFolderPath($filename), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return SplFileInfo A reference to the newly created file |
204 | 204 | */ |
205 | - public function writeFile($targetDir, $fileName, $content) |
|
205 | + public function writeFile ($targetDir, $fileName, $content) |
|
206 | 206 | { |
207 | 207 | $outputFolder = $this->getFolderPath($this->absolutePath($targetDir, $fileName)); |
208 | 208 | $targetFile = $this->getFileName($fileName); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | private static $fs; |
16 | 16 | |
17 | - public static function getResource($fileName) |
|
17 | + public static function getResource ($fileName) |
|
18 | 18 | { |
19 | 19 | self::initFileSystem(); |
20 | 20 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | ); |
24 | 24 | } |
25 | 25 | |
26 | - private static function initFileSystem() |
|
26 | + private static function initFileSystem () |
|
27 | 27 | { |
28 | 28 | if (is_null(self::$fs)) |
29 | 29 | { |