Example #1
0
 /**
  * @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;
 }
Example #2
0
 /**
  * @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;
 }
Example #3
0
 /**
  * @param RunkitConstant $item
  *
  * @return mixed
  */
 protected function addInternal($item)
 {
     return Factory::getExecutor()->addConstant($item->getName(), $item->getValue());
 }