Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Controller / ArgumentResolver / RawParameterValueResolver.php
diff --git a/web/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php b/web/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php
new file mode 100644 (file)
index 0000000..7e2a35a
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\Core\Controller\ArgumentResolver;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
+use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
+
+/**
+ * Yields an argument's value from the request's _raw_variables attribute.
+ */
+final class RawParameterValueResolver implements ArgumentValueResolverInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function supports(Request $request, ArgumentMetadata $argument) {
+    return !$argument->isVariadic() && $request->attributes->has('_raw_variables') && array_key_exists($argument->getName(), $request->attributes->get('_raw_variables'));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function resolve(Request $request, ArgumentMetadata $argument) {
+    yield $request->attributes->get('_raw_variables')[$argument->getName()];
+  }
+
+}