Completed
Push — master ( 5e4c69...6bf127 )
by Tom
02:18
created

ServiceDefinition::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace TomPHP\ConfigServiceProvider;
4
5
final class ServiceDefinition
6
{
7
    /**
8
     * @var string
9
     */
10
    private $name;
11
12
    /**
13
     * @var string
14
     */
15
    private $class;
16
17
    /**
18
     * @var bool
19
     */
20
    private $singleton;
21
22
    /**
23
     * @var array
24
     */
25
    private $arguments;
26
27
    /**
28
     * @var array
29
     */
30
    private $methods;
31
32
    /**
33
     * @param string $name
34
     * @param array $config
35
     */
36
    public function __construct($name, array $config)
37
    {
38
        $this->name      = $name;
39
        $this->class     = isset($config['class']) ? $config['class'] : $name;
40
        $this->singleton = isset($config['singleton']) ? $config['singleton'] : false;
41
        $this->arguments = isset($config['arguments']) ? $config['arguments'] : [];
42
        $this->methods   = isset($config['methods']) ? $config['methods'] : [];
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getName()
49
    {
50
        return $this->name;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getClass()
57
    {
58
        return $this->class;
59
    }
60
61
    /**
62
     * @return boolean
63
     */
64
    public function isSingleton()
65
    {
66
        return $this->singleton;
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getArguments()
73
    {
74
        return $this->arguments;
75
    }
76
77
    /**
78
     * @return array
79
     */
80
    public function getMethods()
81
    {
82
        return $this->methods;
83
    }
84
}
85