Passed
Push — master ( 56599f...3d1df1 )
by Tony Karavasilev (Тони
24:54 queued 10:00
created

AbstractSingleton::__clone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Abstraction for the singleton design pattern.
5
 */
6
7
namespace CryptoManana\Core\Abstractions\DesignPatterns;
8
9
use CryptoManana\Core\Interfaces\DesignPatterns\SingleInstancingInterface as SingleInstancing;
10
11
/**
12
 * Class AbstractSingleton - Abstraction for the singleton design pattern.
13
 *
14
 * @package CryptoManana\Core\Abstractions\DesignPatterns
15
 */
16
abstract class AbstractSingleton implements SingleInstancing
17
{
18
    /**
19
     * Locks the creation of new objects but allows static creation and extending.
20
     */
21 12
    protected function __construct()
22
    {
23
        /* This may remain empty. */
24 12
        return null;
25
    }
26
27
    /**
28
     * Lock the reinitialization and unserialization abilities of the class.
29
     */
30 12
    public function __wakeup()
31
    {
32
        /* This must remain empty. */
33 12
        return null;
34
    }
35
36
    /**
37
     * Lock the serialization abilities of the class.
38
     */
39 12
    public function __sleep()
40
    {
41
        /* This must remain empty. */
42 12
        return null;
43
    }
44
45
    /**
46
     * Lock the ability to clone properties and create a new dynamic instance of the class.
47
     */
48 12
    private function __clone()
49
    {
50
        /* This must remain empty. */
51 12
        return null;
52
    }
53
54
    /**
55
     * Return the name of the current defined class that extends the class.
56
     *
57
     * @return string Name of the class.
58
     */
59 12
    public function __toString()
60
    {
61 12
        return get_class($this);
62
    }
63
}
64