Ejemplo n.º 1
0
 /**
  * Get a variable (second argument can be a default value)
  *
  * @param string $name The variable name
  *
  * @return mixed
  */
 public function &offsetGet($name)
 {
     if ($this->tasksInvalid && in_array($name, array('packages', 'rootPackage'), true)) {
         $this->tasksInvalid = false;
         $packages = $this->getPackages();
         parent::offsetSet('packages', $packages);
         parent::offsetSet('rootPackage', reset($packages));
     }
     return parent::offsetGet($name);
 }
Ejemplo n.º 2
0
 /**
  * Configure options and arguments
  *
  * @param string $name  The name
  * @param mixed  $value The value
  *
  * @return void
  */
 public function offsetSet($name, $value)
 {
     if ($name === 'options' || $name === 'arguments') {
         $type = substr($name, 0, -1);
         if (!is_array($value)) {
             throw new Exception($name . ' must be array');
         }
         foreach ($value as $variable => $config) {
             $from = $this->camelCaseToLowerCaseDashed($variable);
             $this->definitions[$from] = array('context' => $this, 'variable' => $variable, 'type' => $type, 'config' => $config);
         }
         return;
     }
     parent::offsetSet($name, $value);
 }