File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Original file line number Diff line number Diff line change @@ -122,16 +122,16 @@ public function getReflection()
122
122
*/
123
123
public function registerCommands (Application $ application )
124
124
{
125
- if (!is_dir ( $ dir = $ this ->getPath ().'/Command ' )) {
125
+ if (!$ dir = realpath ( $ this ->getPath ().'/Command ' )) {
126
126
return ;
127
127
}
128
128
129
129
$ finder = new Finder ();
130
130
$ finder ->files ()->name ('*Command.php ' )->in ($ dir );
131
131
132
- $ prefix = $ this ->namespacePrefix .'\\' .$ this ->name .'\\Command \\ ' ;
132
+ $ prefix = $ this ->namespacePrefix .'\\' .$ this ->name .'\\Command ' ;
133
133
foreach ($ finder as $ file ) {
134
- $ r = new \ReflectionClass ($ prefix .basename ($ file , '.php ' ));
134
+ $ r = new \ReflectionClass ($ prefix .strtr ( $ file -> getPath (), array ( $ dir => '' , ' / ' => '\\' )). '\\' . basename ($ file , '.php ' ));
135
135
if ($ r ->isSubclassOf ('Symfony \\Components \\Console \\Command \\Command ' ) && !$ r ->isAbstract ()) {
136
136
$ application ->addCommand ($ r ->newInstance ());
137
137
}
Original file line number Diff line number Diff line change @@ -75,16 +75,16 @@ public function getReflection()
75
75
76
76
public function registerCommands (Application $ application )
77
77
{
78
- if (!is_dir ( $ dir = $ this ->getPath ().'/Command ' )) {
78
+ if (!$ dir = realpath ( $ this ->getPath ().'/Command ' )) {
79
79
return ;
80
80
}
81
81
82
82
$ finder = new Finder ();
83
83
$ finder ->files ()->name ('*Command.php ' )->in ($ dir );
84
84
85
- $ prefix = $ this ->namespacePrefix .'\\' .$ this ->name .'\\Command \\ ' ;
85
+ $ prefix = $ this ->namespacePrefix .'\\' .$ this ->name .'\\Command ' ;
86
86
foreach ($ finder as $ file ) {
87
- $ r = new \ReflectionClass ($ prefix .basename ($ file , '.php ' ));
87
+ $ r = new \ReflectionClass ($ prefix .strtr ( $ file -> getPath (), array ( $ dir => '' , ' / ' => '\\' )). '\\' . basename ($ file , '.php ' ));
88
88
if ($ r ->isSubclassOf ('Symfony \\Components \\Console \\Command \\Command ' ) && !$ r ->isAbstract ()) {
89
89
$ application ->addCommand ($ r ->newInstance ());
90
90
}
You can’t perform that action at this time.
0 commit comments