Completed
Branch master (b140cc)
by Alejandro
07:49
created
src/Template/Extension/UrlExtension.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 Acelaya\Website\Template\Extension;
5 5
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function register(Engine $engine)
23 23
     {
24
-        $engine->registerFunction('assemble_url', [$this->routeAssembler, 'assembleUrl']);
25
-        $engine->registerFunction('current_route', [$this, 'getCurrentRouteName']);
24
+        $engine->registerFunction('assemble_url', [ $this->routeAssembler, 'assembleUrl' ]);
25
+        $engine->registerFunction('current_route', [ $this, 'getCurrentRouteName' ]);
26 26
     }
27 27
 
28 28
     /**
Please login to merge, or discard this patch.
src/Template/Extension/NavigationExtension.php 1 patch
Spacing   +19 added lines, -19 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 Acelaya\Website\Template\Extension;
5 5
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function __construct(
27 27
         TranslatorInterface $translator,
28 28
         RouteAssemblerInterface $routeAssembler,
29
-        array $config = []
29
+        array $config = [ ]
30 30
     ) {
31 31
         $this->translator = $translator;
32 32
         $this->routeAssembler = $routeAssembler;
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function register(Engine $engine)
37 37
     {
38
-        $engine->registerFunction('render_menu', [$this, 'renderMenu']);
39
-        $engine->registerFunction('render_langs_menu', [$this, 'renderLanguagesMenu']);
40
-        $engine->registerFunction('render_social_menu', [$this, 'renderSocialMenu']);
38
+        $engine->registerFunction('render_menu', [ $this, 'renderMenu' ]);
39
+        $engine->registerFunction('render_langs_menu', [ $this, 'renderLanguagesMenu' ]);
40
+        $engine->registerFunction('render_social_menu', [ $this, 'renderSocialMenu' ]);
41 41
     }
42 42
 
43 43
     public function renderMenu($class = 'pull-left left-menu'): string
44 44
     {
45
-        $pages = isset($this->config['menu']) ? $this->config['menu'] : [];
46
-        $listElements = [];
45
+        $pages = isset($this->config[ 'menu' ]) ? $this->config[ 'menu' ] : [ ];
46
+        $listElements = [ ];
47 47
         $elementPattern = '<li class="%s"><a href="%s" %s>%s</a></li>';
48 48
         $currentRoute = $this->routeAssembler->getCurrentRouteResult();
49 49
 
50 50
         foreach ($pages as $page) {
51
-            $active = isset($page['route']) && $currentRoute->getMatchedRouteName() === $page['route'] ? 'active' : '';
52
-            $target = isset($page['target']) ? 'target="_blank"' : '';
53
-            $route = $page['uri'] ?? $this->routeAssembler->assembleUrl($page['route'], true);
51
+            $active = isset($page[ 'route' ]) && $currentRoute->getMatchedRouteName() === $page[ 'route' ] ? 'active' : '';
52
+            $target = isset($page[ 'target' ]) ? 'target="_blank"' : '';
53
+            $route = $page[ 'uri' ] ?? $this->routeAssembler->assembleUrl($page[ 'route' ], true);
54 54
 
55
-            $listElements[] = sprintf(
55
+            $listElements[ ] = sprintf(
56 56
                 $elementPattern,
57 57
                 $active,
58 58
                 $route,
59 59
                 $target,
60
-                $this->translator->translate($page['label'])
60
+                $this->translator->translate($page[ 'label' ])
61 61
             );
62 62
         }
63 63
 
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function renderLanguagesMenu(): string
68 68
     {
69
-        $pages = $this->config['lang_menu'] ?? [];
70
-        $listElements = [];
69
+        $pages = $this->config[ 'lang_menu' ] ?? [ ];
70
+        $listElements = [ ];
71 71
         $elementPattern = '<li><a href="%s">%s</a></li>';
72 72
         $pageResult = $this->routeAssembler->getCurrentRouteResult();
73 73
 
74 74
         foreach ($pages as $page) {
75 75
             // Inherit current route if it is not an error page
76 76
             $routeName = $pageResult->isSuccess() ? null : 'home';
77
-            $route = $this->routeAssembler->assembleUrl($routeName, $page['params']);
77
+            $route = $this->routeAssembler->assembleUrl($routeName, $page[ 'params' ]);
78 78
 
79
-            $listElements[] = sprintf($elementPattern, $route, $page['label']);
79
+            $listElements[ ] = sprintf($elementPattern, $route, $page[ 'label' ]);
80 80
         }
81 81
 
82 82
         return sprintf('<ul class="pull-right right-menu">%s</ul>', implode('', $listElements));
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 
85 85
     public function renderSocialMenu()
86 86
     {
87
-        $pages = $this->config['social_menu'] ?? [];
88
-        $listElements = [];
87
+        $pages = $this->config[ 'social_menu' ] ?? [ ];
88
+        $listElements = [ ];
89 89
         $elementPattern = '<li><a target="_blank" href="%s"><i class="%s"></i></a></li>';
90 90
 
91 91
         foreach ($pages as $page) {
92
-            $listElements[] = sprintf($elementPattern, $page['uri'], $page['icon']);
92
+            $listElements[ ] = sprintf($elementPattern, $page[ 'uri' ], $page[ 'icon' ]);
93 93
         }
94 94
 
95 95
         return sprintf('<ul class="fh5co-social">%s</ul>', implode('', $listElements));
Please login to merge, or discard this patch.
src/Template/Extension/TranslatorExtension.php 1 patch
Spacing   +4 added lines, -4 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 Acelaya\Website\Template\Extension;
5 5
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function register(Engine $engine)
23 23
     {
24
-        $engine->registerFunction('translate', [$this->translator, 'translate']);
25
-        $engine->registerFunction('translate_plural', [$this->translator, 'translatePlural']);
26
-        $engine->registerFunction('locale', [$this->translator, 'getLocale']);
24
+        $engine->registerFunction('translate', [ $this->translator, 'translate' ]);
25
+        $engine->registerFunction('translate_plural', [ $this->translator, 'translatePlural' ]);
26
+        $engine->registerFunction('locale', [ $this->translator, 'getLocale' ]);
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Middleware/CacheMiddleware.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 Acelaya\Website\Middleware;
5 5
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      * @param array $routeParams
73 73
      * @return bool
74 74
      */
