@@ -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 | /** |
@@ -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; |
| 5 | 5 | |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | $dictionary = $this->config['dictionary']?? []; |
| 33 | 33 | $filter = new \Twig_SimpleFunction( |
| 34 | 34 | 'translate', |
| 35 | - function ( |
|
| 35 | + function( |
|
| 36 | 36 | $string, ...$findAndReplace |
| 37 | 37 | ) use ($dictionary) { |
| 38 | 38 | if (array_key_exists($string, $dictionary)) { |
| 39 | 39 | $string = $dictionary[$string]; |
| 40 | 40 | } |
| 41 | - if (! empty($findAndReplace)) { |
|
| 41 | + if (!empty($findAndReplace)) { |
|
| 42 | 42 | foreach ($findAndReplace[0] as $find => $replace) { |
| 43 | - $string = str_replace('{{'.$find.'}}', $replace, $string); |
|
| 43 | + $string = str_replace('{{' . $find . '}}', $replace, $string); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | return $string; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $filter = new Twig_SimpleFunction( |
| 56 | 56 | 'getUrl', |
| 57 | - function ( |
|
| 57 | + function( |
|
| 58 | 58 | $alias, |
| 59 | 59 | $params = [] |
| 60 | 60 | ) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $filter = new \Twig_SimpleFunction( |
| 77 | 77 | 'Widget_*_*', |
| 78 | - function ($widgetNameStr, $widgetActionStr, $args = []) { |
|
| 78 | + function($widgetNameStr, $widgetActionStr, $args = []) { |
|
| 79 | 79 | $function = new Functions\Widget($this->twig, $this->config, $widgetNameStr, $widgetActionStr, $args); |
| 80 | 80 | return $function->run(); |
| 81 | 81 | }, |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $filter = new \Twig_SimpleFunction( |
| 90 | 90 | 'queryParams', |
| 91 | - function ($queryParams, $prefix = '?') { |
|
| 91 | + function($queryParams, $prefix = '?') { |
|
| 92 | 92 | return $prefix . http_build_query($queryParams); |
| 93 | 93 | }, |
| 94 | 94 | array('is_safe' => array('html')) |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $filter = new \Twig_SimpleFunction( |
| 102 | 102 | 'siteUrl', |
| 103 | - function ($path = '') { |
|
| 103 | + function($path = '') { |
|
| 104 | 104 | return $this->config['runtime']['base_url'] . $path; |
| 105 | 105 | }, |
| 106 | 106 | array('is_safe' => array('html')) |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $filter = new \Twig_SimpleFunction( |
| 114 | 114 | 'varDump', |
| 115 | - function ($args) { |
|
| 115 | + function($args) { |
|
| 116 | 116 | /** |
| 117 | 117 | * @noinspection ForgottenDebugOutputInspection |
| 118 | 118 | */ |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | $filter = new \Twig_SimpleFunction( |
| 132 | 132 | 'Pagination', |
| 133 | - function ( |
|
| 133 | + function( |
|
| 134 | 134 | int $total, |
| 135 | 135 | int $current, |
| 136 | 136 | string $linkTemplate, |
@@ -40,8 +40,8 @@ |
||
| 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 | } |
@@ -27,13 +27,13 @@ |
||
| 27 | 27 | $this->twig = $twig; |
| 28 | 28 | $this->config = $config; |
| 29 | 29 | $widgetAction = CaseConverter::toPascalCase($widgetActionStr); |
| 30 | - $widgetName = CaseConverter::toPascalCase($widgetNameStr); |
|
| 30 | + $widgetName = CaseConverter::toPascalCase($widgetNameStr); |
|
| 31 | 31 | $widget = '\\' . $this->config['app_namespace'] . '\\Widget\\' . $widgetName; |
| 32 | 32 | $this->checkClassIfExists($widget, $widgetName, $widgetAction); |
| 33 | 33 | $widgetInstance = new $widget($args); |
| 34 | 34 | $templateFileBasename = $args['template'] ?? CaseConverter::toSnakeCase($widgetActionStr) . '.twig'; |
| 35 | 35 | $this->checkIdTemplateFileExist($templateFileBasename, $widgetNameStr, $widgetActionStr); |
| 36 | - $this->templateFile = '_widgets/' |
|
| 36 | + $this->templateFile = '_widgets/' |
|
| 37 | 37 | . CaseConverter::toSnakeCase($widgetNameStr) . '/' . $templateFileBasename; |
| 38 | 38 | $this->widgetData = $widgetInstance->{$widgetAction}(); |
| 39 | 39 | } |
@@ -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; |
| 5 | 5 | |
@@ -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 | |
@@ -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 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Selami\View\NullView; |
| 5 | 5 | |