|
@@ 32-47 (lines=16) @@
|
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
public function getDefinitionByType(string $type) : ServiceDefinition |
| 33 |
|
{ |
| 34 |
|
$this->containerBuilder->prepareClassList(); |
| 35 |
|
|
| 36 |
|
if ($name = $this->containerBuilder->getByType($type)) { |
| 37 |
|
return $this->containerBuilder->getDefinition($name); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
foreach ($this->containerBuilder->findByType($type) as $definition) { |
| 41 |
|
return $definition; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
throw new DefinitionForTypeNotFoundException( |
| 45 |
|
sprintf('Definition for type "%s" was not found.', $type) |
| 46 |
|
); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
public function getServiceNameByType(string $type) : string |
|
@@ 50-65 (lines=16) @@
|
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
public function getServiceNameByType(string $type) : string |
| 51 |
|
{ |
| 52 |
|
$this->containerBuilder->prepareClassList(); |
| 53 |
|
|
| 54 |
|
if ($name = $this->containerBuilder->getByType($type)) { |
| 55 |
|
return $name; |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
foreach ($this->containerBuilder->findByType($type) as $name => $definition) { |
| 59 |
|
return $name; |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
throw new DefinitionForTypeNotFoundException( |
| 63 |
|
sprintf('Definition for type "%s" was not found.', $type) |
| 64 |
|
); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
} |
| 68 |
|
|