1 | <?php |
||
5 | class FeatureManager |
||
6 | { |
||
7 | /** @var bool|null */ |
||
8 | protected static $masterSwitch = null; |
||
9 | |||
10 | /** |
||
11 | * Create a new FeatureManager Instance. |
||
12 | * |
||
13 | * @param array $features Features to load |
||
14 | * |
||
15 | * @return void |
||
|
|||
16 | */ |
||
17 | public function __construct(array $features = []) |
||
21 | |||
22 | /** |
||
23 | * Check if a feature is enabled. |
||
24 | * |
||
25 | * @param string $name Name of the feature to check |
||
26 | * @param string $function Check for a specific function |
||
27 | * |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function enabled(string $name, string $function = '') : bool |
||
44 | |||
45 | /** |
||
46 | * Get feature options. |
||
47 | * |
||
48 | * @param string $name Name of the feature to check |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function feature(string $name) |
||
56 | |||
57 | /** |
||
58 | * Set the master switch. |
||
59 | * |
||
60 | * @param bool $value Value to set the master switch to |
||
61 | * |
||
62 | * @return self |
||
63 | */ |
||
64 | public static function setMasterSwitch(bool $value) |
||
70 | } |
||
71 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.