Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Decorators/CallbackDecorator.php')
-rw-r--r--src/Decorators/CallbackDecorator.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Decorators/CallbackDecorator.php b/src/Decorators/CallbackDecorator.php
new file mode 100644
index 00000000..1f1e93b1
--- /dev/null
+++ b/src/Decorators/CallbackDecorator.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * PHPPgAdmin6
+ */
+
+namespace PHPPgAdmin\Decorators;
+
+use Closure;
+
+class CallbackDecorator extends Decorator
+{
+ /**
+ * @var \Closure|mixed
+ */
+ public $fn;
+
+ public $p;
+
+ public function __construct(Closure $callback, $param = null)
+ {
+ $this->fn = $callback;
+ $this->p = $param;
+ }
+
+ public function value($fields)
+ {
+ return \call_user_func($this->fn, $fields, $this->p);
+ }
+}