DslVariable.class.php (458B)
1 <?php 2 3 namespace dsl\ast; 4 5 use dsl\DslRuntimeException; 6 7 class DslVariable implements DslStatement 8 { 9 public $name; 10 11 /** 12 * @param $name 13 */ 14 public function __construct($name) 15 { 16 $this->name = $name; 17 } 18 19 20 public function execute( & $context ) { 21 22 if ( ! array_key_exists( $this->name, $context ) ) 23 throw new DslRuntimeException('\''.$this->name.'\' does not exist'); 24 25 return $context[ $this->name ]; 26 } 27 28 public function parse($tokens) 29 { 30 } 31 }