
| Current Path : /var/www/html/sirius-pallets/vendor/drush/drush/src/Attributes/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/sirius-pallets/vendor/drush/drush/src/Attributes/ValidateConfigName.php |
<?php
declare(strict_types=1);
namespace Drush\Attributes;
use Attribute;
use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\AnnotatedCommand\CommandError;
#[Attribute(Attribute::TARGET_METHOD)]
class ValidateConfigName extends ValidatorBase implements ValidatorInterface
{
/**
* @param string $argumentName
* The name of the argument which specifies the config ID.
*/
public function __construct(
public string $argumentName = 'config_name'
) {
}
public function validate(CommandData $commandData)
{
$configName = $commandData->input()->getArgument($this->argumentName);
$config = \Drupal::config($configName);
if ($config->isNew()) {
$msg = dt('Config !name does not exist', ['!name' => $configName]);
return new CommandError($msg);
}
}
}