@@ -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 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $filter = new Twig_SimpleFunction( |
| 33 | 33 | 'getUrl', |
| 34 | - function ( |
|
| 34 | + function( |
|
| 35 | 35 | $alias, |
| 36 | 36 | $params = [] |
| 37 | 37 | ) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $filter = new \Twig_SimpleFunction( |
| 49 | 49 | 'Widget_*_*', |
| 50 | - function ($widgetNameStr, $widgetActionStr, $args = []) { |
|
| 50 | + function($widgetNameStr, $widgetActionStr, $args = []) { |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | $function = new Functions\Widget($this->twig, $this->config, $widgetNameStr, $widgetActionStr, $args); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $filter = new \Twig_SimpleFunction( |
| 65 | 65 | 'queryParams', |
| 66 | - function ($queryParams, $prefix = '?') { |
|
| 66 | + function($queryParams, $prefix = '?') { |
|
| 67 | 67 | return $prefix . http_build_query($queryParams); |
| 68 | 68 | }, |
| 69 | 69 | array('is_safe' => array('html')) |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $filter = new \Twig_SimpleFunction( |
| 77 | 77 | 'siteUrl', |
| 78 | - function ($path = '') { |
|
| 78 | + function($path = '') { |
|
| 79 | 79 | return $this->config['base_url'] . $path; |
| 80 | 80 | }, |
| 81 | 81 | array('is_safe' => array('html')) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $filter = new \Twig_SimpleFunction( |
| 89 | 89 | 'varDump', |
| 90 | - function ($args) { |
|
| 90 | + function($args) { |
|
| 91 | 91 | /** |
| 92 | 92 | * @noinspection ForgottenDebugOutputInspection |
| 93 | 93 | */ |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | $filter = new \Twig_SimpleFunction( |
| 107 | 107 | 'Pagination', |
| 108 | - function ( |
|
| 108 | + function( |
|
| 109 | 109 | int $total, |
| 110 | 110 | int $current, |
| 111 | 111 | string $linkTemplate, |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | string $linkItemTemplate = '<a href="(href)" class="(link_class)">(text)</a>', |
| 115 | 115 | string $ellipsesTemplate = '<li><a>...</a></li>' |
| 116 | 116 | ) { |
| 117 | - $items = ''; |
|
| 117 | + $items = ''; |
|
| 118 | 118 | $pageGroupLimit = 3; |
| 119 | - $useEllipses = ($total >10) ? 1 : 0; |
|
| 119 | + $useEllipses = ($total > 10) ? 1 : 0; |
|
| 120 | 120 | $renderedEllipses = 0; |
| 121 | 121 | $values = [ |
| 122 | 122 | '(item_class)' => '', |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | '(link_class)' => '', |
| 125 | 125 | '(text)' => '' |
| 126 | 126 | ]; |
| 127 | - for ($i=1; $i <= $total; $i++) { |
|
| 127 | + for ($i = 1; $i <= $total; $i++) { |
|
| 128 | 128 | $values['(link_class)'] = ''; |
| 129 | 129 | $values['(item_class)'] = ''; |
| 130 | 130 | if ($i === $current) { |
@@ -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 | |