/** * @param RunkitFunction $item * * @return bool */ protected function addInternal($item) { return Factory::getExecutor()->addFunction($item->getName(), $item->getArguments(), $item->getCode()); }
/** * @param string $name * * @throws \RuntimeException * * @return boolean */ public function rename($name) { if ($this->getName() == $name) { return true; } if (property_exists($this->getClass(), $name)) { throw new \RuntimeException('Property ' . $name . ' already defined in ' . $this->getClass()); } if (Factory::getExecutor()->renameProperty($this, $name)) { $this->name = $name; return true; } return false; }
public function testGetExecutor() { $executor = Factory::getExecutor(); $this->assertInstanceOf('Runkit\\Executor', $executor); }
/** * @param string $name * * @throws \RuntimeException * * @return boolean */ public function rename($name) { if (defined($name)) { throw new \RuntimeException('Constant with name ' . $name . ' already defined'); } if ($this->getName() == $name) { return true; } if (Factory::getExecutor()->renameConstant($this, $name)) { $this->name = $name; return true; } return false; }
/** * @param Runkit $item * * @return boolean */ protected function removeInternal($item) { return Factory::getExecutor()->removeConstant($item->getName()); }
/** * Remove function from scope * * @return boolean */ public function remove() { $name = $this->getName(); return function_exists($name) ? Factory::getExecutor()->removeFunction($name) : true; }
/** * @param RunkitMethod $item * * @return mixed */ protected function addInternal($item) { return Factory::getExecutor()->addMethod($item); }
/** * @param RunkitProperty $item * * @return mixed */ protected function addInternal($item) { return Factory::getExecutor()->addProperty($item); }
/** * @param string $name * * @throws \RuntimeException * * @return boolean */ public function rename($name) { if (method_exists($this->getClass(), $this->getName())) { if (method_exists($this->getClass(), $name)) { throw new \RuntimeException('Method with name ' . $name . ' already exists in class ' . $this->getClass()); } if (Factory::getExecutor()->renameMethod($this->getClass(), $this->getName(), $name)) { $this->name = $name; return true; } } return false; }