/** * @param RunkitFunction|RunkitFunction|RunkitConstant $item * * @throws \RuntimeException * * @return boolean */ public function add($item) { if ($item->getType() == $this->getCollectionType() && $this->checkObjectInstance($item)) { if ($this->addInternal($item)) { $this->items[$item->getName()] = $item; return true; } } return false; }
/** * @param RunkitConstant $constant * @param string $newName * * @return boolean */ public function renameConstant(\Runkit\RunkitConstant $constant, $newName) { if ($constant->remove()) { return $this->addConstant($newName, $constant->getValue()); } return false; }
/** * @param RunkitConstant $item * * @return mixed */ protected function addInternal($item) { return Factory::getExecutor()->addConstant($item->getName(), $item->getValue()); }