Passed
Pull Request — master (#41)
by Dmitrii
15:49
created

HelloSprykerRouteProviderPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addHelloSprykerIndexRoute() 0 6 1
A addRoutes() 0 5 1
1
<?php
2
3
namespace Pyz\Yves\HelloSpryker\Plugin\Router;
4
5
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin;
6
use Spryker\Yves\Router\Route\RouteCollection;
7
8
class HelloSprykerRouteProviderPlugin extends AbstractRouteProviderPlugin
9
{
10
    protected const ROUTE_HELLO_SPRYKER_INDEX = 'hello-spryker-index';
11
12
    /**
13
     * Specification:
14
     * - Adds Routes to the RouteCollection.
15
     *
16
     * @api
17
     *
18
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
19
     *
20
     * @return \Spryker\Yves\Router\Route\RouteCollection
21
     */
22
    public function addRoutes(RouteCollection $routeCollection): RouteCollection
23
    {
24
        $routeCollection = $this->addHelloSprykerIndexRoute($routeCollection);
25
26
        return $routeCollection;
27
    }
28
29
    /**
30
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
31
     *
32
     * @return \Spryker\Yves\Router\Route\RouteCollection
33
     */
34
    protected function addHelloSprykerIndexRoute(RouteCollection $routeCollection): RouteCollection
35
    {
36
        $route = $this->buildRoute('/hello-spryker', 'HelloSpryker', 'Index', 'indexAction');
37
        $routeCollection->add(static::ROUTE_HELLO_SPRYKER_INDEX, $route);
38
39
        return $routeCollection;
40
    }
41
}
42