Passed
Push — master ( 6d8f4b...82f522 )
by Iman
05:38
created
src/Utils/Normalizers/CacheTagsNormalizer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function normalize($widget): void
15 15
     {
16
-        if (! property_exists($widget, 'cacheTags')) {
16
+        if (!property_exists($widget, 'cacheTags')) {
17 17
             $widget->cacheTags = [];
18 18
         } elseif (is_array($widget->cacheTags)) {
19 19
             $this->checkTagForString($widget);
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     private function errorOut($widget, $tag = null): void
30 30
     {
31
-        $tag = $tag ? ' '.$tag.'is not string' : '';
32
-        throw new \InvalidArgumentException('Cache Tags on "'.get_class($widget).'" must be of type Array with String elements.'.$tag);
31
+        $tag = $tag ? ' ' . $tag . 'is not string' : '';
32
+        throw new \InvalidArgumentException('Cache Tags on "' . get_class($widget) . '" must be of type Array with String elements.' . $tag);
33 33
     }
34 34
 
35 35
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     protected function checkTagForString($widget): void
39 39
     {
40 40
         foreach ($widget->cacheTags as $tag) {
41
-            if (! is_string($tag)) {
41
+            if (!is_string($tag)) {
42 42
                 $this->errorOut($widget);
43 43
             }
44 44
         }
Please login to merge, or discard this patch.
src/SingletonServices.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@
 block discarded – undo
45 45
 
46 46
     public function registerSingletons(Container $app)
47 47
     {
48
-        $app->singleton('command.imanghafoori.widget', function (Container $app) {
48
+        $app->singleton('command.imanghafoori.widget', function(Container $app) {
49 49
             return $app['Imanghafoori\Widgets\WidgetGenerator'];
50 50
         });
51 51
 
52
-        $app->singleton(Normalizer::class, function () {
52
+        $app->singleton(Normalizer::class, function() {
53 53
             $mainNormalizer = new Utils\Normalizer();
54 54
             foreach ($this->normalizers as $normalizer) {
55 55
                 $mainNormalizer->addNormalizer(new $normalizer);
Please login to merge, or discard this patch.
src/Utils/Normalizers/TemplateNormalizer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
     public function normalize($widget) : void
16 16
     {
17 17
         // class name without namespace.
18
-        $className = str_replace(app()->getNamespace().'Widgets\\', '', get_class($widget));
18
+        $className = str_replace(app()->getNamespace() . 'Widgets\\', '', get_class($widget));
19 19
 
20 20
         // replace slashes with dots
21 21
         $className = str_replace(['\\', '/'], '.', $className);
22 22
 
23
-        if (! property_exists($widget, 'template')) {
24
-            $widget->template = 'Widgets::'.$className.'View';
23
+        if (!property_exists($widget, 'template')) {
24
+            $widget->template = 'Widgets::' . $className . 'View';
25 25
         }
26 26
 
27
-        if (! view()->exists($widget->template)) {
28
-            throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '".get_class($widget)." '");
27
+        if (!view()->exists($widget->template)) {
28
+            throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '" . get_class($widget) . " '");
29 29
         }
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
src/Utils/DebugInfo.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $tpl = $this->getTplPath($this->widget->template);
42 42
 
43
-        $this->html = "<span title='WidgetObj : ".get_class($this->widget).".php&#013;Template : {$tpl}{$this->cacheState()}'>{$this->html}</span>";
43
+        $this->html = "<span title='WidgetObj : " . get_class($this->widget) . ".php&#013;Template : {$tpl}{$this->cacheState()}'>{$this->html}</span>";
44 44
     }
45 45
 
46 46
     /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     private function cacheState(): string
52 52
     {
53
-        if (! $this->policies->widgetShouldUseCache()) {
53
+        if (!$this->policies->widgetShouldUseCache()) {
54 54
             return ' &#013; Cache: is globally turned off (You should put "enable_cache" => true in config\widgetize.php) ';
55 55
         }
56 56
         $l = $this->widget->cacheLifeTime->i ?? 0;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     private function addHtmlComments(): void
62 62
     {
63
-        $this->html = "<!-- '{".get_class($this->widget)."' Widget Start -->".$this->html."<!-- '".get_class($this->widget)."' Widget End -->";
63
+        $this->html = "<!-- '{" . get_class($this->widget) . "' Widget Start -->" . $this->html . "<!-- '" . get_class($this->widget) . "' Widget End -->";
64 64
     }
65 65
 
66 66
     /**
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     private function getTplPath(string $tpl): string
71 71
     {
72 72
         if (str_contains($tpl, 'Widgets::')) {
73
-            $tpl = str_replace('Widgets::', app()->getNamespace().'Widgets\\', $tpl);
73
+            $tpl = str_replace('Widgets::', app()->getNamespace() . 'Widgets\\', $tpl);
74 74
         }
75 75
 
76
-        return str_replace('.', '\\', $tpl).'.blade.php';
76
+        return str_replace('.', '\\', $tpl) . '.blade.php';
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
src/Utils/Normalizers/CacheNormalizer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function normalize($widget): void
16 16
     {
17
-        if (! property_exists($widget, 'cacheLifeTime')) {
17
+        if (!property_exists($widget, 'cacheLifeTime')) {
18 18
             $M = config('widgetize.default_cache_lifetime', 0);
19 19
             $widget->cacheLifeTime = $this->makeFromSeconds($M * 60);
20 20
         }
@@ -37,6 +37,6 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function makeFromSeconds($s)
39 39
     {
40
-        return new \DateInterval('PT'.(string) ceil($s).'S');
40
+        return new \DateInterval('PT' . (string)ceil($s) . 'S');
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
src/Utils/Policies.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function widgetShouldHaveDebugInfo(): bool
13 13
     {
14
-        return config('widgetize.debug_info') && ! app()->environment('production');
14
+        return config('widgetize.debug_info') && !app()->environment('production');
15 15
     }
16 16
 
17 17
     /**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function widgetShouldUseCache(): bool
25 25
     {
26
-        return config('widgetize.enable_cache') && (! app()->environment('testing'));
26
+        return config('widgetize.enable_cache') && (!app()->environment('testing'));
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.