@@ -83,13 +83,18 @@ public function getLocator()
83
83
*/
84
84
public function import ($ resource , $ type = null , $ ignoreErrors = false , $ sourceResource = null )
85
85
{
86
- if (is_string ($ resource ) && false !== strpbrk ($ resource , '*?{[ ' )) {
86
+ if (is_string ($ resource ) && strlen ( $ resource ) !== $ i = strcspn ($ resource , '*?{[ ' )) {
87
87
$ ret = array ();
88
- foreach ($ this ->glob ($ resource , false , $ _ , true ) as $ path => $ info ) {
89
- $ ret [] = $ this ->doImport ($ path , $ type , $ ignoreErrors , $ sourceResource );
88
+ $ isSubpath = 0 !== $ i && false !== strpos (substr ($ resource , 0 , $ i ), '/ ' );
89
+ foreach ($ this ->glob ($ resource , false , $ tracker , $ ignoreErrors || !$ isSubpath ) as $ path => $ info ) {
90
+ if (null !== $ res = $ this ->doImport ($ path , $ type , $ ignoreErrors , $ sourceResource )) {
91
+ $ ret [] = $ res ;
92
+ }
93
+ $ isSubpath = true ;
90
94
}
91
- if ($ ret ) {
92
- return count ($ ret ) > 1 ? $ ret : $ ret [0 ];
95
+
96
+ if ($ isSubpath ) {
97
+ return isset ($ ret [1 ]) ? $ ret : (isset ($ ret [0 ]) ? $ ret [0 ] : null );
93
98
}
94
99
}
95
100
@@ -104,7 +109,7 @@ protected function glob($pattern, $recursive, &$resource = null, $ignoreErrors =
104
109
if (strlen ($ pattern ) === $ i = strcspn ($ pattern , '*?{[ ' )) {
105
110
$ prefix = $ pattern ;
106
111
$ pattern = '' ;
107
- } elseif (0 === $ i ) {
112
+ } elseif (0 === $ i || false === strpos ( substr ( $ pattern , 0 , $ i ), ' / ' ) ) {
108
113
$ prefix = '. ' ;
109
114
$ pattern = '/ ' .$ pattern ;
110
115
} else {
0 commit comments