1. Go to this page and download the library: Download aegisora/is-callable-rule 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/ */
aegisora / is-callable-rule example snippets
function () {}
static function () {}
'trim'
[$object, 'method']
[SomeClass::class, 'method']
null
true
123
'not_existing_function'
new stdClass()
use Aegisora\Rules\IsCallableRule;
use Aegisora\RuleContract\Models\Context;
$result = IsCallableRule::create()->validate(
Context::create(function () {
return true;
})
);
if ($result->isValid()) {
// value is callable
} else {
// value is not callable
}
use Aegisora\Rules\IsCallableRule;
use Aegisora\RuleContract\Models\Context;
$result = IsCallableRule::create()->validate(
Context::create('not-callable')
);
if ($result->isValid()) {
// will not happen
} else {
// validation failed
}
IsCallableRule::create();
is_callable($value)
$value instanceof Closure
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.