Singleton   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 44
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setInstance() 0 3 1
A __construct() 0 3 1
A getConcrete() 0 3 1
A getInstance() 0 3 1
1
<?php
2
3
namespace MiladRahimi\PhpContainer\Types;
4
5
class Singleton
6
{
7
    /**
8
     * @var mixed
9
     */
10
    private $concrete;
11
12
    /**
13
     * Created instance of the concrete
14
     *
15
     * @var mixed
16
     */
17
    private $instance;
18
19
    /**
20
     * @param mixed $concrete
21
     */
22
    public function __construct($concrete)
23
    {
24
        $this->concrete = $concrete;
25
    }
26
27
    /**
28
     * @return mixed
29
     */
30
    public function getConcrete()
31
    {
32
        return $this->concrete;
33
    }
34
35
    /**
36
     * @return mixed
37
     */
38
    public function getInstance()
39
    {
40
        return $this->instance;
41
    }
42
43
    /**
44
     * @param mixed $instance
45
     */
46
    public function setInstance($instance): void
47
    {
48
        $this->instance = $instance;
49
    }
50
}
51