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.

Component::config()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 2
1
<?php
2
3
/**
4
 * The component class.
5
 *
6
 * The base class for Auth, Security classes.
7
 * It provides reusable controller logic.
8
 * The extending classes can be used as part of the controller.
9
 *
10
 * @license    http://opensource.org/licenses/MIT The MIT License (MIT)
11
 * @author     Omar El Gabry <[email protected]>
12
 */
13
 class Component{
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...
14
15
     /**
16
      * controller
17
      *
18
      * @var Controller
19
      */
20
     protected $controller;
21
22
     /**
23
      * request
24
      *
25
      * @var Request
26
      */
27
     protected $request;
28
29
     /**
30
      * Default configurations data
31
      *
32
      * @var array
33
      */
34
     protected $config = [];
35
36
37
     /**
38
      * Constructor
39
      *
40
      * @param Controller $controller
41
      * @param array      $config user-provided config
42
      */
43
    public function __construct(Controller $controller, array $config = []){
44
        $this->controller = $controller;
45
        $this->request    = $controller->request;
46
        $this->config     = array_merge($this->config, $config);
47
    }
48
49
     /**
50
      * set and get configurations data
51
      *
52
      * @param  string $key
53
      * @param  mixed  $value
54
      * @return mixed
55
      */
56
     public function config($key, $value = null){
57
58
         // set
59
         if($value !== null){
60
             $this->config = array_merge($this->config, [$key => $value]);
61
             return $this;
62
         }
63
64
         // get
65
         return array_key_exists($key, $this->config)? $this->config[$key]: null;
66
     }
67
68
}
69