function stream_open(string $path, string $mode, int $flags, &$opened_path) : bool { $path = preg_replace('#^' . self::SCHEME . '://#', '', $path); if (STREAM_USE_PATH & $flags && $path[0] !== '/') { $path = dirname(debug_backtrace()[0]['file']) . '/' . $path; } $fileMeta = new SplFileInfo($path); if (!$fileMeta->isReadable()) { return false; } $opened_path = $path; $source = yay_parse(file_get_contents($fileMeta->getRealPath())); // var_dump($source); $this->resource = fopen('php://memory', 'rb+'); fwrite($this->resource, $source); rewind($this->resource); return true; }
function stream_read($lengh) : string { return !$this->file->eof() ? yay_parse($this->file->fread($lengh), $this->file->getPath()) : ''; }