AnnotatedCommandHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Governor\Framework\CommandHandling\Handlers;
10
11
use Governor\Framework\CommandHandling\CommandMessageInterface;
12
use Governor\Framework\UnitOfWork\UnitOfWorkInterface;
13
use Governor\Framework\Common\ParameterResolverFactoryInterface;
14
15
/**
16
 * Description of GenericCommandHandler
17
 *
18
 * @author david
19
 */
20
class AnnotatedCommandHandler extends AbstractAnnotatedCommandHandler
21
{
22
23
    /**
24
     * @var mixed
25
     */
26
    private $target;
27
28 4
    public function __construct($className, $methodName,
29
            ParameterResolverFactoryInterface $parameterResolver, $target)
30
    {
31 4
        parent::__construct(get_class($target), $methodName, $parameterResolver);
32 4
        $this->target = $target;
33 4
    }
34
35 3
    public function handle(CommandMessageInterface $commandMessage,
36
            UnitOfWorkInterface $unitOfWork)
37
    {
38 3
        $arguments = $this->resolveArguments($commandMessage);
39
40 3
        return $this->getMethod()->invokeArgs($this->target, $arguments);
41
    }
42
43
}
44