We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
7 | abstract class AbstractResolver implements FluentResolverInterface |
||
8 | { |
||
9 | /** @var array */ |
||
10 | private $solutions = []; |
||
11 | |||
12 | private $aliases = []; |
||
13 | |||
14 | /** @var array */ |
||
15 | private $solutionOptions = []; |
||
16 | |||
17 | /** @var array */ |
||
18 | private $fullyLoadedSolutions = []; |
||
19 | |||
20 | /** @var bool */ |
||
21 | private $ignoreCase = true; |
||
22 | |||
23 | 116 | public function __construct() |
|
27 | |||
28 | 116 | public function addSolution($id, $solutionOrFactory, array $aliases = [], array $options = []) |
|
29 | { |
||
30 | 116 | $id = $this->cleanIdOrAlias($id); |
|
31 | 116 | $this->fullyLoadedSolutions[$id] = false; |
|
32 | 116 | $this->addAliases($id, $aliases); |
|
33 | |||
34 | $this->solutions[$id] = function () use ($id, $solutionOrFactory) { |
||
35 | 111 | $solution = $solutionOrFactory; |
|
36 | 111 | if (self::isSolutionFactory($solutionOrFactory)) { |
|
37 | 109 | if (!isset($solutionOrFactory[1])) { |
|
38 | $solutionOrFactory[1] = []; |
||
39 | } |
||
40 | 109 | $solution = \call_user_func_array(...$solutionOrFactory); |
|
41 | } |
||
42 | 110 | $this->checkSolution($id, $solution); |
|
43 | |||
44 | 108 | return $solution; |
|
45 | }; |
||
46 | 116 | $this->solutionOptions[$id] = $options; |
|
47 | |||
48 | 116 | return $this; |
|
49 | } |
||
50 | |||
51 | 114 | public function hasSolution($id) |
|
57 | |||
58 | /** |
||
59 | * @param $id |
||
60 | * |
||
61 | * @return mixed |
||
62 | */ |
||
63 | 109 | public function getSolution($id) |
|
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | 5 | public function getSolutions() |
|
75 | |||
76 | 5 | public function getSolutionAliases($id) |
|
80 | |||
81 | /** |
||
82 | * @param $id |
||
83 | * |
||
84 | * @return mixed |
||
85 | */ |
||
86 | 49 | public function getSolutionOptions($id) |
|
92 | |||
93 | /** |
||
94 | * @param string $id |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | 114 | private function loadSolution($id) |
|
115 | |||
116 | 116 | private function addAliases($id, $aliases) |
|
122 | |||
123 | 111 | private static function isSolutionFactory($solutionOrFactory) |
|
127 | |||
128 | 114 | private function resolveAlias($alias) |
|
134 | |||
135 | 116 | private function cleanIdOrAlias($idOrAlias) |
|
139 | |||
140 | /** |
||
141 | * @return mixed[] |
||
142 | */ |
||
143 | 5 | private function loadSolutions() |
|
151 | |||
152 | /** |
||
153 | * @param mixed $solution |
||
154 | * |
||
155 | * @return bool |
||
156 | */ |
||
157 | 110 | protected function supportsSolution($solution) |
|
163 | |||
164 | 110 | protected function checkSolution($id, $solution) |
|
172 | |||
173 | /** |
||
174 | * default return null to accept mixed type. |
||
175 | * |
||
176 | * @return null|string supported class name |
||
177 | */ |
||
178 | 53 | protected function supportedSolutionClass() |
|
182 | } |
||
183 |