Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
11 / 11
GraphLogger
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
11 / 11
 logCallTo($callee, $called)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getCallingDigest()
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
8 / 8
 getDigest()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/*
 * Mondrian
 */
namespace Trismegiste\Mondrian\Transform\Logger;
/**
 * GraphLogger logs the transform of source code to a graph
 */
class GraphLogger implements LoggerInterface
{
    protected $stack = array();
    /**
     * {@inheritdoc}
     */
    public function logCallTo($callee, $called)
    {
        $this->stack[$callee][$called] = true;
    }
    protected function getCallingDigest()
    {
        $report = array();
        ksort($this->stack);
        foreach ($this->stack as $callee => $calledLst) {
            $calledLst = array_keys($calledLst);
            sort($calledLst);
            $report[$callee] = array('ignore' => $calledLst);
        }
        return array('calling' => $report);
    }
    /**
     * Get the yml config
     * 
     * @return string the yaml-formatted full report
     */
    public function getDigest()
    {
        return array('graph' => $this->getCallingDigest());
    }
}