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_Helper_Data::setMockPhpIncludePath()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 11
nc 3
nop 1
1
<?php
2
3
/**
4
 * @category    Zookal_Mock
5
 * @package     Helper
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_Helper_Data extends Mage_Core_Helper_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
    /**
14
     * @var Mage_Core_Model_Store
15
     */
16
    protected $_store = null;
17
18
    /**
19
     * @var boolean
20
     */
21
    private $_includePathSet = null;
22
23
    /**
24
     * @param Mage_Core_Model_Store $store
25
     */
26
    public function __construct(Mage_Core_Model_Store $store = null)
27
    {
28
        $this->_store = $store;
29
    }
30
31
    /**
32
     * @return Mage_Core_Model_Store
33
     */
34
    public function getStore()
35
    {
36
        if (null === $this->_store) {
37
            $this->_store = Mage::app()->getStore();
38
        }
39
        return $this->_store;
40
    }
41
42
    /**
43
     * @return boolean
44
     */
45
    public function isLogMethodEnabled()
46
    {
47
        return (int)$this->getStore()->getConfig('dev/zookalmock/enable_method_log') === 1;
48
    }
49
50
    /**
51
     * Appends a new include path to the current existing one.
52
     * Appending is for performance reasons mandatory
53
     *
54
     * @param array $customFakePath
55
     *
56
     * @return bool
57
     */
58
    public function setMockPhpIncludePath(array $customFakePath = null)
59
    {
60
        if (null === $this->_includePathSet) {
61
            $currentIncludePath = get_include_path();
62
63
            $path = $this->_getCustomFakePath($customFakePath);
64
            if (strpos($currentIncludePath, $path) !== false) {
65
                $this->_includePathSet = false; // has already been set
66
                return $this->_includePathSet;
67
            }
68
            $this->_includePathSet = set_include_path(get_include_path() . PS . BP . DS . $path) !== false;
69
        } else {
70
            // every other call returns false as include path has already been set
71
            $this->_includePathSet = false;
72
        }
73
74
        return $this->_includePathSet;
75
    }
76
77
    /**
78
     * @param array $customFakePath
79
     *
80
     * @return string
81
     */
82
    protected function _getCustomFakePath(array $customFakePath = null)
83
    {
84
        $path = array(
85
            'app', 'code', 'community', 'Zookal', 'Mock', 'Model', 'Mocks'
86
        );
87
        if (null !== $customFakePath) {
88
            $path = $customFakePath;
89
        }
90
        return implode(DS, $path);
91
    }
92
}
93