/usr/share/php/TheSeer/Autoload/Collector.php is in phpab 1.16.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <?php
namespace TheSeer\Autoload {
use TheSeer\DirectoryScanner\PHPFilterIterator;
class Collector {
/**
* @var ParserInterface
*/
private $parser;
/**
* @var CollectorResult
*/
private $collectorResult;
/**
* @var bool
*/
private $tolerantMode;
/**
* @var bool
*/
private $paranoidMode;
/**
* @param ParserInterface $parser
* @param bool $tolerantMode
* @param bool $paranoidMode
*/
public function __construct(ParserInterface $parser, $tolerantMode = false, $paranoidMode = false, Array $whitelist = array('*'), Array $blacklist = array()) {
$this->parser = $parser;
$this->tolerantMode = $tolerantMode;
$this->paranoidMode = $paranoidMode;
$this->collectorResult = new CollectorResult($whitelist, $blacklist);
}
public function getResult() {
return $this->collectorResult;
}
public function processDirectory(\Iterator $sources) {
$worker = $this->paranoidMode ? new PHPFilterIterator($sources) : $sources;
foreach($worker as $file) {
try {
$parseResult = $this->parser->parse(new SourceFile($file->getRealpath()));
if ($parseResult->hasRedeclarations() && !$this->tolerantMode) {
throw new CollectorException(
sprintf(
"Duplicate (potentially conditional) definitions of the following unit(s) found:\n\n\tUnit(s): %s\n\tFile: %s",
join(', ', $parseResult->getRedeclarations()),
$file->getRealPath()
),
CollectorException::InFileRedeclarationFound
);
}
$this->collectorResult->addParseResult($file, $parseResult);
} catch(ParserException $e) {
throw new CollectorException(
sprintf(
"Could not process file '%s' due to parse errors",
$file->getRealPath()
),
CollectorException::ParseErrror,
$e
);
} catch(CollectorResultException $e) {
throw new CollectorException(
$e->getMessage(),
CollectorException::RedeclarationFound
);
}
}
}
}
class CollectorException extends \Exception {
const ParseErrror = 1;
const RedeclarationFound = 2;
const InFileRedeclarationFound = 3;
}
}
|