Completed
Push — master ( 89b65c...bde278 )
by Alexander
02:30
created

MethodArgument   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetch() 0 10 1
1
<?php
2
/**
3
 * PHP Deal framework
4
 *
5
 * @copyright Copyright 2014, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace PhpDeal\Contract\Fetcher;
12
13
use Go\Aop\Intercept\MethodInvocation;
14
15
class MethodArgument
16
{
17
    /**
18
     * Returns an associative list of arguments for the method invocation
19
     *
20
     * @param MethodInvocation $invocation
21
     * @return array
22
     */
23 34
    public function fetch(MethodInvocation $invocation)
24
    {
25 34
        $parameters = $invocation->getMethod()->getParameters();
26 34
        $argumentNames = array_map(function (\ReflectionParameter $parameter) {
27 33
            return $parameter->name;
28 34
        }, $parameters);
29 34
        $parameters = array_combine($argumentNames, $invocation->getArguments());
30
31 34
        return $parameters;
32
    }
33
}
34