This can construct & call a method on a passed passed classname::method string.
This library is great for command bus, event bus or message bus processing, where by just passing a class name and method as a string can be instanciated and executed.
$invoker = new KodCube\Invoker\Invoker();
$invoker = new KodCube\Invoker\Invoker();
$result = $invoker('MyClass');
is the same as
$class = new MyClass();
$result = $class();
$invoker = new KodCube\Invoker\Invoker();
$result = $invoker('MyClass::myMethod');
is the same as
$class = new MyClass();
$result = $class->myMethod();
$invoker = new KodCube\Invoker\Invoker();
$result = $invoker('MyClass::myMethod',null,['arg1','arg2']);
is the same as
$class = new MyClass('arg1','arg2');
$result = $class->myMethod();
$invoker = new KodCube\Invoker\Invoker();
$result = $invoker('MyClass::myMethod',['arg1','arg2']);
is the same as
$class = new MyClass();
$result = $class->myMethod('arg1','arg2');
$invoker = new KodCube\Invoker\Invoker();
$result = $invoker('MyClass::myMethod');
is the same as
$result = MyClass::myMethod();