/** * Constructor * * @param array $params optional * @param bool $autoRender optional */ public function __construct( $params = null, $autoRender = true ) { if ($params !== null) { $this->params = $params; } foreach ( (array) $this->params as $pname => $data ) { $tmp = explode( ':', $data ); if (count( $tmp ) !== 2) { throw new Exception( 'Invalid params array' ); } switch ($tmp[0]) { case 'POST': $this->{$pname} = isset( $_POST[$tmp[1]] ) ? $_POST[$tmp[1]] : null; break; case 'GET': $this->{$pname} = isset( $_GET[$tmp[1]] ) ? $_GET[$tmp[1]] : null; break; default: throw new Exception( "Invalid method for variable retrieval '{$tmp[0]}'" ); } } $this->app = SASUA_Canteens::instance(); if ($autoRender) { $this->render(); } } // __construct }}}