class LegacyServiceFinder (View source)

Find drush.services.yml files.

This discovery class is used solely for backwards compatability with Drupal modules that still use drush.services.ymls to define Drush Commands, Alterers & etc.; this mechanism is deprecated, though. Modules should instead use the static factory create mechanism.

Properties

protected $drushServiceYamls

Methods

__construct($moduleHandler, DrushConfig $drushConfig)

No description

array
getDrushServiceFiles()

Get all service files that this class can discover.

discoverDrushServiceProviders()

Search for drush.service.yml files in discoverable locations.

addModuleDrushServiceProvider(string $module, string $filename)

Determine whether or not the Drush services.yml file is applicable for this version of Drush.

string[]
findModuleDrushServiceProvider(string $module, string $dir)

No description

string
findDefaultServicesFile(string $module, string $dir)

No description

array
findModuleDrushServiceProviderFromComposer(string $dir)

In composer.json, the Drush version constraints will appear in the 'extra' section like so:

string
findAppropriateServicesFile(string $module, array $services, string $dir)

No description

addDrushServiceProvider(string $serviceProviderName, string $serviceYmlPath = '')

Add a services.yml file if it exists.

string[]
getModuleFileNames()

Find Drupal modules

Details

__construct($moduleHandler, DrushConfig $drushConfig)

No description

Parameters

$moduleHandler
DrushConfig $drushConfig

array getDrushServiceFiles()

Get all service files that this class can discover.

Return Value

array

List of discovered drush.service.yml files

protected discoverDrushServiceProviders()

Search for drush.service.yml files in discoverable locations.

protected addModuleDrushServiceProvider(string $module, string $filename)

Determine whether or not the Drush services.yml file is applicable for this version of Drush.

Parameters

string $module

Module name

string $filename

Full path to modules .info.yml file

protected string[] findModuleDrushServiceProvider(string $module, string $dir)

No description

Parameters

string $module

Module name

string $dir

Full path to module base dir

Return Value

string[]

List of discovered drush.service.yml files

protected string findDefaultServicesFile(string $module, string $dir)

No description

Parameters

string $module

Module name

string $dir

Full path to module base dir

Return Value

string

One discovered drush.service.yml file

protected array findModuleDrushServiceProviderFromComposer(string $dir)

In composer.json, the Drush version constraints will appear in the 'extra' section like so:

"extra": { "drush": { "services": { "drush.services.yml": "^9" } } }

There may be multiple drush service files listed; the first one that has a version constraint that matches the Drush version is used.

Parameters

string $dir

Full path to module base dir

Return Value

array

Drush services section from module's composer.json file

protected string findAppropriateServicesFile(string $module, array $services, string $dir)

No description

Parameters

string $module

Module name

array $services

List of services from module's composer.json file

string $dir

Full path to module base dir

Return Value

string

One discovered drush.service.yml file

protected addDrushServiceProvider(string $serviceProviderName, string $serviceYmlPath = '')

Add a services.yml file if it exists.

Parameters

string $serviceProviderName

Arbitrary name for temporary use only

string $serviceYmlPath

Path to drush.services.yml file

protected string[] getModuleFileNames()

Find Drupal modules

Return Value

string[]

List of paths to all modules' .info.yml files.