Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / consolidation / output-formatters / src / Transformations / UnstructuredDataFieldAccessor.php
diff --git a/vendor/consolidation/output-formatters/src/Transformations/UnstructuredDataFieldAccessor.php b/vendor/consolidation/output-formatters/src/Transformations/UnstructuredDataFieldAccessor.php
new file mode 100644 (file)
index 0000000..8ef7f12
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+namespace Consolidation\OutputFormatters\Transformations;
+
+use Dflydev\DotAccessData\Data;
+
+class UnstructuredDataFieldAccessor
+{
+    protected $data;
+
+    public function __construct($data)
+    {
+        $this->data = $data;
+    }
+
+    public function get($fields)
+    {
+        $data = new Data($this->data);
+        $result = new Data();
+        foreach ($fields as $key => $label) {
+            $item = $data->get($key);
+            if (isset($item)) {
+                if ($label == '.') {
+                    if (!is_array($item)) {
+                        return $item;
+                    }
+                    foreach ($item as $key => $value) {
+                        $result->set($key, $value);
+                    }
+                } else {
+                    $result->set($label, $data->get($key));
+                }
+            }
+        }
+        return $result->export();
+    }
+}