1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the O2System Framework package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @author Steeve Andrian Salim |
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------ |
13
|
|
|
|
14
|
|
|
namespace O2System\Framework\Http; |
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class Controller |
20
|
|
|
* |
21
|
|
|
* @package O2System\Framework\Http |
22
|
|
|
*/ |
23
|
|
|
class Controller extends \O2System\Kernel\Http\Controller |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Controller::$inherited |
27
|
|
|
* |
28
|
|
|
* Controller inherited flag. |
29
|
|
|
* |
30
|
|
|
* @var bool |
31
|
|
|
*/ |
32
|
|
|
static public $inherited = false; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Controller::__get |
36
|
|
|
* |
37
|
|
|
* Magic method __get. |
38
|
|
|
* |
39
|
|
|
* @param string $property |
40
|
|
|
* |
41
|
|
|
* @return mixed |
42
|
|
|
*/ |
43
|
|
|
public function &__get($property) |
44
|
|
|
{ |
45
|
|
|
$get[ $property ] = false; |
|
|
|
|
46
|
|
|
|
47
|
|
|
// CodeIgniter property aliasing |
48
|
|
|
if ($property === 'load') { |
49
|
|
|
$property = 'loader'; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
if (services()->has($property)) { |
53
|
|
|
$get[ $property ] = services()->get($property); |
54
|
|
|
} elseif (o2system()->__isset($property)) { |
55
|
|
|
$get[ $property ] = o2system()->__get($property); |
56
|
|
|
} elseif ($property === 'model') { |
57
|
|
|
$get[ $property ] = models('controller'); |
58
|
|
|
} elseif ($property === 'services' || $property === 'libraries') { |
59
|
|
|
$get[ $property ] = services(); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
return $get[ $property ]; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
// ------------------------------------------------------------------------ |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Controller::view |
69
|
|
|
* |
70
|
|
|
* @param string $file |
71
|
|
|
* @param array $vars |
72
|
|
|
*/ |
73
|
|
|
protected function view($file, array $vars = []) |
74
|
|
|
{ |
75
|
|
|
view($file, $vars); |
76
|
|
|
} |
77
|
|
|
} |