12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace Symfony\Component\Finder;
- class SplFileInfo extends \SplFileInfo
- {
- private $relativePath;
- private $relativePathname;
-
- public function __construct($file, $relativePath, $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;
- }
- }
|