ExampleProductSaleRouteProviderPlugin::addRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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