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%
8 / 8
PackageParser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
8 / 8
 __construct(PHPParser_Parser $parser)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 parse(\Iterator $iter)
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
5 / 5
 createPhpFileNode(SplFileInfo $fch)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/*
 * Mondrian
 */
namespace Trismegiste\Mondrian\Parser;
use Symfony\Component\Finder\SplFileInfo;
use PHPParser_Parser;
/**
 * PackageParser is a parser for multiple files
 */
class PackageParser
{
    protected $fileParser;
    public function __construct(PHPParser_Parser $parser)
    {
        $this->fileParser = $parser;
    }
    public function parse(\Iterator $iter)
    {
        $node = array();
        foreach ($iter as $fch) {
            $node[] = $this->createPhpFileNode($fch);
        }
        return $node;
    }
    protected function createPhpFileNode(SplFileInfo $fch)
    {
        return new PhpFile($fch->getRealPath(), $this->fileParser->parse($fch->getContents()));
    }
}