public function discoverCommands() { if ($this->commands !==
[]) { return;
} /** @var FileLocator $locator */
$locator =
service('locator'
);
$files =
$locator->
listFiles('Commands/'
);
// If no matching command files were found, bail
// This should never happen in unit testing.
if ($files ===
[]) { return; // @codeCoverageIgnore
} // Loop over each file checking to see if a command with that
// alias exists in the class.
foreach ($files as $file) { $className =
$locator->
getClassname($file);