| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class ValuelistService |
||
| 14 | { |
||
| 15 | private static $instance; |
||
| 16 | /** |
||
| 17 | * @var Storage |
||
| 18 | */ |
||
| 19 | protected $storage; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * FileService constructor. |
||
| 23 | */ |
||
| 24 | protected function __construct() |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return ValuelistService |
||
| 30 | */ |
||
| 31 | public static function getInstance() |
||
| 32 | { |
||
| 33 | if (!self::$instance instanceof ValuelistService) { |
||
| 34 | self::$instance = new ValuelistService(); |
||
| 35 | } |
||
| 36 | return self::$instance; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param $slug |
||
| 41 | * @return Valuelist |
||
| 42 | */ |
||
| 43 | public static function get($slug) |
||
| 44 | { |
||
| 45 | $instance = self::getInstance(); |
||
| 46 | $valuelist = $instance->storage->getValuelists()->getValuelistBySlug($slug); |
||
| 47 | return $valuelist === null ? new Valuelist(new \stdClass()) : new Valuelist($valuelist); |
||
| 48 | |||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param Storage $storage |
||
| 53 | */ |
||
| 54 | public function init(Storage $storage) |
||
| 57 | } |
||
| 58 | } |