Atriedes /
feature
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Feature; |
||
| 4 | |||
| 5 | use Feature\Contracts\User; |
||
| 6 | use Feature\Contracts\World; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class Feature |
||
| 10 | * @package Feature |
||
| 11 | */ |
||
| 12 | final class Feature |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var self |
||
| 16 | */ |
||
| 17 | private static $instance; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var World |
||
| 21 | */ |
||
| 22 | private $world; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | private $stanza; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | private static $config = []; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param World $world |
||
| 36 | * @param array $stanza |
||
| 37 | */ |
||
| 38 | private function __construct(World $world, array $stanza) |
||
| 39 | { |
||
| 40 | $this->world = $world; |
||
| 41 | $this->stanza = $stanza; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param World $world |
||
| 46 | * @param array $stanza |
||
| 47 | * @return Feature |
||
| 48 | */ |
||
| 49 | public static function create(World $world, array $stanza) |
||
| 50 | { |
||
| 51 | if (static::$instance) { |
||
|
0 ignored issues
–
show
|
|||
| 52 | return static::$instance; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 53 | } |
||
| 54 | |||
| 55 | static::$instance = new static($world, $stanza); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 56 | |||
| 57 | return static::$instance; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param $feature |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | public static function isEnabled($feature) |
||
| 65 | { |
||
| 66 | return static::createConfig($feature)->isEnabled(); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param $feature |
||
| 71 | * @param User $user |
||
| 72 | * @return bool |
||
| 73 | */ |
||
| 74 | public static function isEnabledFor($feature, User $user) |
||
| 75 | { |
||
| 76 | return static::createConfig($feature)->isEnabledFor($user); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param $feature |
||
| 81 | * @param $bucketId |
||
| 82 | * @return bool |
||
| 83 | */ |
||
| 84 | public static function isEnabledBucketingBy($feature, $bucketId) |
||
| 85 | { |
||
| 86 | return static::createConfig($feature)->isEnabledBucketingBy($bucketId); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @param $feature |
||
| 91 | * @return string |
||
| 92 | */ |
||
| 93 | public static function variant($feature) |
||
| 94 | { |
||
| 95 | return static::createConfig($feature)->variant(); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @param $feature |
||
| 100 | * @param User $user |
||
| 101 | * @return string |
||
| 102 | */ |
||
| 103 | public static function variantFor($feature, User $user) |
||
| 104 | { |
||
| 105 | return static::createConfig($feature)->variantFor($user); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @param $feature |
||
| 110 | * @param $bucketId |
||
| 111 | * @return string |
||
| 112 | */ |
||
| 113 | public static function variantBucketingBy($feature, $bucketId) |
||
| 114 | { |
||
| 115 | return static::createConfig($feature)->variantBucketingBy($bucketId); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @param $feature |
||
| 120 | * @return mixed|null |
||
| 121 | */ |
||
| 122 | public static function description($feature) |
||
| 123 | { |
||
| 124 | return static::createConfig($feature)->description(); |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 125 | } |
||
| 126 | |||
| 127 | /** |
||
| 128 | * clear config |
||
| 129 | */ |
||
| 130 | public static function clear() |
||
| 131 | { |
||
| 132 | static::$config = []; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 133 | static::$instance = null; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 134 | } |
||
| 135 | |||
| 136 | /** |
||
| 137 | * @param $feature |
||
| 138 | * @return Config |
||
| 139 | */ |
||
| 140 | private static function createConfig($feature) |
||
| 141 | { |
||
| 142 | if (array_key_exists($feature, static::$config)) { |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 143 | return static::$config[$feature]; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 144 | } |
||
| 145 | |||
| 146 | static::$config[$feature] = new Config( |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 147 | $feature, |
||
| 148 | static::$instance->stanza[$feature], |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 149 | static::$instance->world |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 150 | ); |
||
| 151 | |||
| 152 | return static::$config[$feature]; |
||
|
0 ignored issues
–
show
Since
Feature\Feature is declared final, using late-static binding will have no effect. You might want to replace static with self instead.
Late static binding only has effect in subclasses.
A To learn more about late static binding, please refer to the PHP core documentation. Loading history...
|
|||
| 153 | } |
||
| 154 | } |
||
| 155 |
Late static binding only has effect in subclasses. A
finalclass cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::withself::.To learn more about late static binding, please refer to the PHP core documentation.