Example #1
0
 public function getCell($value)
 {
     $cell = $value;
     if (is_string($value) && substr(trim($value), 0, 1) == '=') {
         $expression = substr(trim($value), 1);
         $cell = $this->evaluate($expression, array('self' => $this, 'parent' => $this->getParent(), 'root' => $this->getRoot()), $this);
     }
     if (is_array($value)) {
         $cell = \Nucleus\Factory::instanceCell($value);
         $cell->setParent($this)->setRoot($this->getRoot());
     }
     return $cell;
 }
Example #2
0
 public function vmResolve($word, $payload = null)
 {
     if (isset($this->_env[$word])) {
         return [$this->_env[$word]];
     }
     if ($word === '$') {
         return [$payload];
     }
     if ($word === '$self') {
         return [$this];
     }
     if (preg_match("/^([a-zA-Z_\$][a-zA-Z_\$0-9]*):\$/", $word, $m)) {
         return ['vmAddSymbol', $m[1]];
     }
     switch (substr($word, 0, 1)) {
         case '`':
             return [trim($word, '` ')];
         case '"':
             return [substr($word, 1, -1)];
         case '[':
             $block = substr($word, 1, -1);
             return [$this->vmEval($block, $payload)];
         case '@':
             $classname = substr(trim($word), 1);
             $value = \Nucleus\Factory::instanceCell($classname);
             return [$value];
         case '(':
             $block = substr(trim($word), 1, -1);
             return [$this->vmEval("[vmArray {$block}]", $payload)];
         case '{':
             $block = substr(trim($word), 1, -1);
             return [$this->vmEval("[vmHash {$block}]", $payload)];
     }
     return [$word];
 }
Example #3
0
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     return \Nucleus\Factory::instanceCell($requestedName);
 }