1 | <?php |
||
12 | class GenericStrategyBasedFactory |
||
13 | { |
||
14 | /** |
||
15 | * @var StrategyResolver |
||
16 | */ |
||
17 | private $strategyResolver; |
||
18 | |||
19 | /** |
||
20 | * Initiates a new AbstractStrategyBasedFactory. |
||
21 | * |
||
22 | * @param StrategyResolver $strategyResolver |
||
23 | */ |
||
24 | 7 | public function __construct(StrategyResolver $strategyResolver) |
|
28 | |||
29 | /** |
||
30 | * Makes the given class with config utilizing the resolved strategy based on class. |
||
31 | * |
||
32 | * @param string $className |
||
33 | * @param array $config |
||
34 | * |
||
35 | * @see StrategyResolver::resolve() |
||
36 | * |
||
37 | * @return mixed |
||
38 | * @throws InvalidConfigException |
||
39 | */ |
||
40 | 7 | public function makeWithStrategy( |
|
55 | |||
56 | /** |
||
57 | * Validates the given config against the given strategy. |
||
58 | * |
||
59 | * @param CreationStrategyInterface $strategy |
||
60 | * @param string $className |
||
61 | * @param array $config |
||
62 | * |
||
63 | * @throws InvalidConfigException |
||
64 | */ |
||
65 | 7 | private function validateConfigParameters( |
|
81 | |||
82 | /** |
||
83 | * @param HandlerInterface|FormatterInterface|callable $configuredInstance |
||
84 | * @param string $className |
||
85 | * |
||
86 | * @throws InvalidConfigException |
||
87 | */ |
||
88 | 6 | private function validateConfiguredInstance($configuredInstance, string $className) |
|
108 | } |
||
109 |