Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/store1/vendor/chi-teck/drupal-code-generator/src/Command/Plugin/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/store1/vendor/chi-teck/drupal-code-generator/src/Command/Plugin/Constraint.php

<?php declare(strict_types=1);

namespace DrupalCodeGenerator\Command\Plugin;

use DrupalCodeGenerator\Application;
use DrupalCodeGenerator\Utils;

/**
 * Implements plugin:constraint command.
 */
final class Constraint extends PluginGenerator {

  protected string $name = 'plugin:constraint';
  protected string $description = 'Generates constraint plugin';
  protected string $alias = 'constraint';
  protected string $templatePath = Application::TEMPLATE_PATH . '/plugin/constraint';

  /**
   * {@inheritdoc}
   */
  protected function generate(array &$vars): void {
    $this->collectDefault($vars);

    $input_types = [
      'entity' => 'Entity',
      'item_list' => 'Item list',
      'item' => 'Item',
      'raw_value' => 'Raw value',
    ];
    $vars['input_type'] = $this->choice('Type of data to validate', $input_types, 'Item list');

    $this->addFile('src/Plugin/Validation/Constraint/{class}.php')
      ->template('constraint');

    $this->addFile('src/Plugin/Validation/Constraint/{class}Validator.php')
      ->template('validator');
  }

  /**
   * {@inheritdoc}
   */
  protected function askPluginIdQuestion(): string {
    // Unlike other plugin types. Constraint IDs use camel case.
    $default_plugin_id = '{name|camelize}{plugin_label|camelize}';
    $plugin_id_validator = static function ($value) {
      if (!\preg_match('/^[a-z][a-z0-9_]*[a-z0-9]$/i', $value)) {
        throw new \UnexpectedValueException('The value is not correct constraint ID.');
      }
      return $value;
    };
    return $this->ask('Constraint ID', $default_plugin_id, $plugin_id_validator);
  }

  /**
   * {@inheritdoc}
   */
  protected function askPluginClassQuestion(array $vars): string {
    $unprefixed_plugin_id = \preg_replace('/^' . Utils::camelize($vars['machine_name']) . '/', '', $vars['plugin_id']);
    $default_class = Utils::camelize($unprefixed_plugin_id) . 'Constraint';
    return $this->ask('Plugin class', $default_class);
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net