Completed
Branch erdiko2 (81b309)
by John
02:13
created

Controller   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A redirect() 0 5 1
1
<?php
2
/**
3
 * Controller
4
 * Base request handler, All controllers should be a child this class
5
 * or one of the subclasses (e.g. controllers/Ajax or controllers/Api)
6
 *
7
 * @package     erdiko
8
 * @copyright   2012-2017 Arroyo Labs, Inc. http://www.arroyolabs.com
9
 * @author      John Arroyo <[email protected]>
10
 */
11
namespace erdiko;
12
13
use Interop\Container\ContainerInterface;
14
15
16
class Controller
17
{
18
    protected $container;
19
   
20
    public function __construct(ContainerInterface $container) 
21
    {
22
        $this->container = $container;
23
    }
24
25
    /**
26
     * Redirect to another url
27
     * @param string $url
28
     */
29
    public function redirect($url)
30
    {
31
        header("Location: $url");
32
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method redirect() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
33
    }
34
}