Code Duplication    Length = 18-18 lines in 2 locations

Middlewares/Handler/Resolver/NameOfCommand/FromCommandNamedResolver.php 1 location

@@ 22-39 (lines=18) @@
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class FromCommandNamedResolver extends FromMessageNamedResolver
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function resolve(MessageInterface $message)
28
    {
29
        if ($message instanceof CommandNamedInterface) {
30
            return $message->named();
31
        }
32
33
        throw new \InvalidArgumentException(sprintf(
34
            'The object of type %s should implement the %s interface',
35
            get_class($message),
36
            CommandNamedInterface::class
37
        ));
38
    }
39
}
40

Middlewares/Handler/Resolver/NameOfQuery/FromQueryNamedResolver.php 1 location

@@ 22-39 (lines=18) @@
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class FromQueryNamedResolver extends FromMessageNamedResolver
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function resolve(MessageInterface $message)
28
    {
29
        if ($message instanceof QueryNamedInterface) {
30
            return $message->named();
31
        }
32
33
        throw new \InvalidArgumentException(sprintf(
34
            'The object of type %s should implement the %s interface',
35
            get_class($message),
36
            QueryNamedInterface::class
37
        ));
38
    }
39
}
40