Mecha CMS

Helper functions.

fire

Trigger callable input with parameters and scope.

2.2.0

fire(callable $fn, array $lot, $that);

Example:

class Calc {
    public $i;
    public function __construct(int $i) {
        $this->i = $i;
    }
    public function add(int $i) {
        $this->i += $i;
    }
}

$scope = new Calc(1);

function foo(int $i) {
    $this->add($i);
    return $this->i;
}

echo fire('foo', [4], $scope); // `5`