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

MethodArgument::fetch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
crap 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