Traits
1 month ago
Either.php
1 month ago
Fns.php
1 month ago
Invoker.php
1 month ago
Logic.php
1 month ago
Obj.php
1 month ago
Relation.php
1 month ago
Str.php
1 month ago
Undefined.php
1 month ago
functions.php
1 month ago
Invoker.php
23 lines
| 1 | <?php |
| 2 | |
| 3 | namespace OTGS\Installer\FP; |
| 4 | |
| 5 | class _Invoker { |
| 6 | |
| 7 | private $fnName; |
| 8 | private $args = []; |
| 9 | |
| 10 | public function __construct( $fnName ) { |
| 11 | $this->fnName = $fnName; |
| 12 | } |
| 13 | |
| 14 | public function with( ...$args ) { |
| 15 | $this->args = $args; |
| 16 | return $this; |
| 17 | } |
| 18 | |
| 19 | public function __invoke( $instance ) { |
| 20 | $callback = [ $instance, $this->fnName ]; |
| 21 | return call_user_func_array( $callback, $this->args ); |
| 22 | } |
| 23 | } |