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 ResolverInterface |
||
| 6 | { |
||
| 7 | /** @var array */ |
||
| 8 | private $solutions = []; |
||
| 9 | |||
| 10 | /** @var array */ |
||
| 11 | private $solutionOptions = []; |
||
| 12 | |||
| 13 | /** @var array */ |
||
| 14 | private $fullyLoadedSolutions = []; |
||
| 15 | |||
| 16 | 86 | public function addSolution($name, callable $solutionFunc, array $solutionFuncArgs = [], array $options = []) |
|
| 17 | { |
||
| 18 | 86 | $this->fullyLoadedSolutions[$name] = false; |
|
| 19 | 81 | $this->solutions[$name] = function () use ($name, $solutionFunc, $solutionFuncArgs) { |
|
| 20 | 81 | $solution = call_user_func_array($solutionFunc, $solutionFuncArgs); |
|
| 21 | 80 | $this->checkSolution($name, $solution); |
|
| 22 | |||
| 23 | 79 | return $solution; |
|
| 24 | }; |
||
| 25 | 86 | $this->solutionOptions[$name] = $options; |
|
| 26 | |||
| 27 | 86 | return $this; |
|
| 28 | } |
||
| 29 | |||
| 30 | 84 | public function hasSolution($name) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @param $name |
||
| 37 | * |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | 79 | public function getSolution($name) |
|
| 41 | { |
||
| 42 | 79 | return $this->loadSolution($name); |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | 68 | 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 | 84 | private function loadSolution($name) |
|
| 85 | |||
| 86 | /** |
||
| 87 | * @return mixed[] |
||
| 88 | */ |
||
| 89 | 68 | private function loadSolutions() |
|
| 97 | |||
| 98 | /** |
||
| 99 | * @param mixed $solution |
||
| 100 | */ |
||
| 101 | 43 | protected function postLoadSolution($solution) |
|
| 104 | |||
| 105 | /** |
||
| 106 | * @param mixed $solution |
||
| 107 | * |
||
| 108 | * @return bool |
||
| 109 | */ |
||
| 110 | 80 | protected function supportsSolution($solution) |
|
| 116 | |||
| 117 | 80 | protected function checkSolution($name, $solution) |
|
| 125 | |||
| 126 | /** |
||
| 127 | * default return null to accept mixed type. |
||
| 128 | * |
||
| 129 | * @return null|string supported class name |
||
| 130 | */ |
||
| 131 | 43 | protected function supportedSolutionClass() |
|
| 135 | } |
||
| 136 |