PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.0.2
WindPress – Tailwind CSS integration for WordPress v3.0.2
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
windpress / vendor / symfony / finder / SplFileInfo.php

SplFileInfo.php in WindPress – Tailwind CSS integration for WordPress 3.0.2, at vendor/symfony/finder/SplFileInfo.php

83 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace WindPressPackages\Symfony\Component\Finder;
12
13 /**
14 * Extends \SplFileInfo to support relative paths.
15 *
16 * @author Fabien Potencier <fabien@symfony.com>
17 */
18 class SplFileInfo extends \SplFileInfo
19 {
20 private $relativePath;
21 private $relativePathname;
22 /**
23 * @param string $file The file name
24 * @param string $relativePath The relative path
25 * @param string $relativePathname The relative path name
26 */
27 public function __construct(string $file, string $relativePath, string $relativePathname)
28 {
29 parent::__construct($file);
30 $this->relativePath = $relativePath;
31 $this->relativePathname = $relativePathname;
32 }
33 /**
34 * Returns the relative path.
35 *
36 * This path does not contain the file name.
37 *
38 * @return string
39 */
40 public function getRelativePath()
41 {
42 return $this->relativePath;
43 }
44 /**
45 * Returns the relative path name.
46 *
47 * This path contains the file name.
48 *
49 * @return string
50 */
51 public function getRelativePathname()
52 {
53 return $this->relativePathname;
54 }
55 public function getFilenameWithoutExtension(): string
56 {
57 $filename = $this->getFilename();
58 return pathinfo($filename, \PATHINFO_FILENAME);
59 }
60 /**
61 * Returns the contents of the file.
62 *
63 * @return string
64 *
65 * @throws \RuntimeException
66 */
67 public function getContents()
68 {
69 set_error_handler(function ($type, $msg) use (&$error) {
70 $error = $msg;
71 });
72 try {
73 $content = file_get_contents($this->getPathname());
74 } finally {
75 restore_error_handler();
76 }
77 if (\false === $content) {
78 throw new \RuntimeException($error);
79 }
80 return $content;
81 }
82 }
83