SiteController   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A beforeFilter() 0 5 1
A home() 0 3 1
A contato() 0 3 1
A paginas() 0 3 1
A galeria() 0 3 1
A setLayout() 0 3 1
A getLayout() 0 3 1
1
<?php
2
3
class SiteController extends AppController {
4
5
	public function beforeFilter(){
0 ignored issues
show
Coding Style introduced by
beforeFilter uses the super-global variable $_SESSION which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
6
		$this->Session->write('Usuario', $_SESSION['information']);
7
8
		return true;
9
   	}
10
11
	public function home() {
12
		$this->layout = $this->getLayout();
13
	}
14
15
	public function contato() {
16
		$this->layout = $this->getLayout();
17
	}
18
	
19
	public function paginas() {
20
		$this->layout = $this->getLayout();
21
	}
22
23
	public function galeria() {
24
		$this->layout = $this->getLayout();
25
	}
26
27
	public function setLayout($playout) {
28
		$this->layout = $playout;
29
	}
30
31
	public function getLayout() {
32
		return $this->layout;
33
	}
34
35
}