PHP code example of isholao / callableresolver
1. Go to this page and download the library: Download isholao/callableresolver library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
isholao / callableresolver example snippets
Dummy {
function methodToCall(){
return 'methodToCall';
}
}
$resolver = new \Isholao\CallableResolver\Resolver();
$resolved = $resolver->resolve(Dummy::class.'->methodToCall');
\\or
$resolved = $resolver->resolve(function(){
return 'methodToCall';
});
$resolved(); // 'methodToCall'
Dummy {
function methodToCall($name){
return $name;
}
}
$dc = new \Isholao\CallableResolver\DeferredCallable(Dummy::class.'->methodToCall');
$dc('methodToCall'); // 'methodToCall'
//or
$dc = new \Isholao\CallableResolver\DeferredCallable(Dummy::class.'->methodToCall', new \CallableResolver\Resolver());
$dc('methodToCall'); // 'methodToCall'