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.

Nip_Service_Maps::setProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Nip Framework
5
 *
6
 * @category   Nip
7
 * @copyright  2009 Nip Framework
8
 * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
9
 */
10
11
class Nip_Service_Maps {
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...
12
13
    protected $_api_key;
14
    protected $_provider;
15
    protected $_providerObj;
16
17
    protected $_params = [];
18
    protected $_objects = [];
19
20
    public function  __construct() {        
21
    }
22
23
    public function  __call($name,  $arguments) {
24
        if (strpos($name, 'render') === 0) {
25
            return call_user_func_array(array($this->getProvider(), $name), $arguments);
26
        }
27
    }
28
29
    /**
30
     * @return Nip_Service_Maps_Provider_Abstract
31
     */
32
    public function getProvider()
33
    {
34
        if (!$this->_providerObj) {
35
            $this->initProvider();
36
        }
37
38
        return $this->_providerObj;
39
    }
40
41
    public function setProvider($name) {
42
        $this->_provider = $name;
43
        return $this;
44
    }
45
46
    public function initProvider() {
47
        if ($this->_provider) {
48
            $class = 'Nip_Service_Maps_Provider_' . ucfirst($this->_provider);
49
            $this->_providerObj = new $class();
50
            $this->_providerObj->setService($this);
51
            return true;
52
        }
53
        trigger_error('No provider set for ' . get_class($this));
54
    }
55
56
    public function getApiKey()
57
    {
58
        return $this->_api_key;
59
    }
60
61
    public function setApiKey($key)
62
    {
63
        $this->_api_key = $key;
64
65
        return $this;
66
    }
67
68
    public function addObject(Nip_Service_Maps_Objects_Abstract $object) {
69
        $this->_objects[] = $object;
70
        return $this;
71
    }
72
73
    public function getNewObject($name) {
74
        $name = 'Nip_Service_Maps_Objects_' . ucfirst($name);
75
        $object = new $name();
76
        $object->setService($this);
77
        return $object;
78
    }
79
80
    public function getObjects() {
81
        return $this->_objects;
82
    }
83
84
    public function setParam($key, $value) {
85
        $this->_params[$key] = $value;
86
        return $this;
87
    }
88
89
    public function getParam($key) {
90
        return $this->_params[$key];
91
    }
92
93
    public function render() {
94
        return $this->getProvider()->render();
95
    }
96
}
97