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   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 86
ccs 0
cts 43
cp 0
rs 10
c 0
b 0
f 0
wmc 16
lcom 3
cbo 1

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A __call() 0 5 2
A getProvider() 0 8 2
A setProvider() 0 4 1
A initProvider() 0 9 2
A getApiKey() 0 4 1
A setApiKey() 0 6 1
A addObject() 0 4 1
A getNewObject() 0 6 1
A getObjects() 0 3 1
A setParam() 0 4 1
A getParam() 0 3 1
A render() 0 3 1
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