/** * @param int $bytes * @param bool $signed * @param int $endian * @return int */ public function readInt($bytes = 1, $signed = false, $endian = null) { if ($bytes > 8) { throw new \LengthException("Can't read integer larger 64 bit."); } if ($bytes > 4 && !$this->can64()) { throw new \LengthException('Your system not support 64 bit integers.'); } if ($endian === null) { $endian = $this->getEndian(); } $fullBytes = $this->getFullSize($bytes); $data = $this->fitTo($this->read($bytes), $fullBytes, $endian); return Packer::unpack(Packer::getFormat('int', $fullBytes * 8, $signed, $endian), $data); }
/** * Размещение пакета * * @throws Exception if one of deploy task throws an exception */ function deploy() { // распаковть в buildpad $bp = PackageManager::getBuildpadDir()->getDir($this->name . '_' . $this->version); PackageManager::getRollback()->push('delete', $bp); Packer::unpack($this->file, $bp); // Вырезать нужный кусок их Package.xml $rp = new DOMXPath($this->xml); $nodes = $rp->query('//deploy'); if ($nodes->length == 0) { return io::out('Nothing to deploy') | 0; } $tasks = $nodes->item(0)->childNodes; // создать deployer $d = new Deployer($bp); $d->setTaskList($tasks); $d->executeTasks(); // удалить директорию в билдпаде $bp->delete(); }