Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / src / Symfony / IndiscriminateInputDefinition.php
diff --git a/vendor/drush/drush/src/Symfony/IndiscriminateInputDefinition.php b/vendor/drush/drush/src/Symfony/IndiscriminateInputDefinition.php
new file mode 100644 (file)
index 0000000..5cc5c0b
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+namespace Drush\Symfony;
+
+use Symfony\Component\Console\Input\InputDefinition;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\LogicException;
+
+/**
+ * This is an InputDefinition that allows any option to be considered valid.
+ * Used when passing a command through to another dispatcher that will do
+ * the option validation.
+ *
+ * We use this instead of a LessStrictArgvInput in cases where we do not
+ * know in advance whether the input should be handled indiscriminately.
+ * In other words, an IndiscriminateInputDefinition is attached to individual
+ * Commands that should accept any option, whereas a LessStrictArgvInput
+ * should be used to make all command skip option validation.
+ */
+class IndiscriminateInputDefinition extends InputDefinition
+{
+    /**
+     * @inheritdoc
+     */
+    public function hasShortcut($name)
+    {
+        return true;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function hasOption($name)
+    {
+        return true;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getOption($name)
+    {
+        if (parent::hasOption($name)) {
+            return parent::getOption($name);
+        }
+        return new InputOption($name, null, InputOption::VALUE_OPTIONAL, '', []);
+    }
+}