| Conditions | 5 | 
| Paths | 5 | 
| Total Lines | 27 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 22 | public function createInjection(ReflectionClass $class, string $context = null): QueueInterface  | 
            ||
| 23 |     { | 
            ||
| 24 | // Get Queue by context  | 
            ||
| 25 |         if ($context === null) { | 
            ||
| 26 | $connection = $this->queueManager->getConnection();  | 
            ||
| 27 |         } else { | 
            ||
| 28 |             try { | 
            ||
| 29 | $connection = $this->queueManager->getConnection($context);  | 
            ||
| 30 |             } catch (InvalidArgumentException $e) { | 
            ||
| 31 | // Case when context doesn't match to configured connections  | 
            ||
| 32 | return $this->queueManager->getConnection();  | 
            ||
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 | // User specified a specific class type  | 
            ||
| 37 | $className = $class->getName();  | 
            ||
| 38 |         if ($className !== QueueInterface::class && !$connection instanceof $className) { | 
            ||
| 39 | throw new \RuntimeException(  | 
            ||
| 40 | \sprintf(  | 
            ||
| 41 | "The queue obtained by the context `%s` doesn't match the type `%s`.",  | 
            ||
| 42 | $context,  | 
            ||
| 43 | $className  | 
            ||
| 44 | )  | 
            ||
| 45 | );  | 
            ||
| 46 | }  | 
            ||
| 47 | |||
| 48 | return $connection;  | 
            ||
| 49 | }  | 
            ||
| 51 |