function __construct(phpMorphy_Storage_StorageInterface $ancodesMap) { if (false === ($this->ancodes_map = unserialize($ancodesMap->read(0, $ancodesMap->getFileSize())))) { throw new phpMorphy_Exception("Can`t open phpMorphy => Dialing ancodes map"); } $this->reverse_map = array_flip($this->ancodes_map); }
/** * @throws phpMorphy_Exception * @param phpMorphy_Storage_StorageInterface $storage * */ protected function __construct(phpMorphy_Storage_StorageInterface $storage) { $this->data = unserialize($storage->read(0, $storage->getFileSize())); if (false === $this->data) { throw new phpMorphy_Exception("Broken gramtab data"); } $this->grammems = $this->data['grammems']; $this->poses = $this->data['poses']; $this->ancodes = $this->data['ancodes']; }
/** * Returns size of file in bytes * @abstract * @return int */ public function getFileSize() { $result = $this->object->getFileSize(); return $result === $this->object ? $this : $result; }