@@ -455,15 +455,12 @@ public function get($name)
455
455
{
456
456
$ this ->init ();
457
457
458
- if (isset ($ this ->commands [$ name ])) {
459
- $ command = $ this ->commands [$ name ];
460
- } elseif ($ this ->commandLoader && $ this ->commandLoader ->has ($ name )) {
461
- $ command = $ this ->commandLoader ->get ($ name );
462
- $ this ->add ($ command );
463
- } else {
458
+ if (!$ this ->has ($ name )) {
464
459
throw new CommandNotFoundException (sprintf ('The command "%s" does not exist. ' , $ name ));
465
460
}
466
461
462
+ $ command = $ this ->commands [$ name ];
463
+
467
464
if ($ this ->wantHelps ) {
468
465
$ this ->wantHelps = false ;
469
466
@@ -487,7 +484,7 @@ public function has($name)
487
484
{
488
485
$ this ->init ();
489
486
490
- return isset ($ this ->commands [$ name ]) || ($ this ->commandLoader && $ this ->commandLoader ->has ($ name ));
487
+ return isset ($ this ->commands [$ name ]) || ($ this ->commandLoader && $ this ->commandLoader ->has ($ name ) && $ this -> add ( $ this -> commandLoader -> get ( $ name )) );
491
488
}
492
489
493
490
/**
@@ -650,7 +647,9 @@ public function all($namespace = null)
650
647
$ commands = $ this ->commands ;
651
648
foreach ($ this ->commandLoader ->getNames () as $ name ) {
652
649
if (!isset ($ commands [$ name ])) {
653
- $ commands [$ name ] = $ this ->get ($ name );
650
+ if ($ this ->commandLoader ->get ($ name )->isEnabled ()) {
651
+ $ commands [$ name ] = $ this ->get ($ name );
652
+ }
654
653
}
655
654
}
656
655
@@ -667,7 +666,9 @@ public function all($namespace = null)
667
666
if ($ this ->commandLoader ) {
668
667
foreach ($ this ->commandLoader ->getNames () as $ name ) {
669
668
if (!isset ($ commands [$ name ]) && $ namespace === $ this ->extractNamespace ($ name , substr_count ($ namespace , ': ' ) + 1 )) {
670
- $ commands [$ name ] = $ this ->get ($ name );
669
+ if ($ this ->commandLoader ->get ($ name )->isEnabled ()) {
670
+ $ commands [$ name ] = $ this ->get ($ name );
671
+ }
671
672
}
672
673
}
673
674
}
0 commit comments