| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 22 | public function resolveFromString(string $input): Builder |
||
| 23 | { |
||
| 24 | |||
| 25 | if (!preg_match('/^(?<service>[a-z0-9A-Z_\\\\]+)@(?<method>[a-z0-9A-Z_-]+)$/', $input, $matches)) { |
||
| 26 | throw new BadConfigurationException('"' . $input . '" is not in the format <service>@<method>'); |
||
| 27 | } |
||
| 28 | $service = $this->container->get($matches['service']); |
||
| 29 | $method = $matches['method']; |
||
| 30 | if (!is_callable([$service, $method])) { |
||
| 31 | throw new BadConfigurationException('"' . $method . '" is not callable in service "' . $matches['service'] . '"'); |
||
| 32 | } |
||
| 33 | |||
| 34 | $result = $service->$method(); |
||
| 35 | if (!($result instanceof Builder)) { |
||
| 36 | throw new InvalidClassTypeException('queryBuilder', Builder::class); |
||
| 37 | } |
||
| 38 | return $result; |
||
| 39 | } |
||
| 41 |