Completed
Push — master ( ffc46f...f233a4 )
by
unknown
20s queued 13s
created

OrderCustomReferenceWidgetRouteProviderPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addOrderCustomReferenceSaveRoute() 0 11 1
A addRoutes() 0 5 1
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerShop\Yves\OrderCustomReferenceWidget\Plugin\Router;
9
10
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin;
11
use Spryker\Yves\Router\Route\RouteCollection;
12
13
class OrderCustomReferenceWidgetRouteProviderPlugin extends AbstractRouteProviderPlugin
14
{
15
    protected const ROUTE_ORDER_CUSTOM_REFERENCE_SAVE = 'order-custom-reference/save';
16
17
    /**
18
     * {@inheritDoc}
19
     * - Adds order custom reference save action to RouteCollection.
20
     *
21
     * @api
22
     *
23
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
24
     *
25
     * @return \Spryker\Yves\Router\Route\RouteCollection
26
     */
27
    public function addRoutes(RouteCollection $routeCollection): RouteCollection
28
    {
29
        $routeCollection = $this->addOrderCustomReferenceSaveRoute($routeCollection);
30
31
        return $routeCollection;
32
    }
33
34
    /**
35
     * @uses \SprykerShop\Yves\OrderCustomReferenceWidget\Controller\OrderCustomReferenceController::saveAction()
36
     *
37
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
38
     *
39
     * @return \Spryker\Yves\Router\Route\RouteCollection
40
     */
41
    protected function addOrderCustomReferenceSaveRoute(RouteCollection $routeCollection): RouteCollection
42
    {
43
        $route = $this->buildRoute(
44
            '/order-custom-reference/save',
45
            'OrderCustomReferenceWidget',
46
            'OrderCustomReference',
47
            'saveAction'
48
        );
49
        $routeCollection->add(static::ROUTE_ORDER_CUSTOM_REFERENCE_SAVE, $route);
50
51
        return $routeCollection;
52
    }
53
}
54