Version 1
[yaffs-website] / vendor / consolidation / output-formatters / src / StructuredData / CallableRenderer.php
diff --git a/vendor/consolidation/output-formatters/src/StructuredData/CallableRenderer.php b/vendor/consolidation/output-formatters/src/StructuredData/CallableRenderer.php
new file mode 100644 (file)
index 0000000..240fa83
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace Consolidation\OutputFormatters\StructuredData;
+
+use Consolidation\OutputFormatters\Options\FormatterOptions;
+
+class CallableRenderer implements RenderCellInterface
+{
+    /** @var callable */
+    protected $renderFunction;
+
+    public function __construct(callable $renderFunction)
+    {
+        $this->renderFunction = $renderFunction;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function renderCell($key, $cellData, FormatterOptions $options, $rowData)
+    {
+        return call_user_func($this->renderFunction, $key, $cellData, $options, $rowData);
+    }
+}