CallableRunner   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 6 1
1
<?php
2
3
namespace ArgumentResolver;
4
5
class CallableRunner
6
{
7
    /**
8
     * @var ArgumentResolver
9
     */
10
    private $argumentResolver;
11
12
    public function __construct(ArgumentResolver $argumentResolver)
13
    {
14
        $this->argumentResolver = $argumentResolver;
15
    }
16
17
    /**
18
     * Run the given callable with arguments from the available ones.
19
     *
20
     * @param callable $callable
21
     * @param array    $availableArguments
22
     *
23
     * @return mixed
24
     */
25
    public function run(callable $callable, array $availableArguments)
26
    {
27
        $arguments = $this->argumentResolver->resolveArguments($callable, $availableArguments);
28
29
        return call_user_func_array($callable, $arguments);
30
    }
31
}
32