PaypalExpressControllerProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 20
c 3
b 0
f 0
dl 0
loc 52
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addPaypalExpressAddShipmentRoute() 0 11 1
A defineControllers() 0 6 1
A addPaypalExpressSuccessResponseRoute() 0 11 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Braintree\Plugin\Provider;
9
10
use Silex\Application;
11
use SprykerShop\Yves\ShopApplication\Plugin\Provider\AbstractYvesControllerProvider;
12
13
class PaypalExpressControllerProvider extends AbstractYvesControllerProvider
0 ignored issues
show
Deprecated Code introduced by
The class SprykerShop\Yves\ShopApp...tYvesControllerProvider has been deprecated: Use {@link \Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

13
class PaypalExpressControllerProvider extends /** @scrutinizer ignore-deprecated */ AbstractYvesControllerProvider
Loading history...
14
{
15
    public const ROUTE_PAYPAL_EXPRESS_SUCCESS_RESPONSE = 'paypal-express-success';
16
    public const ROUTE_PAYPAL_EXPRESS_SHIPMENT_ADD = 'paypal-express-shipment-add';
17
18
    /**
19
     * @param \Silex\Application $app
20
     *
21
     * @return $this
22
     */
23
    protected function defineControllers(Application $app)
24
    {
25
        $this->addPaypalExpressSuccessResponseRoute();
26
        $this->addPaypalExpressAddShipmentRoute();
27
28
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type SprykerEco\Yves\Braintre...pressControllerProvider which is incompatible with the return type mandated by Spryker\Yves\Application...er::defineControllers() of void.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
29
    }
30
31
    /**
32
     * @uses \SprykerEco\Yves\Braintree\Controller\PaypalExpressController::successAction()
33
     *
34
     * @return $this
35
     */
36
    protected function addPaypalExpressSuccessResponseRoute()
37
    {
38
        $this->createController(
39
            '/paypal-express/payment/success',
40
            static::ROUTE_PAYPAL_EXPRESS_SUCCESS_RESPONSE,
41
            'Braintree',
42
            'PaypalExpress',
43
            'success'
44
        );
45
46
        return $this;
47
    }
48
49
    /**
50
     * @uses \SprykerEco\Yves\Braintree\Controller\PaypalExpressController::successAction()
51
     *
52
     * @return $this
53
     */
54
    protected function addPaypalExpressAddShipmentRoute()
55
    {
56
        $this->createPostController(
57
            '/paypal-express/shipment/add',
58
            static::ROUTE_PAYPAL_EXPRESS_SHIPMENT_ADD,
59
            'Braintree',
60
            'PaypalExpress',
61
            'addShipment'
62
        );
63
64
        return $this;
65
    }
66
}
67