PHP Класс ref, php-ref

Автор: digitalnature - http://digitalnature.eu
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$config
$debug
$env
$fmt
$startTime
$time
$timeout

Открытые методы

Метод Описание
__construct ( string | RFormatter $format = 'html' ) Constructor
__get ( string $name ) Enforce proper use of this class
__set ( string $name, mixed $value ) Enforce proper use of this class
config ( string $key, mixed | null $value = null ) : mixed Set or get configuration options
getBacktrace ( ) : array | false Get relevant backtrace info for last ref call
getDebugInfo ( )
getInputExpressions ( array &$options = null ) : array Determines the input expression(s) passed to the shortcut function
getTime ( $precision = 4 ) : double Total CPU time used by the class
getTimeoutPoint ( )
parseComment ( string $comment, string | null $key = null ) : array | string | null Parses a DocBlock comment into a data structure.
query ( mixed $subject, string $expression = null ) Generate structured information about a variable/value/expression (subject)
splitRegex ( string $pattern ) : array Split a regex into its components
timeFunc ( integer $iterations, callable $function, &$output = null ) : double Executes a function the given number of times and returns the elapsed time.
timer ( integer $id = 1, integer $precision = 4 ) : void | double Timer utility

Защищенные методы

Метод Описание
evaluate ( &$subject, boolean $specialStr = false ) : mixed Evaluates the given variable
evaluateExp ( string $expression = null ) : string Scans for known classes and functions inside the provided expression, and linkifies them when possible
fromReflector ( Reflector $reflector, string $single = '', Reflector $context = null ) : string Generate class / function info
getParentClasses ( Reflector $class ) : array Get all parent classes of a class
hasInstanceTimedOut ( )
linkify ( Reflector $reflector, string | null $constant = null ) : string | null Generates an URL that points to the documentation page relevant for the requested context
strLen ( string $string ) : integer Calculates real string length
strPad ( $input, integer $padLen, string $padStr = ' ', integer $padType = STR_PAD_RIGHT ) : string Safe str_pad alternative

Описание методов

__construct() публичный Метод

Constructor
public __construct ( string | RFormatter $format = 'html' )
$format string | RFormatter Output format ID, or formatter instance defaults to 'html'

__get() публичный Метод

Enforce proper use of this class
public __get ( string $name )
$name string

__set() публичный Метод

Enforce proper use of this class
public __set ( string $name, mixed $value )
$name string
$value mixed

config() публичный статический Метод

Set or get configuration options
public static config ( string $key, mixed | null $value = null ) : mixed
$key string
$value mixed | null
Результат mixed

evaluate() защищенный Метод

Evaluates the given variable
protected evaluate ( &$subject, boolean $specialStr = false ) : mixed
$specialStr boolean Should this be interpreted as a special string?
Результат mixed Result (both HTML and text modes generate strings)

evaluateExp() защищенный Метод

Scans for known classes and functions inside the provided expression, and linkifies them when possible
protected evaluateExp ( string $expression = null ) : string
$expression string Expression to format
Результат string Formatted output

fromReflector() защищенный Метод

Generate class / function info
protected fromReflector ( Reflector $reflector, string $single = '', Reflector $context = null ) : string
$reflector Reflector Class name or reflection object
$single string Skip parent classes
$context Reflector Object context (for methods)
Результат string

getBacktrace() публичный статический Метод

Get relevant backtrace info for last ref call
public static getBacktrace ( ) : array | false
Результат array | false

getDebugInfo() публичный статический Метод

public static getDebugInfo ( )

getInputExpressions() публичный статический Метод

Determines the input expression(s) passed to the shortcut function
public static getInputExpressions ( array &$options = null ) : array
$options array
Результат array Array of string expressions

getParentClasses() защищенный статический Метод

Get all parent classes of a class
protected static getParentClasses ( Reflector $class ) : array
$class Reflector Reflection object
Результат array Array of ReflectionClass objects (starts with the ancestor, ends with the given class)

getTime() публичный статический Метод

Total CPU time used by the class
public static getTime ( $precision = 4 ) : double
Результат double

getTimeoutPoint() публичный статический Метод

public static getTimeoutPoint ( )

hasInstanceTimedOut() защищенный Метод

protected hasInstanceTimedOut ( )

linkify() защищенный Метод

For internal functions and classes, the URI will point to the local PHP manual if installed and configured, otherwise to php.net/manual (the english one)
protected linkify ( Reflector $reflector, string | null $constant = null ) : string | null
$reflector Reflector Reflector object (used to determine the URL scheme for internal stuff)
$constant string | null Constant name, if this is a request to linkify a constant
Результат string | null URL

parseComment() публичный статический Метод

Parses a DocBlock comment into a data structure.
public static parseComment ( string $comment, string | null $key = null ) : array | string | null
$comment string DocBlock comment (must start with /**)
$key string | null Field to return (optional)
Результат array | string | null Array containing all fields, array/string with the contents of the requested field, or null if the comment is empty/invalid

query() публичный Метод

Output is flushed to the screen
public query ( mixed $subject, string $expression = null )
$subject mixed
$expression string

splitRegex() публичный статический Метод

Based on "Regex Colorizer" by Steven Levithan (this is a translation from javascript)
public static splitRegex ( string $pattern ) : array
$pattern string
Результат array

strLen() защищенный статический Метод

Calculates real string length
protected static strLen ( string $string ) : integer
$string string
Результат integer

strPad() защищенный статический Метод

Safe str_pad alternative
protected static strPad ( $input, integer $padLen, string $padStr = ' ', integer $padType = STR_PAD_RIGHT ) : string
$padLen integer
$padStr string
$padType integer
Результат string

timeFunc() публичный статический Метод

Keep in mind that the returned time includes function call overhead (including microtime calls) x iteration count. This is why this is better suited for determining which of two or more functions is the fastest, rather than finding out how fast is a single function.
public static timeFunc ( integer $iterations, callable $function, &$output = null ) : double
$iterations integer Number of times the function will be executed
$function callable Function to execute
Результат double Elapsed time

timer() публичный статический Метод

First call of this function will start the timer. The second call will stop the timer and return the elapsed time since the timer started. Multiple timers can be controlled simultaneously by specifying a timer ID.
С версии: 1.0
public static timer ( integer $id = 1, integer $precision = 4 ) : void | double
$id integer Timer ID, optional
$precision integer Precision of the result, optional
Результат void | double Elapsed time, or void if the timer was just started

Описание свойств

$config защищенное статическое свойство

protected static $config

$debug защищенное статическое свойство

protected static $debug

$env защищенное статическое свойство

protected static $env

$fmt защищенное свойство

protected $fmt

$startTime защищенное свойство

protected $startTime

$time защищенное статическое свойство

protected static $time

$timeout защищенное статическое свойство

protected static $timeout