Total Complexity | 3 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php namespace Chekote\NounStore; |
||
6 | trait Singleton |
||
7 | { |
||
8 | /** @var self */ |
||
9 | protected static $instance; |
||
10 | |||
11 | /** |
||
12 | * Singleton constructor. |
||
13 | * |
||
14 | * Exists purely to restrict visibility. |
||
15 | * |
||
16 | * @codeCoverageIgnore |
||
17 | */ |
||
18 | protected function __construct() |
||
19 | { |
||
20 | // do nothing |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Provides access to one (and only one) instance of this class. |
||
25 | * |
||
26 | * Subsequent calls to this method will return the same instance. |
||
27 | * |
||
28 | * @return self |
||
29 | */ |
||
30 | 2 | public static function getInstance() |
|
37 | } |
||
38 | } |
||
39 |