Property | Type | Description | |
---|---|---|---|
$_classes | array | Class dependencies. | |
$_methodMap | array | Maps reflect method names to result array keys. |
Method | Description | |
---|---|---|
classes ( array $options = [] ) : array | Gets an array of classes and their corresponding definition files, or examines a file and returns the classes it defines. | |
dependencies ( mixed $classes, array $options = [] ) : array | Gets the static and dynamic dependencies for a class or group of classes. | |
executable ( mixed $class, array $options = [] ) : array | Gets the executable lines of a class, by examining the start and end lines of each method. | |
info ( string $identifier, array $info = [] ) : array | Detailed source code identifier analysis. | |
invokeMethod ( string $method, array $params = [] ) : mixed | Calls a method on this object with the given parameters. Provides an OO wrapper for forward_static_call_array(). | |
isCallable ( string | object $object, string $method, boolean $internal = false ) : boolean | Determines if a given method can be called on an object/class. | |
lines ( string $data, array $lines ) : array | Returns an array of lines from a file, class, or arbitrary string, where $data is the data to read the lines from and $lines is an array of line numbers specifying which lines should be read. | |
methods ( mixed $class, string $format = null, array $options = [] ) : mixed | Returns various information on the methods of an object, in different formats. | |
parents ( string $class, array $options = [] ) : array | Gets the full inheritance list for the given class. | |
properties ( mixed $class, array $options = [] ) : mixed | Returns various information on the properties of an object. | |
type ( string $identifier ) : string | Determines if a given $identifier is a class property, a class method, a class itself, or a namespace identifier. |
Method | Description | |
---|---|---|
_class ( string $class ) : object | Returns an instance of the given class without directly instantiating it. Inspired by the work of Sebastian Bergmann on the PHP Object Freezer project. | |
_instance ( string | object $name, array $options = [] ) : object | Returns an instance of a class with given config. The name could be a key from the classes array, a fully namespaced class name, or an object. Typically this method is used in _init to create the dependencies used in the current class. | |
_items ( ReflectionClass $class, string $method, array $options ) : object | Helper method to get an array of ReflectionMethod or ReflectionProperty objects, wrapped in a Collection object, and filtered based on a set of options. | |
_modifiers ( string $inspector, array | string $list = [] ) : boolean | Helper method to determine if a class applies to a list of modifiers. |
protected static _items ( ReflectionClass $class, string $method, array $options ) : object | ||
$class | ReflectionClass | A reflection class instance from which to fetch. |
$method | string | A getter method to call on the `ReflectionClass` instance, which will return an array of items, i.e. `'getProperties'` or `'getMethods'`. |
$options | array | The options used to filter the resulting method list. - `'names'`: array of properties for filtering the result. - `'self'`: If true (default), only returns properties defined in `$class`, excluding properties from inherited classes. - `'public'`: If true (default) forces the property to be recognized as public. |
return | object | Returns a `Collection` object instance containing the results of the items returned from the call to the method specified in `$method`, after being passed through the filters specified in `$options`. |
public static classes ( array $options = [] ) : array | ||
$options | array | Option consists of: - `'group'`: Can be `classes` for grouping by class name or `files` for grouping by filename. - `'file': Valid file path for inspecting the containing classes. |
return | array | Associative of classes and their corresponding definition files |
public static dependencies ( mixed $classes, array $options = [] ) : array | ||
$classes | mixed | Either a string specifying a class, or a numerically indexed array of classes |
$options | array | Option consists of: - `'type'`: The type of dependency to check: `static` for static dependencies, `dynamic`for dynamic dependencies or `null` for both merged in the same array. Defaults to `null`. |
return | array | An array of the static and dynamic class dependencies or each if `type` is defined in $options. |
public static executable ( mixed $class, array $options = [] ) : array | ||
$class | mixed | Class name as a string or object instance. |
$options | array | Set of options: - `'self'` _boolean_: If `true` (default), only returns lines of methods defined in `$class`, excluding methods from inherited classes. - `'methods'` _array_: An arbitrary list of methods to search, as a string (single method name) or array of method names. - `'filter'` _boolean_: If `true`, filters out lines containing only whitespace or braces. Note: for some reason, the Zend engine does not report `switch` and `try` statements as executable lines, as well as parts of multi-line assignment statements, so they are filtered out as well. |
return | array | Returns an array of the executable line numbers of the class. |
public static info ( string $identifier, array $info = [] ) : array | ||
$identifier | string | The identifier to be analyzed |
$info | array | Optionally restrict or expand the default information returned from the `info` method. By default, the information returned is the same as the array keys contained in the `$_methodMap` property of Inspector. |
return | array | An array of the parsed meta-data information of the given identifier. |
public static isCallable ( string | object $object, string $method, boolean $internal = false ) : boolean | ||
$object | string | object | Class or instance to inspect. |
$method | string | Name of the method. |
$internal | boolean | Should be `true` if you want to check from inside the class/object. When `false` will also check for public visibility, defaults to `false`. |
return | boolean | Returns `true` if the method can be called, `false` otherwise. |
public static lines ( string $data, array $lines ) : array | ||
$data | string | If `$data` contains newlines, it will be read from directly, and have its own lines returned. If `$data` is a physical file path, that file will be read and have its lines returned. If `$data` is a class name, it will be converted into a physical file path and read. |
$lines | array | The array of lines to read. If a given line is not present in the data, it will be silently ignored. |
return | array | Returns an array where the keys are matching `$lines`, and the values are the corresponding line numbers in `$data`. |
public static methods ( mixed $class, string $format = null, array $options = [] ) : mixed | ||
$class | mixed | A string class name or an object instance, from which to get methods. |
$format | string | The type and format of data to return. Available options are: - `null`: Returns a `Collection` object containing a `ReflectionMethod` instance for each method. - `'extents'`: Returns a two-dimensional array with method names as keys, and an array with starting and ending line numbers as values. - `'ranges'`: Returns a two-dimensional array where each key is a method name, and each value is an array of line numbers which are contained in the method. |
$options | array | Set of options applied directly (check `_items()` for more options): - `'methods'` _array_: An arbitrary list of methods to search, as a string (single method name) or array of method names. - `'group'`: If true (default) the array is grouped by context (ex.: method name), if false the results are sequentially appended to an array. -'self': If true (default), only returns properties defined in `$class`, excluding properties from inherited classes. |
return | mixed | Return value depends on the $format given: - `null` on failure. - `lithium\util\Collection` if $format is `null` - `array` if $format is either `'extends'` or `'ranges'`. |
public static parents ( string $class, array $options = [] ) : array | ||
$class | string | Class whose inheritance chain will be returned |
$options | array | Option consists of: - `'autoLoad'` _boolean_: Whether or not to call `__autoload` by default. Defaults to `true`. |
return | array | An array of the name of the parent classes of the passed `$class` parameter, or `false` on error. |
public static properties ( mixed $class, array $options = [] ) : mixed | ||
$class | mixed | A string class name or an object instance, from which to get methods. |
$options | array | Set of options applied directly (check `_items()` for more options): - `'properties'`: array of properties to gather information from. - `'self'`: If true (default), only returns properties defined in `$class`, excluding properties from inherited classes. |
return | mixed | Returns an array with information about the properties from the class given in $class or null on error. |
protected static array $_classes | ||
return | array |
protected static array $_methodMap | ||
return | array |