forked from romanzipp/PHP-CS-Fixer-Config
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAbstractPreset.php
49 lines (36 loc) · 1 KB
/
AbstractPreset.php
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
<?php
namespace romanzipp\Fixer\Presets;
use PhpCsFixer\Finder;
abstract class AbstractPreset
{
abstract public function getRules(): array;
abstract protected function getFilePatterns(): array;
abstract protected function getExcludedDirectories(): array;
abstract protected function getExcludedFiles(): array;
protected function ignoreDotFiles(): bool
{
return true;
}
protected function ignoreVcs(): bool
{
return true;
}
public function populateFinder(Finder $finder): void
{
$finder->exclude(
$this->getExcludedDirectories()
);
foreach ($this->getFilePatterns() as $filePattern) {
$finder->name($filePattern);
}
foreach ($this->getExcludedFiles() as $excludedFile) {
$finder->notName($excludedFile);
}
$finder->ignoreDotFiles(
$this->ignoreDotFiles()
);
$finder->ignoreVCS(
$this->ignoreVcs()
);
}
}