File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,38 @@ public static function crap($ccn, $coverage)
115115 );
116116 }
117117
118+ /**
119+ * Implementation of stream_resolve_include_path() in PHP
120+ * for version before PHP 5.3.2.
121+ *
122+ * @param string $file
123+ * @return mixed
124+ * @author Mattis Stordalen Flister <mattis@xait.no>
125+ * @since Method available since Release 1.1.0
126+ */
127+ public static function fileExistsInIncludePath ($ file )
128+ {
129+ if (function_exists ('stream_resolve_include_path ' )) {
130+ return stream_resolve_include_path ($ file );
131+ }
132+
133+ if (file_exists ($ file )) {
134+ return realpath ($ file );
135+ }
136+
137+ $ paths = explode (PATH_SEPARATOR , get_include_path ());
138+
139+ foreach ($ paths as $ path ) {
140+ $ fullpath = $ path . DIRECTORY_SEPARATOR . $ file ;
141+
142+ if (file_exists ($ fullpath )) {
143+ return realpath ($ fullpath );
144+ }
145+ }
146+
147+ return FALSE ;
148+ }
149+
118150 /**
119151 * @param string $directory
120152 * @return string
You can’t perform that action at this time.
0 commit comments