PHP Class ref, php-ref

Author: digitalnature - http://digitalnature.eu
Afficher le fichier Open project: digitalnature/php-ref Class Usage Examples

Protected Properties

Свойство Type Description
$config
$debug
$env
$fmt
$startTime
$time
$timeout

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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

Method Details

__construct() public méthode

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

__get() public méthode

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

__set() public méthode

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

config() public static méthode

Set or get configuration options
public static config ( string $key, mixed | null $value = null ) : mixed
$key string
$value mixed | null
Résultat mixed

evaluate() protected méthode

Evaluates the given variable
protected evaluate ( &$subject, boolean $specialStr = false ) : mixed
$specialStr boolean Should this be interpreted as a special string?
Résultat mixed Result (both HTML and text modes generate strings)

evaluateExp() protected méthode

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
Résultat string Formatted output

fromReflector() protected méthode

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)
Résultat string

getBacktrace() public static méthode

Get relevant backtrace info for last ref call
public static getBacktrace ( ) : array | false
Résultat array | false

getDebugInfo() public static méthode

public static getDebugInfo ( )

getInputExpressions() public static méthode

Determines the input expression(s) passed to the shortcut function
public static getInputExpressions ( array &$options = null ) : array
$options array
Résultat array Array of string expressions

getParentClasses() protected static méthode

Get all parent classes of a class
protected static getParentClasses ( Reflector $class ) : array
$class Reflector Reflection object
Résultat array Array of ReflectionClass objects (starts with the ancestor, ends with the given class)

getTime() public static méthode

Total CPU time used by the class
public static getTime ( $precision = 4 ) : double
Résultat double

getTimeoutPoint() public static méthode

public static getTimeoutPoint ( )

hasInstanceTimedOut() protected méthode

protected hasInstanceTimedOut ( )

linkify() protected méthode

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
Résultat string | null URL

parseComment() public static méthode

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)
Résultat 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() public méthode

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

splitRegex() public static méthode

Based on "Regex Colorizer" by Steven Levithan (this is a translation from javascript)
public static splitRegex ( string $pattern ) : array
$pattern string
Résultat array

strLen() protected static méthode

Calculates real string length
protected static strLen ( string $string ) : integer
$string string
Résultat integer

strPad() protected static méthode

Safe str_pad alternative
protected static strPad ( $input, integer $padLen, string $padStr = ' ', integer $padType = STR_PAD_RIGHT ) : string
$padLen integer
$padStr string
$padType integer
Résultat string

timeFunc() public static méthode

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
Résultat double Elapsed time

timer() public static méthode

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.
Since: 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
Résultat void | double Elapsed time, or void if the timer was just started

Property Details

$config protected_oe static_oe property

protected static $config

$debug protected_oe static_oe property

protected static $debug

$env protected_oe static_oe property

protected static $env

$fmt protected_oe property

protected $fmt

$startTime protected_oe property

protected $startTime

$time protected_oe static_oe property

protected static $time

$timeout protected_oe static_oe property

protected static $timeout