GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c3368f...693668 )
by Scott van
10:56
created

EbayEnterprise_GiftCard_CartController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B addAction() 0 24 3
A removeAction() 0 13 1
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
class EbayEnterprise_GiftCard_CartController extends EbayEnterprise_GiftCard_Controller_Abstract
17
{
18
    //** @see EbayEnterprise_GiftCard_Controller_Abstract */
19
    const REDIRECT_PATH = 'checkout/cart/';
20
21
    /**
22
     * add a giftcard to the cart.
23
     */
24
    public function addAction()
25
    {
26
        list($cardNumber, $pin) = $this->_getCardInfoFromRequest();
27
28
        if ($cardNumber) {
29
30
            $container = $this->_getContainer();
31
            // try a balance request.
32
            $giftcard = $container->getGiftCard($cardNumber)->setPin($pin);
33
34
            try {
35
36
                $this->_helper->addGiftCardToOrder($giftcard, $container);
37
                $this->_getCheckoutSession()
38
                    ->addSuccess($this->_helper->__(EbayEnterprise_GiftCard_Helper_Data::GIFT_CARD_ADD_SUCCESS, $giftcard->getCardNumber()));
39
40
            } catch (EbayEnterprise_GiftCard_Exception $e) {
41
42
                $this->_getCheckoutSession()->addError($this->_helper->__($e->getMessage()));
43
44
            }
45
        }
46
        $this->_redirect(static::REDIRECT_PATH);
47
    }
48
49
    /**
50
     * remove a giftcard from the cart.
51
     */
52
    public function removeAction()
53
    {
54
        list($cardNumber) = $this->_getCardInfoFromRequest();
55
56
        $giftcard = $this->_getContainer()->getGiftCard($cardNumber);
57
58
        $this->_getContainer()->removeGiftCard($giftcard);
59
60
        $this->_getCheckoutSession()
61
            ->addSuccess($this->_helper->__(EbayEnterprise_GiftCard_Helper_Data::GIFT_CARD_REMOVE_SUCCESS, $giftcard->getCardNumber()));
62
63
        $this->_redirect(static::REDIRECT_PATH);
64
    }
65
}
66