SiteController::home()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
}