| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 23 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 30 | public function resolve(Command $command) | ||
| 31 |     { | ||
| 32 | $command = get_class($command); | ||
| 33 | $name = substr($command, strrpos($command, '\\') + 1); | ||
| 34 | $namespace = substr($command, 0, strrpos($command, '\\')); | ||
| 35 | |||
| 36 |         $handler = "{$command}Handler"; | ||
| 37 |         if (class_exists($handler)) { | ||
| 38 | return $this->container->make($handler); | ||
| 39 | } | ||
| 40 | |||
| 41 |         $handler = "$namespace\\Handlers\\{$name}Handler"; | ||
| 42 |         if (class_exists($handler)) { | ||
| 43 | return $this->container->make($handler); | ||
| 44 | } | ||
| 45 | |||
| 46 |         $handler = "$namespace\\Handler\\{$name}Handler"; | ||
| 47 |         if (class_exists($handler)) { | ||
| 48 | return $this->container->make($handler); | ||
| 49 | } | ||
| 50 | |||
| 51 |         throw new UnresolvableHandlerException("Unable to resolve handler for $command"); | ||
| 52 | } | ||
| 53 | } | ||
| 54 |