PHP Class Habari\Method

显示文件 Open project: habari/system

Public Properties

Property Type Description
$class
$method

Public Methods

Method Description
__construct ( string $class, string $method ) : Method Constructor
__invoke ( ) : mixed Execute the representative method when this object is called as a function.
create ( string $class, string $method ) : Method Quick-create for building an instance of Method
dispatch ( Callable | string $method, mixed $multiple_optional_args = null ) : boolean | mixed Dispatch a method, whether a filter or function
dispatch_array ( Callable | string $method, array $args = [] ) : boolean | mixed Dispatch a method, whether a filter or function
exists ( ) : boolean Determine if the method exists and can be called
method_array ( ) : callable Get the array that represents this method

Method Details

__construct() public method

Constructor
public __construct ( string $class, string $method ) : Method
$class string The name of the class
$method string The method of the class to execute
return Method The method of the class

__invoke() public method

Example: $fn = Method::create('Habari/Utils', 'debug'); $fn('foo'); // Calls Habari/Utils::debug('foo'); This magic method should not be called directly
public __invoke ( ) : mixed
return mixed The return value of the function this Method object represents

create() public static method

Quick-create for building an instance of Method
public static create ( string $class, string $method ) : Method
$class string The name of the class
$method string The method of the class
return Method An instance of Method to represent the method call

dispatch() public static method

Dispatch a method, whether a filter or function
public static dispatch ( Callable | string $method, mixed $multiple_optional_args = null ) : boolean | mixed
$method Callable | string The method to call
$multiple_optional_args mixed Multiple arguments to dispatch() should be passed as separate arguments
return boolean | mixed The return value from the dispatched method

dispatch_array() public static method

Dispatch a method, whether a filter or function
public static dispatch_array ( Callable | string $method, array $args = [] ) : boolean | mixed
$method Callable | string The method to call
$args array An array of arguments to be passed to the method
return boolean | mixed The return value from the dispatched method

exists() public method

Determine if the method exists and can be called
public exists ( ) : boolean
return boolean true if the method exists

method_array() public method

Get the array that represents this method
public method_array ( ) : callable
return callable An array that can be used as a function (O_o)

Property Details

$class public_oe property

public $class

$method public_oe property

public $method