1 | <?php |
||
5 | abstract class AbstractController |
||
6 | { |
||
7 | /** |
||
8 | * An associative array holding the model to be used by this controller |
||
9 | * @var array |
||
10 | */ |
||
11 | protected $model; |
||
12 | |||
13 | /** |
||
14 | * Constructor |
||
15 | * |
||
16 | * @param array $model |
||
17 | */ |
||
18 | public function __construct( array $model = array() ) |
||
22 | |||
23 | /** |
||
24 | * Get model argument value by name. |
||
25 | * |
||
26 | * @param string $name The argument's name. |
||
27 | * |
||
28 | * @return mixed the argument's value. |
||
29 | */ |
||
30 | public function __get( $name ) |
||
37 | |||
38 | /** |
||
39 | * Set model argument by name. |
||
40 | * |
||
41 | * @param string $name The argument's name. |
||
42 | * @param mixed $value The value to set. |
||
43 | * |
||
44 | * @return mixed the settings' argument value. |
||
45 | */ |
||
46 | public function __set( $name, $value ) |
||
50 | |||
51 | /** |
||
52 | * Get the current component model data. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | public function get_model() |
||
60 | |||
61 | /** |
||
62 | * Set the model data for this component. |
||
63 | * |
||
64 | * @return array |
||
65 | */ |
||
66 | public function set_model( $model ) |
||
70 | |||
71 | /** |
||
72 | * Get the full path to the template file. |
||
73 | * |
||
74 | * @return string The full path. |
||
75 | */ |
||
76 | abstract function get_template_path(); |
||
77 | |||
78 | /** |
||
79 | * Render the template with the local properties. |
||
80 | * |
||
81 | * @return string The rendered template. |
||
82 | * @throws TemplateNotFoundException Thrown if the template file cannot be found. |
||
83 | */ |
||
84 | public function render( $echo = false ){ |
||
105 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.