openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

DslIf.class.php (747B)


      1 <?php
      2 
      3 namespace dsl\ast;
      4 
      5 class DslIf implements DslStatement
      6 {
      7 
      8 	/**
      9 	 * Expression for the condition
     10 	 * @var DslExpression
     11 	 */
     12 	private $condition;
     13 
     14 	/**
     15 	 * @var DslStatementList
     16 	 */
     17 	private $pos;
     18 
     19 	/**
     20 	 * @var DslStatementList
     21 	 */
     22 	private $neg;
     23 
     24 	public function execute( & $context ) {
     25 
     26 		$conditionValue = $this->condition->execute( $context );
     27 
     28 		if   ( $conditionValue )
     29 			return $this->pos->execute( $context );
     30 		else
     31 			return $this->neg->execute( $context );
     32 	}
     33 
     34 	public function __construct( $condition, $positive,$negative ) {
     35 		$this->condition = new DslExpression( $condition );
     36 		$this->pos = new DslStatementList( $positive );
     37 		$this->neg = new DslStatementList( $negative );
     38 	}
     39 
     40 	public function parse($tokens)
     41 	{
     42 	}
     43 }