getEntries(); if (!empty($zipEntries)) { foreach ($zipEntries as $zipEntry) { $zipEntry->removeExtraField(self::HEADER_ID); } // set jar execute bit reset($zipEntries); $zipEntry = current($zipEntries); $zipEntry->getCdExtraFields()[] = new self(); } } /** * Returns the Header ID (type) of this Extra Field. * The Header ID is an unsigned short integer (two bytes) * which must be constant during the life cycle of this object. * * @return int */ public function getHeaderId() { return self::HEADER_ID; } /** * The actual data to put into local file data - without Header-ID * or length specifier. * * @return string the data */ public function packLocalFileData() { return ''; } /** * The actual data to put into central directory - without Header-ID or * length specifier. * * @return string the data */ public function packCentralDirData() { return ''; } /** * Populate data from this array as if it was in local file data. * * @param string $buffer the buffer to read data from * @param ZipEntry|null $entry * * @throws ZipException on error * * @return JarMarkerExtraField */ public static function unpackLocalFileData($buffer, ZipEntry $entry = null) { if (!empty($buffer)) { throw new ZipException("JarMarker doesn't expect any data"); } return new self(); } /** * Populate data from this array as if it was in central directory data. * * @param string $buffer the buffer to read data from * @param ZipEntry|null $entry * * @throws ZipException on error * * @return JarMarkerExtraField */ public static function unpackCentralDirData($buffer, ZipEntry $entry = null) { return self::unpackLocalFileData($buffer, $entry); } /** * @return string */ public function __toString() { return sprintf('0x%04x Jar Marker', self::HEADER_ID); } }