/
Controller.php
51 lines (43 loc) · 950 Bytes
/
Controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Controller class - Controller.php file
*
* @author Dmitriy Tyurin <fobia3d@gmail.com>
* @copyright Copyright (c) 2014 Dmitriy Tyurin
*/
namespace Fobia\Base;
/**
* Controller class
*
* @package Fobia.Base
*/
class Controller
{
/**
* @var \Fobia\Base\Application
*/
public $app;
public $params = array();
public function __construct(Application $app, $params = array())
{
$this->app = $app;
$this->params = $params;
}
public function section($section = null)
{
if ($section === null || !method_exists($this, $section) ) {
$this->app->notFound();
}
$args = func_get_args();
array_shift($args);
dispatchMethod($this, $section, $args);
}
public function index()
{
$this->app->notFound();
}
public function errorAction()
{
$this->app->error();
}
}