Completed
Push — master ( 299dac...485983 )
by Mehmet
10:05
created
src/Twig/TwigExtensions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $filter = new \Twig_SimpleFunction(
46 46
             'getUrl',
47
-            function (
47
+            function(
48 48
                 $alias,
49 49
                 $params = []
50 50
             ) {
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
                     $relative_path = $data;
54 54
                     foreach ($params as $param => $value) {
55 55
                         if (strpos($param, ':') === strlen($param)-1) {
56
-                            $relative_path = preg_replace('/{'.$param.'(.*?)}/msi', $value, $relative_path);
56
+                            $relative_path = preg_replace('/{' . $param . '(.*?)}/msi', $value, $relative_path);
57 57
                         } else {
58
-                            $relative_path = str_replace('{'.$param.'}', $value, $relative_path);
58
+                            $relative_path = str_replace('{' . $param . '}', $value, $relative_path);
59 59
                         }
60 60
                     }
61 61
                     return $this->config['base_url'] . '/' . $relative_path;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $filter = new \Twig_SimpleFunction(
73 73
             'Widget_*_*',
74
-            function ($widgetNameStr, $widgetActionStr, $args = []) {
74
+            function($widgetNameStr, $widgetActionStr, $args = []) {
75 75
                 $widgetAction = $this->toCamelCase->transform($widgetActionStr);
76 76
                 $widgetName = $this->toCamelCase->transform($widgetNameStr);
77 77
                 $widget = '\\' . $this->config['app_namespace'] . '\\Widget\\' . $widgetName;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                     );
98 98
                     throw new InvalidArgumentException($message);
99 99
                 }
100
-                $templateFile =  '_widgets/'
100
+                $templateFile = '_widgets/'
101 101
                     . $this->toSnakeCase->transform($widgetNameStr) . '/' . $templateFileBasename;
102 102
                 $widgetData = $widgetInstance->{$widgetAction}();
103 103
                 return $this->twig->render($templateFile, $widgetData);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $filter = new \Twig_SimpleFunction(
113 113
             'queryParams',
114
-            function ($queryParams, $prefix = '?') {
114
+            function($queryParams, $prefix = '?') {
115 115
                 return $prefix . http_build_query($queryParams);
116 116
             },
117 117
             array('is_safe' => array('html'))
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $filter = new \Twig_SimpleFunction(
125 125
             'siteUrl',
126
-            function ($path = '') {
126
+            function($path = '') {
127 127
                 return $this->config['base_url'] . $path;
128 128
             },
129 129
             array('is_safe' => array('html'))
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $filter = new \Twig_SimpleFunction(
137 137
             'varDump',
138
-            function ($args) {
138
+            function($args) {
139 139
                 /**
140 140
             * @noinspection ForgottenDebugOutputInspection 
141 141
             */
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 */
154 154
         $filter = new \Twig_SimpleFunction(
155 155
             'Pagination',
156
-            function (
156
+            function(
157 157
                 int $total,
158 158
                 int $current,
159 159
                 string $linkTemplate,
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
                 string $linkItemTemplate = '<a href="(href)" class="(link_class)">(text)</a>',
163 163
                 string $ellipsesTemplate = '<li><a>...</a></li>'
164 164
             ) {
165
-                $items =  '';
165
+                $items = '';
166 166
                 $pageGroupLimit = 3;
167
-                $useEllipses = ($total >10) ? 1 : 0;
167
+                $useEllipses = ($total > 10) ? 1 : 0;
168 168
                 $renderedEllipses = 0;
169 169
                 $values = [
170 170
                     '(item_class)'  => '',
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                     '(link_class)'  => '',
173 173
                     '(text)'  => ''
174 174
                 ];
175
-                for ($i=1; $i <= $total; $i++) {
175
+                for ($i = 1; $i <= $total; $i++) {
176 176
                     $values['(link_class)'] = '';
177 177
                     $values['(item_class)'] = '';
178 178
                     if ($i === $current) {
Please login to merge, or discard this patch.