1 | <?php |
||
17 | class CallbackVariant implements VariantInterface |
||
18 | { |
||
19 | /** |
||
20 | * The identifier of this variant. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $identifier; |
||
25 | |||
26 | /** |
||
27 | * The callback that should be invoked when this variant is ran. |
||
28 | * |
||
29 | * @var callable |
||
30 | */ |
||
31 | private $callback; |
||
32 | |||
33 | /** |
||
34 | * Initializes a new instance of this class. |
||
35 | * |
||
36 | * @param string $identifier The Identifier of the Variant |
||
37 | * @param callable $callback The Callable to execute on run |
||
38 | */ |
||
39 | 4 | public function __construct($identifier, callable $callback) |
|
44 | |||
45 | /** |
||
46 | * {@inheritDoc} |
||
47 | */ |
||
48 | 1 | public function getIdentifier() |
|
52 | |||
53 | /** |
||
54 | * {@inheritDoc} |
||
55 | */ |
||
56 | 3 | public function run() |
|
60 | } |
||
61 |