From 09aabc6b41ef92d97be145ddaafa8c128e56e304 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 4 Feb 2025 23:02:18 +0100 Subject: Remove dependency on PHP EpubMeta library. --- .../zipstream-php/test/FaultInjectionResource.php | 141 --------------------- 1 file changed, 141 deletions(-) delete mode 100644 vendor/maennchen/zipstream-php/test/FaultInjectionResource.php (limited to 'vendor/maennchen/zipstream-php/test/FaultInjectionResource.php') diff --git a/vendor/maennchen/zipstream-php/test/FaultInjectionResource.php b/vendor/maennchen/zipstream-php/test/FaultInjectionResource.php deleted file mode 100644 index 3d4440e8a..000000000 --- a/vendor/maennchen/zipstream-php/test/FaultInjectionResource.php +++ /dev/null @@ -1,141 +0,0 @@ -context); - - if (!isset($options[self::NAME]['injectFaults'])) { - return false; - } - - $this->mode = $mode; - $this->injectFaults = $options[self::NAME]['injectFaults']; - - if ($this->shouldFail(__FUNCTION__)) { - return false; - } - - return true; - } - - public function stream_write(string $data) - { - if ($this->shouldFail(__FUNCTION__)) { - return false; - } - return true; - } - - public function stream_eof() - { - return true; - } - - public function stream_seek(int $offset, int $whence): bool - { - if ($this->shouldFail(__FUNCTION__)) { - return false; - } - - return true; - } - - public function stream_tell(): int - { - if ($this->shouldFail(__FUNCTION__)) { - return false; - } - - return 0; - } - - public static function register(): void - { - if (!in_array(self::NAME, stream_get_wrappers(), true)) { - stream_wrapper_register(self::NAME, __CLASS__); - } - } - - public function stream_stat(): array - { - static $modeMap = [ - 'r' => 33060, - 'rb' => 33060, - 'r+' => 33206, - 'w' => 33188, - 'wb' => 33188, - ]; - - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => $modeMap[$this->mode], - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0, - ]; - } - - public function url_stat(string $path, int $flags): array - { - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => 0, - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0, - ]; - } - - private static function createStreamContext(array $injectFaults) - { - return stream_context_create([ - self::NAME => ['injectFaults' => $injectFaults], - ]); - } - - private function shouldFail(string $function): bool - { - return in_array($function, $this->injectFaults, true); - } -} -- cgit v1.2.3