Completed
Push — master ( 009e6e...8f3b04 )
by Mikael
03:35
created

ResponseUtility   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 32
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 4 1
A redirectSelf() 0 5 1
1
<?php
2
3
namespace Anax\Response;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
/**
9
 * Handling a response and includes utilitie methods.
10
 */
11
class ResponseUtility extends Response implements
12
    ContainerInjectableInterface
13
{
14
    use ContainerInjectableTrait;
15
16
17
18
    /**
19
     * Redirect to another page and creating an url from the argument.
20
     *
21
     * @param string $url to redirect to
22
     *
23
     * @return void
24
     */
25
    public function redirect($url)
26
    {
27
        parent::redirect($this->di->get("url")->create($url));
28
    }
29
30
31
32
    /**
33
     * Redirect to current page.
34
     *
35
     * @return void
36
     */
37
    public function redirectSelf()
38
    {
39
        $url = $this->di->get("request")->getCurrentUrl();
40
        parent::redirect($this->di->get("url")->create($url));
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (redirect() instead of redirectSelf()). Are you sure this is correct? If so, you might want to change this to $this->redirect().

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...
41
    }
42
}
43