@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Selami\View\Twig\Functions; |
5 | 5 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | $this->twig = $twig; |
24 | 24 | $this->config = $config; |
25 | 25 | $widgetAction = CaseConverter::toPascalCase($widgetActionStr); |
26 | - $widgetName = CaseConverter::toPascalCase($widgetNameStr); |
|
26 | + $widgetName = CaseConverter::toPascalCase($widgetNameStr); |
|
27 | 27 | $widget = '\\' . $this->config['app_namespace'] . '\\Widget\\' . $widgetName; |
28 | 28 | $this->checkClassIfExists($widget, $widgetName, $widgetAction); |
29 | 29 | $widgetInstance = new $widget($args); |
30 | 30 | $templateFileBasename = $args['template'] ?? CaseConverter::toSnakeCase($widgetActionStr) . '.twig'; |
31 | 31 | $this->checkIdTemplateFileExist($templateFileBasename, $widgetNameStr, $widgetActionStr); |
32 | - $this->templateFile = '_widgets/' |
|
32 | + $this->templateFile = '_widgets/' |
|
33 | 33 | . CaseConverter::toSnakeCase($widgetNameStr) . '/' . $templateFileBasename; |
34 | 34 | $this->widgetData = $widgetInstance->{$widgetAction}(); |
35 | 35 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Selami\View\Twig\Functions; |
5 | 5 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | private function findRelativePath($relativePath, $param, $value): string |
41 | 41 | { |
42 | 42 | if (strpos($param, ':') === strlen($param)-1) { |
43 | - return preg_replace('/{'.$param.'(.*?)}/msi', $value, $relativePath); |
|
43 | + return preg_replace('/{' . $param . '(.*?)}/msi', $value, $relativePath); |
|
44 | 44 | } |
45 | - return str_replace('{'.$param.'}', $value, $relativePath); |
|
45 | + return str_replace('{' . $param . '}', $value, $relativePath); |
|
46 | 46 | } |
47 | 47 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Selami\View; |
5 | 5 |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | 'varDump', |
87 | 87 | function ($args) { |
88 | 88 | /** |
89 | - * @noinspection ForgottenDebugOutputInspection |
|
90 | - */ |
|
89 | + * @noinspection ForgottenDebugOutputInspection |
|
90 | + */ |
|
91 | 91 | var_dump($args); |
92 | 92 | }, |
93 | 93 | array('is_safe' => array('html')) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | protected function extendForPagination() : void |
99 | 99 | { |
100 | 100 | /** |
101 | - * @noinspection MoreThanThreeArgumentsInspection |
|
101 | + * @noinspection MoreThanThreeArgumentsInspection |
|
102 | 102 | */ |
103 | 103 | $filter = new \Twig_SimpleFunction( |
104 | 104 | 'Pagination', |
@@ -3,11 +3,8 @@ |
||
3 | 3 | |
4 | 4 | namespace Selami\View\Twig; |
5 | 5 | |
6 | -use Selami\Stdlib\CaseConverter; |
|
7 | 6 | use Selami\View\ExtensionsAbstract; |
8 | 7 | use Twig\Environment; |
9 | -use InvalidArgumentException; |
|
10 | -use BadMethodCallException; |
|
11 | 8 | use Twig_SimpleFunction; |
12 | 9 | |
13 | 10 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $dictionary = $this->config['dictionary']?? []; |
33 | 33 | $filter = new \Twig_SimpleFunction( |
34 | 34 | 'translate', |
35 | - function ( |
|
35 | + function( |
|
36 | 36 | $string |
37 | 37 | ) use ($dictionary) { |
38 | 38 | if (array_key_exists($string, $dictionary)) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $filter = new Twig_SimpleFunction( |
51 | 51 | 'getUrl', |
52 | - function ( |
|
52 | + function( |
|
53 | 53 | $alias, |
54 | 54 | $params = [] |
55 | 55 | ) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $filter = new \Twig_SimpleFunction( |
72 | 72 | 'Widget_*_*', |
73 | - function ($widgetNameStr, $widgetActionStr, $args = []) { |
|
73 | + function($widgetNameStr, $widgetActionStr, $args = []) { |
|
74 | 74 | $function = new Functions\Widget($this->twig, $this->config, $widgetNameStr, $widgetActionStr, $args); |
75 | 75 | return $function->run(); |
76 | 76 | }, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $filter = new \Twig_SimpleFunction( |
85 | 85 | 'queryParams', |
86 | - function ($queryParams, $prefix = '?') { |
|
86 | + function($queryParams, $prefix = '?') { |
|
87 | 87 | return $prefix . http_build_query($queryParams); |
88 | 88 | }, |
89 | 89 | array('is_safe' => array('html')) |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $filter = new \Twig_SimpleFunction( |
97 | 97 | 'siteUrl', |
98 | - function ($path = '') { |
|
98 | + function($path = '') { |
|
99 | 99 | return $this->config['runtime']['base_url'] . $path; |
100 | 100 | }, |
101 | 101 | array('is_safe' => array('html')) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $filter = new \Twig_SimpleFunction( |
109 | 109 | 'varDump', |
110 | - function ($args) { |
|
110 | + function($args) { |
|
111 | 111 | /** |
112 | 112 | * @noinspection ForgottenDebugOutputInspection |
113 | 113 | */ |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | $filter = new \Twig_SimpleFunction( |
127 | 127 | 'Pagination', |
128 | - function ( |
|
128 | + function( |
|
129 | 129 | int $total, |
130 | 130 | int $current, |
131 | 131 | string $linkTemplate, |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Selami\View\Twig\Functions; |
5 | 5 |