@@ -63,7 +63,7 @@ |
||
63 | 63 | /** |
64 | 64 | * Build translate array. |
65 | 65 | * @param $translateArray |
66 | - * @return array |
|
66 | + * @return string |
|
67 | 67 | */ |
68 | 68 | private function buildTranslateArray(array $translateArray) { |
69 | 69 | $tmpArray = []; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $filter = new \Twig_SimpleFunction( |
45 | 45 | '_t', |
46 | - function ( |
|
46 | + function( |
|
47 | 47 | $string, |
48 | 48 | array $findAndReplace = null |
49 | 49 | ) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $tmpArray = []; |
70 | 70 | foreach ($translateArray as $key => $value) { |
71 | - $tmpArray['@'.$key] = $value; |
|
71 | + $tmpArray['@' . $key] = $value; |
|
72 | 72 | } |
73 | 73 | return $tmpArray; |
74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $filter = new \Twig_SimpleFunction( |
79 | 79 | 'getUrl', |
80 | - function ( |
|
80 | + function( |
|
81 | 81 | $alias, |
82 | 82 | $params = [] |
83 | 83 | ) { |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $relative_path = $data; |
87 | 87 | foreach ($params as $param => $value) { |
88 | 88 | if (strpos($param, ':') === strlen($param)-1) { |
89 | - $relative_path = preg_replace('/{'.$param.'(.*?)}/msi', $value, $relative_path); |
|
89 | + $relative_path = preg_replace('/{' . $param . '(.*?)}/msi', $value, $relative_path); |
|
90 | 90 | } else { |
91 | - $relative_path = str_replace('{'.$param.'}', $value, $relative_path); |
|
91 | + $relative_path = str_replace('{' . $param . '}', $value, $relative_path); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | return $this->config['base_url'] . '/' . $relative_path; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | $filter = new \Twig_SimpleFunction( |
106 | 106 | 'Widget_*_*', |
107 | - function ($widgetNameStr, $widgetActionStr, $args = []) { |
|
107 | + function($widgetNameStr, $widgetActionStr, $args = []) { |
|
108 | 108 | $widgetAction = $this->toCamelCase->transform($widgetActionStr); |
109 | 109 | $widgetName = $this->toCamelCase->transform($widgetNameStr); |
110 | 110 | $widget = '\\' . $this->config['app_namespace'] . '\\Widget\\' . $widgetName; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ); |
131 | 131 | throw new InvalidArgumentException($message); |
132 | 132 | } |
133 | - $templateFile = '_widgets/' |
|
133 | + $templateFile = '_widgets/' |
|
134 | 134 | . $this->toSnakeCase->transform($widgetNameStr) . '/' . $templateFileBasename; |
135 | 135 | $widgetData = $widgetInstance->{$widgetAction}(); |
136 | 136 | return $this->twig->render($templateFile, $widgetData); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | { |
145 | 145 | $filter = new \Twig_SimpleFunction( |
146 | 146 | 'queryParams', |
147 | - function ($queryParams, $prefix = '?') { |
|
147 | + function($queryParams, $prefix = '?') { |
|
148 | 148 | return $prefix . http_build_query($queryParams); |
149 | 149 | }, |
150 | 150 | array('is_safe' => array('html')) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | { |
157 | 157 | $filter = new \Twig_SimpleFunction( |
158 | 158 | 'siteUrl', |
159 | - function ($path = '') { |
|
159 | + function($path = '') { |
|
160 | 160 | return $this->config['base_url'] . $path; |
161 | 161 | }, |
162 | 162 | array('is_safe' => array('html')) |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $filter = new \Twig_SimpleFunction( |
170 | 170 | 'varDump', |
171 | - function ($args) { |
|
171 | + function($args) { |
|
172 | 172 | /** @noinspection ForgottenDebugOutputInspection */ |
173 | 173 | var_dump($args); |
174 | 174 | }, |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | /** @noinspection MoreThanThreeArgumentsInspection */ |
183 | 183 | $filter = new \Twig_SimpleFunction( |
184 | 184 | 'Pagination', |
185 | - function ( |
|
185 | + function( |
|
186 | 186 | int $total, |
187 | 187 | int $current, |
188 | 188 | string $linkTemplate, |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | string $linkItemTemplate = '<a href="(href)" class="(link_class)">(text)</a>', |
192 | 192 | string $ellipsesTemplate = '<li><a>...</a></li>' |
193 | 193 | ) { |
194 | - $items = ''; |
|
194 | + $items = ''; |
|
195 | 195 | $pageGroupLimit = 3; |
196 | - $useEllipses = ($total >10) ? 1 : 0; |
|
196 | + $useEllipses = ($total > 10) ? 1 : 0; |
|
197 | 197 | $renderedEllipses = 0; |
198 | 198 | $values = [ |
199 | 199 | '(item_class)' => '', |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | '(link_class)' => '', |
202 | 202 | '(text)' => '' |
203 | 203 | ]; |
204 | - for ($i=1; $i <= $total; $i++) { |
|
204 | + for ($i = 1; $i <= $total; $i++) { |
|
205 | 205 | $values['(link_class)'] = ''; |
206 | 206 | $values['(item_class)'] = ''; |
207 | 207 | if ($i === $current) { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * and $baseUrl = 'http://127.0.0.1' and $page_lang = 'en_US' |
50 | 50 | * {{ getUrl('about', {'lang': page_lang}) }} produces http://127.0.0.1/en_US/about-us |
51 | 51 | */ |
52 | - protected function extendForGetUrl(){ } |
|
52 | + protected function extendForGetUrl() { } |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Extend for wildcard Widget functions. Widget function determines the class and method that will be called. |