123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace Symfony\Component\Finder;
- class SplFileInfo extends \SplFileInfo
- {
- private $relativePath;
- private $relativePathname;
-
- public function __construct(string $file, string $relativePath, string $relativePathname)
- {
- parent::__construct($file);
- $this->relativePath = $relativePath;
- $this->relativePathname = $relativePathname;
- }
-
- public function getRelativePath()
- {
- return $this->relativePath;
- }
-
- public function getRelativePathname()
- {
- return $this->relativePathname;
- }
-
- public function getContents()
- {
- set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
- $content = file_get_contents($this->getPathname());
- restore_error_handler();
- if (false === $content) {
- throw new \RuntimeException($error);
- }
- return $content;
- }
- }
|