Kahlan\Reporter\Coverage::stop PHP Method

stop() public method

Callback called at the end of the process.
public stop ( object $summary )
$summary object The execution summary instance.
    public function stop($summary)
    {
        $this->write("Coverage Summary\n----------------\n");
        $verbosity = $this->_verbosity;
        $metrics = is_numeric($this->_verbosity) ? $this->metrics() : $this->metrics()->get($verbosity);
        if (!$metrics) {
            $this->write("\nUnexisting namespace: `{$this->_verbosity}`, coverage can't be generated.\n\n", "n;yellow");
        }
        $this->_renderMetrics($metrics, $verbosity);
        $this->write("\n");
        if (is_string($verbosity)) {
            $this->_renderCoverage($metrics);
            $this->write("\n");
        }
        // Output the original stored metrics object (the total coverage)
        $name = $metrics->name();
        $stats = $metrics->data();
        $percent = number_format($stats['percent'], 2);
        $this->write(str_repeat('  ', substr_count($name, '\\')));
        $pos = strrpos($name, '\\');
        $basename = substr($name, $pos !== false ? $pos + 1 : 0);
        $this->write('Total: ');
        $this->write("{$percent}% ", $this->_style($percent));
        $this->write("({$stats['cloc']}/{$stats['lloc']})");
        $this->write("\n");
        // Output the time to collect coverage
        $time = number_format($this->_time, 3);
        $memory = $this->readableSize(memory_get_peak_usage() - $summary->memoryUsage());
        $this->write("\nCoverage collected in {$time} seconds (using an additionnal {$memory}o)\n\n\n");
    }