Completed
Push — master ( 7db57b...89e945 )
by Nikolas
04:32
created

GenericMethodAction::caption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace rtens\domin\reflection;
3
4
use rtens\domin\reflection\types\TypeFactory;
5
6
class GenericMethodAction extends MethodAction {
7
8
    /** @var GenericAction */
9
    private $generic;
10
11
    /**
12
     * @param object $object
13
     * @param string $method
14
     * @param TypeFactory $types
15
     * @param CommentParser $parser
16
     */
17 View Code Duplication
    public function __construct($object, $method, TypeFactory $types, CommentParser $parser) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
        parent::__construct($object, $method, $types, $parser);
19
        $this->generic = new GenericAction($this);
20
        $this->generic
21
            ->setCaption(parent::caption())
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (caption() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->caption().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
22
            ->setDescription(parent::description())
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (description() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->description().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
23
            ->setParameters(parent::parameters())
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (parameters() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->parameters().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
24
            ->setExecute(function ($parameters) {
25
                return parent::execute($parameters);
26
            })
27
            ->setFill(function ($parameters) {
28
                return $parameters;
29
            });
30
    }
31
32
    public function generic() {
33
        return $this->generic;
34
    }
35
36
    public function execute(array $parameters) {
37
        return $this->generic->execute($parameters);
38
    }
39
40
    public function caption() {
41
        return $this->generic->caption();
42
    }
43
44
    public function description() {
45
        return $this->generic->description();
46
    }
47
48
    public function fill(array $parameters) {
49
        return $this->generic->fill(parent::fill($parameters));
50
    }
51
52
    public function parameters() {
53
        return $this->generic->parameters();
54
    }
55
}