filePath, 'r+'); if ($resource === false) { throw new RuntimeException("Could not open {$this->filePath}."); } return new Stream($resource); } public function getString(): string { return $this->getStream()->getContents(); } public function getLength(): int { return (int) $this->getStream()->getSize(); } }