| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 36 | public function findConsignmentService(ManufacturerInterface $manufacturer): ConsignmentServiceInterface |
||
| 37 | { |
||
| 38 | $name = preg_replace('/[^a-zA-Z0-9 ]+/i', ' ', $manufacturer->getName()); |
||
| 39 | $name = Container::camelize($name).'ConsignmentService'; |
||
| 40 | |||
| 41 | if (!isset($this->consignmentServices[$name])) { |
||
| 42 | throw new NonExistentConsignmentServiceException('Consignment service `'.$name.'` not found. Did you mean any of these? '.join(', ', array_keys($this->consignmentServices))); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** @var ConsignmentServiceInterface $service */ |
||
| 46 | $service = $this->consignmentServices[$name]; |
||
| 47 | $service->setManufacturer($manufacturer); |
||
| 48 | |||
| 49 | return $service; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |