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