We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
5 | abstract class AbstractResolver implements FluentResolverInterface |
||
6 | { |
||
7 | /** @var array */ |
||
8 | private $solutions = []; |
||
9 | |||
10 | /** @var array */ |
||
11 | private $solutionOptions = []; |
||
12 | |||
13 | /** @var array */ |
||
14 | private $fullyLoadedSolutions = []; |
||
15 | |||
16 | 96 | public function addSolution($name, callable $solutionFunc, array $solutionFuncArgs = [], array $options = []) |
|
17 | { |
||
18 | 96 | $this->fullyLoadedSolutions[$name] = false; |
|
19 | 91 | $this->solutions[$name] = function () use ($name, $solutionFunc, $solutionFuncArgs) { |
|
20 | 91 | $solution = call_user_func_array($solutionFunc, $solutionFuncArgs); |
|
21 | 89 | $this->checkSolution($name, $solution); |
|
22 | |||
23 | 88 | return $solution; |
|
24 | }; |
||
25 | 96 | $this->solutionOptions[$name] = $options; |
|
26 | |||
27 | 96 | return $this; |
|
28 | } |
||
29 | |||
30 | 94 | public function hasSolution($name) |
|
34 | |||
35 | /** |
||
36 | * @param $name |
||
37 | * |
||
38 | * @return mixed |
||
39 | */ |
||
40 | 89 | public function getSolution($name) |
|
41 | { |
||
42 | 89 | return $this->loadSolution($name); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | 74 | public function getSolutions() |
|
52 | |||
53 | /** |
||
54 | * @param $name |
||
55 | * |
||
56 | * @return mixed |
||
57 | */ |
||
58 | 44 | public function getSolutionOptions($name) |
|
62 | |||
63 | /** |
||
64 | * @param string $name |
||
65 | * |
||
66 | * @return mixed |
||
67 | */ |
||
68 | 94 | private function loadSolution($name) |
|
84 | |||
85 | /** |
||
86 | * @return mixed[] |
||
87 | */ |
||
88 | 74 | private function loadSolutions() |
|
96 | |||
97 | /** |
||
98 | * @param mixed $solution |
||
99 | * |
||
100 | * @return bool |
||
101 | */ |
||
102 | 89 | protected function supportsSolution($solution) |
|
108 | |||
109 | 89 | protected function checkSolution($name, $solution) |
|
117 | |||
118 | /** |
||
119 | * default return null to accept mixed type. |
||
120 | * |
||
121 | * @return null|string supported class name |
||
122 | */ |
||
123 | 43 | protected function supportedSolutionClass() |
|
127 | } |
||
128 |