Completed
Push — master ( c00c2f...af7e7e )
by Dave
8s
created

Method   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 73.32%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 11
cts 15
cp 0.7332
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __call() 0 4 1
A getParameters() 0 6 1
A getReturnType() 0 13 4
1
<?php
2
3
namespace Mockery\Generator;
4
5
class Method
6
{
7
    private $method;
8
9 128
    public function __construct(\ReflectionMethod $method)
10
    {
11 128
        $this->method = $method;
12 128
    }
13
14 128
    public function __call($method, $args)
15
    {
16 128
        return call_user_func_array(array($this->method, $method), $args);
17
    }
18
19
    public function getParameters()
20
    {
21 111
        return array_map(function ($parameter) {
22 54
            return new Parameter($parameter);
23 111
        }, $this->method->getParameters());
24
    }
25
26 106
    public function getReturnType()
27
    {
28 106
        if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 && $this->method->hasReturnType()) {
29
            $returnType = (string) $this->method->getReturnType();
30
31
            if ('self' === $returnType) {
32
                return "\\".$this->method->getDeclaringClass()->getName();
33
            }
34
35
            return $returnType;
36
        }
37 106
        return '';
38
    }
39
}
40