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.
Completed
Push — master ( 0268aa...3ec9bd )
by cao
05:24
created

ConsoleContainer   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 113
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 94.74%

Importance

Changes 0
Metric Value
dl 0
loc 113
ccs 36
cts 38
cp 0.9474
rs 10
c 0
b 0
f 0
wmc 16
lcom 2
cbo 2

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getClassName() 0 4 1
A getCommands() 0 4 1
A getCommand() 0 4 2
A getDescription() 0 4 1
A getSummary() 0 4 1
A setDescription() 0 4 1
A setSummary() 0 4 1
A setModuleName() 0 4 1
A addCommand() 0 4 1
A postCreate() 0 6 2
A getModuleName() 0 4 1
A getInstance() 0 7 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: caoyangmin
5
 * Date: 2018/6/14
6
 * Time: 下午2:10
7
 */
8
9
namespace PhpBoot\Console;
10
11
12
use DI\FactoryInterface;
13
14
class ConsoleContainer
15
{
16
    /**
17
     * @var string
18
     */
19
    private $className;
20
    /**
21
     * @var string
22
     */
23
    private $moduleName;
24
    /**
25
     * @var string
26
     */
27
    private $description;
28
    /**
29
     * @var string
30
     */
31
    private $summary;
32
    /**
33
     * @var Command[]
34
     */
35
    private $commands = [];
36
    /**
37
     * @var object
38
     */
39
    private $instance;
40
    /**
41
     * @var FactoryInterface
42
     */
43
    private $factory;
44
45 1
    public function __construct(FactoryInterface $factory, $className)
46
    {
47 1
        $this->factory = $factory;
48 1
        $this->className = $className;
49 1
    }
50
51 1
    public function getClassName()
52
    {
53 1
        return $this->className;
54
    }
55
56
    /**
57
     * @return Command[]
58
     */
59 1
    public function getCommands()
60
    {
61 1
        return $this->commands;
62
    }
63
64 1
    public function getCommand($target)
65
    {
66 1
        return isset($this->commands[$target])?$this->commands[$target]:null;
67
    }
68
    /**
69
     * @return string
70
     */
71
    public function getDescription()
72
    {
73
        return $this->description;
74
    }
75
76
    /**
77
     * @return string
78
     */
79 1
    public function getSummary()
80
    {
81 1
        return $this->summary;
82
    }
83
84 1
    public function setDescription($description)
85
    {
86 1
        $this->description = $description;
87 1
    }
88
89 1
    public function setSummary($summary)
90
    {
91 1
        $this->summary = $summary;
92 1
    }
93
94 1
    public function setModuleName($name)
95
    {
96 1
        $this->moduleName = $name;
97 1
    }
98
99 1
    public function addCommand($target, Command $command)
100
    {
101 1
        $this->commands[$target] = $command;
102 1
    }
103 1
    public function postCreate()
104
    {
105 1
        foreach ($this->commands as $command){
106 1
            $command->postCreate($this);
107 1
        }
108 1
    }
109 1
    public function getModuleName()
110
    {
111 1
        return $this->moduleName;
112
    }
113
114
    /**
115
     * @return mixed|object
116
     * @throws \DI\DependencyException
117
     * @throws \DI\NotFoundException
118
     */
119 1
    public function getInstance()
120
    {
121 1
        if(!$this->instance ){
122 1
            $this->instance  = $this->factory->make($this->getClassName());
123 1
        }
124 1
        return $this->instance;
125
    }
126
}