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 | 117 | public function __construct() |
|
| 27 | |||
| 28 | 117 | public function addSolution($id, $solutionOrFactory, array $aliases = [], array $options = []) |
|
| 29 | { |
||
| 30 | 117 | $id = $this->cleanIdOrAlias($id); |
|
| 31 | 117 | $this->fullyLoadedSolutions[$id] = false; |
|
| 32 | 117 | $this->addAliases($id, $aliases); |
|
| 33 | |||
| 34 | $this->solutions[$id] = function () use ($id, $solutionOrFactory) { |
||
| 35 | 112 | $solution = $solutionOrFactory; |
|
| 36 | 112 | if (self::isSolutionFactory($solutionOrFactory)) { |
|
| 37 | 110 | if (!isset($solutionOrFactory[1])) { |
|
| 38 | $solutionOrFactory[1] = []; |
||
| 39 | } |
||
| 40 | 110 | $solution = \call_user_func_array(...$solutionOrFactory); |
|
| 41 | } |
||
| 42 | 111 | $this->checkSolution($id, $solution); |
|
| 43 | |||
| 44 | 109 | return $solution; |
|
| 45 | }; |
||
| 46 | 117 | $this->solutionOptions[$id] = $options; |
|
| 47 | |||
| 48 | 117 | return $this; |
|
| 49 | } |
||
| 50 | |||
| 51 | 115 | public function hasSolution($id) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @param $id |
||
| 60 | * |
||
| 61 | * @return mixed |
||
| 62 | */ |
||
| 63 | 110 | 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 | 115 | private function loadSolution($id) |
|
| 115 | |||
| 116 | 117 | private function addAliases($id, $aliases) |
|
| 122 | |||
| 123 | 112 | private static function isSolutionFactory($solutionOrFactory) |
|
| 127 | |||
| 128 | 115 | private function resolveAlias($alias) |
|
| 134 | |||
| 135 | 117 | 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 | 111 | protected function supportsSolution($solution) |
|
| 163 | |||
| 164 | 111 | 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 |