1 | <?php |
||
18 | final class File extends \SplFileInfo |
||
19 | { |
||
20 | private $relativeParentFolder; |
||
21 | private $relativeFilePath; |
||
22 | |||
23 | /** |
||
24 | * Constructor. |
||
25 | * |
||
26 | * @param string $filePath The file name or absolute file path. If just a file name is given, then it |
||
27 | * will look for the file in the current working directory. |
||
28 | * @param string $relativeParentFolder The relative path |
||
29 | * @param string $relativeFilePath The relative path name |
||
30 | * |
||
31 | * @since 0.2.0 |
||
32 | */ |
||
33 | 170 | public function __construct($filePath, $relativeParentFolder, $relativeFilePath) |
|
40 | |||
41 | /** |
||
42 | * Get the name of the file without an extension. |
||
43 | * |
||
44 | * @param null $suffix This value will be discarded and is only needed to be able to override the \SplFileInfo |
||
45 | * definition. |
||
46 | * |
||
47 | * @since 0.2.0 |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getBasename($suffix = null) |
||
55 | |||
56 | /** |
||
57 | * Get the name of the with the extension. |
||
58 | * |
||
59 | * @since 0.2.0 |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getFilename() |
||
67 | |||
68 | /** |
||
69 | * Get the absolute path to this file. |
||
70 | * |
||
71 | * @since 0.2.0 |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getFilePath() |
||
79 | |||
80 | /** |
||
81 | * Get the path to the parent folder of this file. |
||
82 | * |
||
83 | * @since 0.2.0 |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getParentFolder() |
||
91 | |||
92 | /** |
||
93 | * Get the file path to this file, relative to where it was created; likely the current working directory. |
||
94 | * |
||
95 | * @since 0.2.0 |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | 41 | public function getRelativeFilePath() |
|
103 | |||
104 | /** |
||
105 | * Get the path to the parent folder this file, relative to where it was created; likely the current working directory. |
||
106 | * |
||
107 | * @since 0.2.0 |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getRelativeParentFolder() |
||
115 | |||
116 | /** |
||
117 | * Get the contents of this file. |
||
118 | * |
||
119 | * @since 0.2.0 |
||
120 | * |
||
121 | * @throws \RuntimeException When the file could not be read. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getContents() |
||
137 | } |
||
138 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.