DevToolsCommandLoader

Class
extends ContainerCommandLoader
Final: Yes

Responsible for dynamically discovering and loading Symfony Console commands within the DevTools context. This class extends the ContainerCommandLoader and integrates with a PSR-11 compatible container to lazily instantiate commands.

Description

The implementation MUST scan a predefined directory for PHP classes representing console commands and SHALL only register classes that:

  • Are instantiable
  • Extend the Symfony\Component\Console\Command\Command base class
  • Declare the Symfony\Component\Console\Attribute\AsCommand attribute

The command name MUST be extracted from the AsCommand attribute metadata and used as the key in the command map. Classes that do not meet these criteria MUST NOT be included in the command map.

Table of Contents

Methods

__construct()

Constructs the DevToolsCommandLoader.

 : mixed
getCommandMap()

Builds a command map by scanning the Command directory for classes that are instantiable and have the AsCommand attribute.

 : array<string|int, mixed>
Methods

__construct()

Public

Constructs the DevToolsCommandLoader.

public __construct(Finder  $finder, ContainerInterface  $container) : mixed

Description

This constructor initializes the command loader by scanning the Command directory for classes that are instantiable and have the AsCommand attribute. It builds a command map associating command names with their respective classes.

Parameters
$finder : Finder
$container : ContainerInterface

getCommandMap()

Private

Builds a command map by scanning the Command directory for classes that are instantiable and have the AsCommand attribute.

private getCommandMap(Finder  $finder) : array<string|int, mixed>
Parameters
$finder : Finder
Return values
array<string|int, mixed>