PHP Class PhpBench\Formatter\Formatter

Afficher le fichier Open project: dantleech/phpbench Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( FormatRegistry $registry, ClassLoader $loader = null )
applyClasses ( array $classNames, string $value, array $params = [] ) : string Apply the a set of classes (indicated by $classNames) to the given value.
classesFromFile ( string $filename ) Register classes from a given JSON encoded class definition file.
registerClass ( string $name, array $formatDefinitions ) Register a single class with its format definitions.
registerClasses ( array $classDefinitions ) Register class definitions.

Private Methods

Méthode Description
substituteTokens ( array $formatConfig, $params )

Method Details

__construct() public méthode

public __construct ( FormatRegistry $registry, ClassLoader $loader = null )
$registry FormatRegistry
$loader ClassLoader

applyClasses() public méthode

Parameters can be given: parameters are used to replcae any tokens used in the format options; this is required when options should be overridden on a per-subject basis.
public applyClasses ( array $classNames, string $value, array $params = [] ) : string
$classNames array
$value string
$params array
Résultat string

classesFromFile() public méthode

Register classes from a given JSON encoded class definition file.
public classesFromFile ( string $filename )
$filename string

registerClass() public méthode

Each format definition should be of the form: [ $formatterName, { $options1 => $value 1 } ] i.e. a 2 element tuple with a scalar (the name of the formatter) and an associative array of formatter options.
public registerClass ( string $name, array $formatDefinitions )
$name string
$formatDefinitions array

registerClasses() public méthode

Class definitions have the form $className => (array) $formatDefinitions
public registerClasses ( array $classDefinitions )
$classDefinitions array