model; } /** * Get view * * In most of the cases, the view will be set as per routes in defined in routes.php. * So if you are not sure which view class is currently being used, search for the * current controller class name in the routes.php * * @return object * @since 3.0.0 */ protected function get_view() { return $this->view; } /** * Sets the model to be used * * @param Model $model Model object to be associated with the current controller object. * @return void * @since 3.0.0 */ protected function set_model( Model $model ) { $this->model = $model; } /** * Sets the view to be used * * @param View $view View object to be associated with the current controller object. * @return void * @since 3.0.0 */ protected function set_view( View $view ) { $this->view = $view; } /** * Constructor * * @param Model $model Model object to be used with current controller object. * @param mixed $view View object to be used with current controller object. Otherwise false. */ protected function __construct( Model $model, $view = false ) { $this->init( $model, $view ); } /** * Sets Model & View to be used with current controller * * @param Model $model Model to be associated with this controller. * @param mixed $view Either View/its child class object or False. * @return void */ final protected function init( Model $model, $view = false ) { $this->set_model( $model ); if ( false === $view ) { $view = new View(); } $this->set_view( $view ); } } }