ExampleProductSaleRouteProviderPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 28
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A addRoutes() 0 9 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace Pyz\Yves\ExampleProductSalePage\Plugin\Router;
11
12
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin;
13
use Spryker\Yves\Router\Route\RouteCollection;
14
15
class ExampleProductSaleRouteProviderPlugin extends AbstractRouteProviderPlugin
16
{
17
    /**
18
     * @deprecated Use {@link \Pyz\Yves\ExampleProductSalePage\Plugin\Router\ExampleProductSaleRouteProviderPlugin::ROUTE_NAME_SALE} instead.
19
     *
20
     * @var string
21
     */
22
    public const ROUTE_SALE = 'sale';
23
24
    /**
25
     * @var string
26
     */
27
    public const ROUTE_NAME_SALE = 'sale';
28
29
    /**
30
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
31
     *
32
     * @return \Spryker\Yves\Router\Route\RouteCollection
33
     */
34
    public function addRoutes(RouteCollection $routeCollection): RouteCollection
35
    {
36
        $route = $this->buildRoute('/outlet{categoryPath}', 'ExampleProductSalePage', 'Sale', 'indexAction');
37
        $route = $route->setRequirement('categoryPath', '\/.+');
38
        $route = $route->setDefault('categoryPath', null);
39
40
        $routeCollection->add(static::ROUTE_NAME_SALE, $route);
41
42
        return $routeCollection;
43
    }
44
}
45