dkx / callable-parser
Callable parser
Installs: 261
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/dkx/callable-parser
Requires
- php: ^7.2
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-01-29 02:38:34 UTC
README
Callable parser
Installation
$ composer require dkx/callable-parser
Usage
<?php
namespace DKX\CallableParser\CallableParser;
$callable = getCallableSomehow();
$parsed = CallableParser::parse($callable);
The parse()
method can return one of the following classes:
DKX\CallableParser\Callables\FunctionCallable
: passed function nameDKX\CallableParser\Callables\MethodCallCallable
: passed instantiated object and method name (in array)DKX\CallableParser\Callables\StaticMethodCallCallable
: passed either string withclassName::methodName
notation or array with class name and method nameDKX\CallableParser\Callables\AnonymousFunctionCallable
: passed anonymous function