Passed
Push — master ( 200f34...68234c )
by Mehmet
01:49
created
src/Twig/TwigExtensions.php 3 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,11 +3,8 @@
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
47 47
     {
48 48
         $filter = new \Twig_SimpleFunction(
49 49
             'Widget_*_*',
50
-            function ($widgetNameStr, $widgetActionStr, $args = []) {
50
+            function($widgetNameStr, $widgetActionStr, $args = []) {
51 51
                 $function = new Functions\Widget($this->twig, $this->config, $widgetNameStr, $widgetActionStr, $args);
52 52
                 return $function->run();
53 53
             },
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $filter = new \Twig_SimpleFunction(
62 62
             'queryParams',
63
-            function ($queryParams, $prefix = '?') {
63
+            function($queryParams, $prefix = '?') {
64 64
                 return $prefix . http_build_query($queryParams);
65 65
             },
66 66
             array('is_safe' => array('html'))
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $filter = new \Twig_SimpleFunction(
74 74
             'siteUrl',
75
-            function ($path = '') {
75
+            function($path = '') {
76 76
                 return $this->config['base_url'] . $path;
77 77
             },
78 78
             array('is_safe' => array('html'))
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $filter = new \Twig_SimpleFunction(
86 86
             'varDump',
87
-            function ($args) {
87
+            function($args) {
88 88
                 /**
89 89
             * @noinspection ForgottenDebugOutputInspection
90 90
             */
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 */
103 103
         $filter = new \Twig_SimpleFunction(
104 104
             'Pagination',
105
-            function (
105
+            function(
106 106
                 int $total,
107 107
                 int $current,
108 108
                 string $linkTemplate,
Please login to merge, or discard this patch.
src/Twig/Functions/Widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Twig/Functions/GetUrl.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/FunctionInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Selami\View;
5 5
 
Please login to merge, or discard this patch.
src/Twig/Functions/Pagination.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -49,6 +49,9 @@
 block discarded – undo
49 49
         return str_replace('(items)', $items, $this->parentTemplate);
50 50
     }
51 51
 
52
+    /**
53
+     * @param integer $useEllipses
54
+     */
52 55
     private function getItem(int $i, $renderedEllipses, $useEllipses) : array
53 56
     {
54 57
         $values = [
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Selami\View\Twig\Functions;
5 5
 
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function run(): string
39 39
     {
40
-        $items =  '';
40
+        $items = '';
41 41
         $renderedEllipses = 0;
42 42
         $useEllipses = ($this->total > 10) ? 1 : 0;
43 43
 
44
-        for ($i=1; $i <= $this->total; $i++) {
44
+        for ($i = 1; $i <= $this->total; $i++) {
45 45
             $item = $this->getItem($i, $renderedEllipses, $useEllipses);
46 46
             $items .= $item[0];
47 47
             $renderedEllipses = $item[1];
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     private function determineUseLink(int $i, array $values, int $useEllipses, int $renderedEllipses) : array
72 72
     {
73
-        $item ='';
73
+        $item = '';
74 74
         if ($useEllipses === 1) {
75 75
             return $this->useEllipses($i, $values, $renderedEllipses);
76 76
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     private function useEllipses(int $i, array $values, int $renderedEllipses)
88 88
     {
89 89
         $pageGroupLimit = self::PAGE_GROUP_LIMIT;
90
-        $item =  '';
90
+        $item = '';
91 91
         if (($i <= $pageGroupLimit)
92 92
             ||  ($i >= ($this->current-1) && $i <= ($this->current+1))
93 93
             || ($i >= ($this->total-2))
Please login to merge, or discard this patch.