Completed
Push — master ( 1dc414...34818f )
by Ivannis Suárez
05:25
created

FromQueryNamedResolver::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cubiche\Core\Cqrs\Middlewares\Handler\Resolver\NameOfQuery;
12
13
use Cubiche\Core\Bus\MessageInterface;
14
use Cubiche\Core\Bus\Middlewares\Handler\Resolver\NameOfMessage\FromMessageNamedResolver;
15
use Cubiche\Core\Cqrs\Query\QueryNamedInterface;
16
17
/**
18
 * FromQueryNamedResolver class.
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22 View Code Duplication
class FromQueryNamedResolver extends FromMessageNamedResolver
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: getName, getType
Loading history...
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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