File tree 3 files changed +19
-21
lines changed
Filter options
DependencyInjection/Loader
3 files changed +19
-21
lines changed
Original file line number Diff line number Diff line change @@ -42,11 +42,15 @@ public function locate($name, $currentPath = null, $first = true)
42
42
}
43
43
44
44
if ($ this ->isAbsolutePath ($ name )) {
45
- if (array () === $ files = glob ($ name , GLOB_BRACE )) {
45
+ if (file_exists ($ name )) {
46
+ return $ name ;
47
+ }
48
+
49
+ if (array () === $ files = glob ($ name , defined ('GLOB_BRACE ' ) ? GLOB_BRACE : 0 )) {
46
50
throw new FileLocatorFileNotFoundException (sprintf ('The file "%s" does not exist. ' , $ name ));
47
51
}
48
52
49
- if ($ first ) {
53
+ if (true === $ first ) {
50
54
return array_shift ($ files );
51
55
}
52
56
@@ -62,18 +66,8 @@ public function locate($name, $currentPath = null, $first = true)
62
66
$ paths = array_unique ($ paths );
63
67
$ filepaths = array ();
64
68
65
- $ load = function ($ file ) use (&$ filepaths ) {
66
- if (@file_exists ($ file )) {
67
- $ filepaths [] = $ file ;
68
- }
69
- };
70
-
71
69
foreach ($ paths as $ path ) {
72
- if (array () !== $ files = glob ($ path .DIRECTORY_SEPARATOR .$ name )) {
73
- array_walk ($ files , $ load );
74
- } else {
75
- $ load ($ path .DIRECTORY_SEPARATOR .$ name );
76
- }
70
+ $ filepaths = array_merge (glob ($ path .DIRECTORY_SEPARATOR .$ name , defined ('GLOB_BRACE ' ) ? GLOB_BRACE : 0 ), $ filepaths );
77
71
}
78
72
79
73
if (!$ filepaths ) {
Original file line number Diff line number Diff line change @@ -112,10 +112,12 @@ private function parseImports(\DOMDocument $xml, $file)
112
112
$ resourceFile = $ defaultDirectory .DIRECTORY_SEPARATOR .$ resourceFile ;
113
113
}
114
114
115
- $ files = glob ($ resourceFile , GLOB_BRACE );
116
-
117
- foreach ($ files as $ resource ) {
118
- $ this ->import ($ resource , XmlUtils::phpize ($ import ->getAttribute ('type ' )) ?: null , (bool ) XmlUtils::phpize ($ import ->getAttribute ('ignore-errors ' )), $ file );
115
+ if (array () !== $ files = glob ($ resourceFile , defined ('GLOB_BRACE ' ) ? GLOB_BRACE : 0 )) {
116
+ foreach ($ files as $ resource ) {
117
+ $ this ->import ($ resource , XmlUtils::phpize ($ import ->getAttribute ('type ' )) ?: null , (bool ) XmlUtils::phpize ($ import ->getAttribute ('ignore-errors ' )), $ file );
118
+ }
119
+ } else {
120
+ $ this ->import ($ resourceFile , XmlUtils::phpize ($ import ->getAttribute ('type ' )) ?: null , (bool ) XmlUtils::phpize ($ import ->getAttribute ('ignore-errors ' )), $ file );
119
121
}
120
122
}
121
123
}
Original file line number Diff line number Diff line change @@ -143,10 +143,12 @@ private function parseImports($content, $file)
143
143
$ import ['resource ' ] = $ defaultDirectory .DIRECTORY_SEPARATOR .$ import ['resource ' ];
144
144
}
145
145
146
- $ files = glob ($ import ['resource ' ], GLOB_BRACE );
147
-
148
- foreach ($ files as $ resource ) {
149
- $ this ->import ($ resource , isset ($ import ['type ' ]) ? $ import ['type ' ] : null , isset ($ import ['ignore_errors ' ]) ? (bool ) $ import ['ignore_errors ' ] : false , $ file );
146
+ if (array () !== $ files = glob ($ import ['resource ' ], defined ('GLOB_BRACE ' ) ? GLOB_BRACE : 0 )) {
147
+ foreach ($ files as $ resource ) {
148
+ $ this ->import ($ resource , isset ($ import ['type ' ]) ? $ import ['type ' ] : null , isset ($ import ['ignore_errors ' ]) ? (bool ) $ import ['ignore_errors ' ] : false , $ file );
149
+ }
150
+ } else {
151
+ $ this ->import ($ import ['resource ' ], isset ($ import ['type ' ]) ? $ import ['type ' ] : null , isset ($ import ['ignore_errors ' ]) ? (bool ) $ import ['ignore_errors ' ] : false , $ file );
150
152
}
151
153
}
152
154
}
You can’t perform that action at this time.
0 commit comments