function merge(phpMorphy_Dict_GramTab_ConstStorage $other) { if (true !== ($error = $this->checkForIdIntersection($this->poses_map, $other->getPosesMap(), 'Part of speech'))) { throw new Exception($error); } if (true !== ($error = $this->checkForIdIntersection($this->grammems_map, $other->getGrammemsMap(), 'Grammem'))) { throw new Exception($error); } $this->poses_map = array_merge($this->poses_map, $other->getPosesMap()); $this->grammems_map = array_merge($this->grammems_map, $other->getGrammemsMap()); $this->meta_grammems_map = array_merge($this->meta_grammems_map, $other->getMetaGrammemsMap()); // reassign ids due to array_merge reorder numeric keys $this->poses_map = $this->assignKeysFromName($this->poses_map); $this->grammems_map = $this->assignKeysFromName($this->grammems_map); }
/** * @param phpMorphy_Dict_GramTab_ConstStorage $constsStorage * @param string $const * @param string $prefix * @return string */ private function constName(phpMorphy_Dict_GramTab_ConstStorage $constsStorage, $const, $prefix) { return 'PMY_' . $constsStorage->getLanguageShort() . "{$prefix}_" . $const; }