dkx/callable-parser

This package is abandoned and no longer maintained. No replacement package was suggested.

Callable parser

0.0.1 2019-02-03 12:30 UTC

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 name
  • DKX\CallableParser\Callables\MethodCallCallable: passed instantiated object and method name (in array)
  • DKX\CallableParser\Callables\StaticMethodCallCallable: passed either string with className::methodName notation or array with class name and method name
  • DKX\CallableParser\Callables\AnonymousFunctionCallable: passed anonymous function