CreateTypeRequest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 9 1
A getType() 0 4 1
A setType() 0 4 1
A setParameter() 0 4 1
A getEndpoint() 0 4 1
A createResponse() 0 4 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