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.

Zookal_Mock_Model_Mocks_Mage_Payment::_isAdmin()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
3
/**
4
 * @category    Zookal_Mock
5
 * @package     Model
6
 * @author      Cyrill Schumacher | {firstName}@{lastName}.fm | @SchumacherFM
7
 * @copyright   Copyright (c) Zookal Pty Ltd
8
 * @license     OSL - Open Software Licence 3.0 | http://opensource.org/licenses/osl-3.0.php
9
 */
10
class Zookal_Mock_Model_Mocks_Mage_Payment extends Zookal_Mock_Model_Mocks_Abstract
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
    /**
13
     * @var Mage_Core_Model_Store
14
     */
15
    protected $_store = null;
16
17
    public function __construct($helper = null, $store = null)
18
    {
19
        parent::__construct($helper);
20
        if (false === empty($store) && $store instanceof Mage_Core_Model_Store) {
0 ignored issues
show
Bug introduced by
The class Mage_Core_Model_Store does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
21
            $this->_store = $store;
22
        }
23
    }
24
25
    /**
26
     * @return Mage_Core_Model_Store
27
     */
28
    public function getStore()
29
    {
30
        if (null === $this->_store) {
31
            $this->_store = Mage::app()->getStore();
32
        }
33
        return $this->_store;
34
    }
35
36
    /**
37
     * @see Mage_Payment_Helper_Data
38
     * Retrieve block type for display method information
39
     * Only frontend layout generation checks if a block is an instance of Mage_Core_Block_Abstract
40
     * therefore we need to separate.
41
     *
42
     * @return string
43
     */
44
    public function getInfoBlockType()
45
    {
46
        return 'zookal_mock/payment_' . ($this->_isAdmin() ? 'backend' : 'frontend');
47
    }
48
49
    /**
50
     * @see Mage_Payment_Helper_Data
51
     *
52
     * Retreive payment method form html
53
     *
54
     * @return  Zookal_Mock_Block_Payment_Backend
55
     */
56
    public function getMethodFormBlock()
57
    {
58
        return new Zookal_Mock_Block_Payment_Backend();
59
    }
60
61
    /**
62
     * @see http://stackoverflow.com/questions/9693020/magento-request-frontend-or-backend thanks alan :-)
63
     * @return bool
64
     */
65
    protected function _isAdmin()
66
    {
67
        return ($this->getStore()->isAdmin() || Mage::getDesign()->getArea() === 'adminhtml');
68
    }
69
}
70