Ejemplo n.º 1
0
 /**
  * Check Object acceptance
  *
  * Check if given Controller is acceptable in Controllers Chain
  * To be valid, the Controller must implement Next\Controller\Controller Interface
  *
  * @param Next\Components\Object $object
  *   An Object object
  *
  *   The checking for Next\Controller\Controller Interface will be inside
  *   the method.
  *
  * @return boolean
  *   TRUE if given Object is acceptable by Controllers Collection and FALSE otherwise
  *
  * @throws Next\Controller\ControllerException
  *   Given application is not acceptable in the Controller Chain
  */
 public function accept(Object $object)
 {
     if (!$object instanceof Controller) {
         throw ControllerException::invalidController($object);
     }
     return TRUE;
 }
Ejemplo n.º 2
0
 /**
  * Unset a Template Variable
  *
  * Allows to unset a Template Variable from Controller context,
  * instead of using:
  *
  * <code>
  *   $this -> view -> remove( 'variable' );
  *
  *   // OR
  *
  *   unset( $this -> view -> variable );
  * </code>
  *
  * This method is slightly different of others. While __get() and __isset()
  * work over the HTTP GET Params (a.k.a Dynamic Params) this one works over
  * Template Variables
  *
  * @param string $param
  *   Desired Template Variable
  *
  * @throws Next\Controller\ControllerException
  *   Trying to unset an forbidden Template Variable,
  *   always prefixed with an unserscore.
  *
  * @throws Next\Controller\ControllerException
  *   Trying to unset a nonexistent Template Variable
  */
 public function __unset($param)
 {
     try {
         unset($this->view->{$param});
     } catch (ViewException $e) {
         // Standardizing Exception
         throw ControllerException::removalFailure($e);
     }
 }