function FileList::__construct
Constructs a file list and loads in an array of file paths to process.
Parameters
\PHP_CodeSniffer\Config $config The config data for the run.:
\PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.:
Return value
void
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Files/ FileList.php, line 74
Class
Namespace
PHP_CodeSniffer\FilesCode
public function __construct(Config $config, Ruleset $ruleset) {
$this->ruleset = $ruleset;
$this->config = $config;
$paths = $config->files;
foreach ($paths as $path) {
$isPharFile = Common::isPharFile($path);
if (is_dir($path) === true || $isPharFile === true) {
if ($isPharFile === true) {
$path = 'phar://' . $path;
}
$filterClass = $this->getFilterClass();
$di = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS);
$filter = new $filterClass($di, $path, $config, $ruleset);
$iterator = new RecursiveIteratorIterator($filter);
foreach ($iterator as $file) {
$this->files[$file->getPathname()] = null;
$this->numFiles++;
}
}
else {
$this->addFile($path);
}
//end if
}
//end foreach
reset($this->files);
}