75
-    protected function isResponseCacheable(Response $resp, array $routeParams = []): bool
75
+    protected function isResponseCacheable(Response $resp, array $routeParams = [ ]): bool
76 76
     {
77
-        $isCacheable = (bool) ($routeParams['cacheable'] ?? false);
77
+        $isCacheable = (bool) ($routeParams[ 'cacheable' ] ?? false);
78 78
         return $resp->getStatusCode() === self::STATUS_OK && $isCacheable;
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
src/Middleware/LanguageMiddleware.php 1 patch
Spacing   +4 added lines, -4 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 Acelaya\Website\Middleware;
5 5
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     private function matchLanguageFromPath(Request $request): string
53 53
     {
54 54
         $path = $request->getUri()->getPath();
55
-        $parts = array_filter(explode('/', $path), function (string $value) {
56
-            return ! empty($value);
55
+        $parts = array_filter(explode('/', $path), function(string $value) {
56
+            return !empty($value);
57 57
         });
58 58
         $langPart = strtolower(array_shift($parts) ?? '');
59 59
         return $langPart;
@@ -62,6 +62,6 @@  discard block
 block discarded – undo
62 62
     private function matchLanguageFromParams(RouteResult $routeResult): string
63 63
     {
64 64
         $params = $routeResult->getMatchedParams();
65
-        return $params['lang'] ?? 'en';
65
+        return $params[ 'lang' ] ?? 'en';
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
src/Feed/Service/BlogFeedConsumerInterface.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 Acelaya\Website\Feed\Service;
5 5
 
Please login to merge, or discard this patch.
src/Feed/Service/BlogFeedConsumer.php 1 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 Acelaya\Website\Feed\Service;
5 5
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $feed = $this->processFeed($feed);
44 44
 
45 45
         // If no feed has been cached yet, cache current one and return
46
-        if (! $this->feedCache->contains($cacheId)) {
46
+        if (!$this->feedCache->contains($cacheId)) {
47 47
             $this->viewsCache->deleteAll();
48 48
             $this->feedCache->save($cacheId, $feed);
49 49
             return $feed;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         // Check if the last feed has changed, otherwise, return
53 53
         $cachedFeed = $this->feedCache->fetch($cacheId);
54
-        if ($cachedFeed[0]['link'] === $feed[0]['link']) {
54
+        if ($cachedFeed[ 0 ][ 'link' ] === $feed[ 0 ][ 'link' ]) {
55 55
             return $feed;
56 56
         }
57 57
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function processFeed(FeedInterface $feed): array
69 69
     {
70
-        $data = [];
70
+        $data = [ ];
71 71
         $count = 0;
72 72
 
73 73
         /** @var FeedInterface $entry */
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 break;
77 77
             }
78 78
 
79
-            $data[] = [
79
+            $data[ ] = [
80 80
                 'title' => $entry->getTitle(),
81 81
                 'link' => $entry->getLink(),
82 82
             ];
Please login to merge, or discard this patch.
src/Feed/GuzzleClient.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 Acelaya\Website\Feed;
5 5
 
Please login to merge, or discard this patch.
src/Feed/BlogOptions.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 Acelaya\Website\Feed;
5 5
 
Please login to merge, or discard this patch.