diff options
Diffstat (limited to 'src/Decorators/CallbackDecorator.php')
-rw-r--r-- | src/Decorators/CallbackDecorator.php | 30 |
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); + } +} |