Esempio n. 1
0
 protected function fetch()
 {
     $varName = $this->name->toString();
     if ($this->class) {
         if ($this->class->isString()) {
             $ci = $this->executor->getClassStore()->get($this->class->getValue());
         } else {
             if ($this->class->isObject()) {
                 $ci = $this->class->getValue()->getClassEntry();
             } else {
                 throw new \RuntimeException('Class name must be a valid object or a string');
             }
         }
         $this->zval = $ci->fetchStaticVariable($varName);
     } else {
         if (self::SCOPE_GLOBAL === $this->scope) {
             $symbolTable = $this->executor->executorGlobals->symbolTable;
             if (!isset($symbolTable[$varName])) {
                 $this->zval = Zval::ptrFactory();
             } else {
                 $this->zval = $symbolTable[$varName];
             }
         } else {
             if ($varName == 'this') {
                 $this->zval = Zval::lockedPtrFactory($this->executor->getCurrent()->ci);
             } else {
                 $this->zval = $this->executor->getCurrent()->fetchVariable($varName);
             }
         }
     }
 }