CreateTypeRequest::setType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace Omnipay\Heidelpay\Message;
5
6
class CreateTypeRequest extends AbstractRequest
7
{
8
    /**
9
     * @return array|mixed
10
     */
11
    public function getData()
12
    {
13
        $this->validate('type');
14
15
        $parameters = parent::getParameters();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getParameters() instead of getData()). Are you sure this is correct? If so, you might want to change this to $this->getParameters().

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...
16
        unset($parameters['type']);
17
18
        return $parameters;
19
    }
20
21
    /**
22
     * @return string
23
     */
24
    public function getType()
25
    {
26
        return $this->getParameter('type');
27
    }
28
29
    /**
30
     * @param $value
31
     * @return CreateTypeRequest
32
     */
33
    public function setType($value)
34
    {
35
        return $this->setParameter('type', $value);
36
    }
37
38
    public function setParameter($key, $value)
39
    {
40
        return parent::setParameter($key, $value);
41
    }
42
43
44
    /**
45
     * @return string
46
     */
47
    public function getEndpoint()
48
    {
49
        return parent::getEndpoint() . 'types/' . $this->getType();
50
    }
51
52
    protected function createResponse($data)
53
    {
54
        return $this->response = new CreateTypeResponse($this, $data);
55
    }
56
}
57