PHP Class Kahlan\Reporter\Coverage

Inheritance: extends Kahlan\Reporter\Terminal
Datei anzeigen Open project: crysalead/kahlan

Protected Properties

Property Type Description
$_classes array Class dependencies.
$_collector Reference to the coverage collector driver.
$_enabled array Status of the reporter.
$_prefixes array Store prefix by level for tree rendering.
$_time float Collect time.
$_verbosity The coverage verbosity.

Public Methods

Method Description
__call ( string $name, array $args ) : mixed Delegates the call to the collector instance.
__construct ( array $config = [] ) The Constructor.
collector ( ) : object Gets the collector.
disable ( ) Disables this reporter.
enable ( ) Gets this reporter.
enabled ( ) : boolean Gets the status of the reporter.
metrics ( ) Gets the metrics about the coverage result.
specEnd ( object $log = null ) Callback called after a spec execution.
specStart ( object $spec = null ) Callback called on a spec start.
start ( array $args ) Callback called before any specs processing.
stop ( object $summary ) Callback called at the end of the process.

Protected Methods

Method Description
_getMetricsReport ( Metrics[] $children, $verbosity, array $depth, array $tab = 3, array &$maxWidth = null ) Extract some metrics reports to display according to a verbosity parameter.
_renderCoverage ( Metrics $metrics ) Outputs the coverage report of a metrics instance.
_renderMetrics ( Metrics $metrics, $verbosity ) Outputs some metrics info where the metric is not the total coverage.
_renderMetricsReport ( array $metricsReport, array $labelWidth, array $lineWidth, array $depth ) Outputs some metrics reports built using ::_getMetricsReport().
_style ( integer $percent ) Helper determinig a color from a coverage rate.

Method Details

__call() public method

Delegates the call to the collector instance.
public __call ( string $name, array $args ) : mixed
$name string The function name.
$args array The arguments to pass to the function.
return mixed

__construct() public method

The Constructor.
public __construct ( array $config = [] )
$config array The config for the reporter, the options are: - `'verbosity`' _integer|string_: The verbosity level: - 1 : overall coverage value for the whole code. - 2 : overall coverage by namespaces. - 3 : overall coverage by classes. - 4 : overall coverage by methods and functions. - string : coverage for a fully namespaced (class/method/namespace) string.

_getMetricsReport() protected method

Extract some metrics reports to display according to a verbosity parameter.
protected _getMetricsReport ( Metrics[] $children, $verbosity, array $depth, array $tab = 3, array &$maxWidth = null )
$children Metrics[] A array of metrics.
$depth array The actual depth in the reporting.
$tab array The size of the tab used for lablels.
$maxWidth array Will contain the maximum width obtained for labels.

_renderCoverage() protected method

Outputs the coverage report of a metrics instance.
protected _renderCoverage ( Metrics $metrics )
$metrics Metrics A metrics instance.

_renderMetrics() protected method

Outputs some metrics info where the metric is not the total coverage.
protected _renderMetrics ( Metrics $metrics, $verbosity )
$metrics Metrics A metrics instance.

_renderMetricsReport() protected method

Outputs some metrics reports built using ::_getMetricsReport().
protected _renderMetricsReport ( array $metricsReport, array $labelWidth, array $lineWidth, array $depth )
$metricsReport array An array of nested metrics reports extracted according some verbosity.
$labelWidth array The width column of the label column used for padding.
$lineWidth array The width column of the covered lines data used for padding.
$depth array The actual depth in the reporting to build tree prefix.

_style() protected method

Helper determinig a color from a coverage rate.
protected _style ( integer $percent )
$percent integer The coverage rate in percent.

collector() public method

Gets the collector.
public collector ( ) : object
return object

disable() public method

Disables this reporter.
public disable ( )

enable() public method

Gets this reporter.
public enable ( )

enabled() public method

Gets the status of the reporter.
public enabled ( ) : boolean
return boolean $active

metrics() public method

Gets the metrics about the coverage result.
public metrics ( )

specEnd() public method

Callback called after a spec execution.
public specEnd ( object $log = null )
$log object The log object of the whole spec.

specStart() public method

Callback called on a spec start.
public specStart ( object $spec = null )
$spec object The spec object of the whole spec.

start() public method

Callback called before any specs processing.
public start ( array $args )
$args array The suite arguments.

stop() public method

Callback called at the end of the process.
public stop ( object $summary )
$summary object The execution summary instance.

Property Details

$_classes protected_oe static_oe property

Class dependencies.
protected static array $_classes
return array

$_collector protected_oe property

Reference to the coverage collector driver.
protected $_collector

$_enabled protected_oe property

Status of the reporter.
protected array $_enabled
return array

$_prefixes protected_oe property

Store prefix by level for tree rendering.
protected array $_prefixes
return array

$_time protected_oe property

Collect time.
protected float $_time
return float

$_verbosity protected_oe property

The coverage verbosity.
protected $_verbosity