X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FConfig%2FValidateDebugCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FConfig%2FValidateDebugCommand.php;h=0000000000000000000000000000000000000000;hp=8ee48d0f88404270191ed367af265af660f6cb19;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Config/ValidateDebugCommand.php b/vendor/drupal/console/src/Command/Config/ValidateDebugCommand.php deleted file mode 100644 index 8ee48d0f8..000000000 --- a/vendor/drupal/console/src/Command/Config/ValidateDebugCommand.php +++ /dev/null @@ -1,109 +0,0 @@ -setName('config:validate:debug') - ->setDescription($this->trans('commands.config.validate.debug.description')) - ->addArgument('config.filepath', InputArgument::REQUIRED) - ->addArgument('config.schema.filepath', InputArgument::REQUIRED) - ->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - - /** - * @var TypedConfigManagerInterface $typedConfigManager - */ - $typedConfigManager = $this->get('config.typed'); - - $io = new DrupalStyle($input, $output); - - //Validate config file path - $configFilePath = $input->getArgument('config.filepath'); - if (!file_exists($configFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); - return 1; - } - - //Validate schema path - $configSchemaFilePath = $input->getArgument('config.schema.filepath'); - if (!file_exists($configSchemaFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); - return 1; - } - - $config = Yaml::decode(file_get_contents($configFilePath)); - $schema = Yaml::decode(file_get_contents($configSchemaFilePath)); - - //Get the schema name and check it exists in the schema array - $schemaName = $this->getSchemaName($input, $configFilePath); - if (!array_key_exists($schemaName, $schema)) { - $io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName); - return 1; - } - - return $this->printResults($this->manualCheckConfigSchema($typedConfigManager, $config, $schema[$schemaName]), $io); - } - - private function getSchemaName(InputInterface $input, $configFilePath) - { - $schemaName = $input->getOption('schema-name'); - if ($schemaName === null) { - $schema_name = end(explode('/', $configFilePath)); - $schemaName = substr($schema_name, 0, -4); - } - return $schemaName; - } - - private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_config, $config_data, $config_schema) - { - $data_definition = $typed_config->buildDataDefinition($config_schema, $config_data); - $this->schema = $typed_config->create($data_definition, $config_data); - $errors = []; - foreach ($config_data as $key => $value) { - $errors = array_merge($errors, $this->checkValue($key, $value)); - } - if (empty($errors)) { - return true; - } - - return $errors; - } -}