/
Config.php
57 lines (51 loc) · 1.29 KB
/
Config.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
50
51
52
53
54
55
56
57
<?php
/**
* @author SignpostMarv
*/
namespace GoetasWebservices\CS;
use PhpCsFixer\Config as BaseConfig;
use PhpCsFixer\Finder as DefaultFinder;
class Config extends BaseConfig
{
const DEFAULT_RULES = [
'@Symfony' => true,
'yoda_style' => false,
];
public function __construct(array $inPaths)
{
parent::__construct(
str_replace(
'\\',
' - ',
preg_replace(
'/([a-z0-9])([A-Z])/',
'$1 $2',
static::class
)
)
);
$this->setUsingCache(true);
$this->setRules(static::DEFAULT_RULES);
/**
* @var DefaultFinder $finder
*/
$finder = $this->getFinder();
$this->setFinder(array_reduce(
$inPaths,
function (DefaultFinder $finder, $directory) {
if (is_file($directory) === true) {
return $finder->append([$directory]);
}
return $finder->in($directory);
},
$finder->ignoreUnreadableDirs()
));
}
/**
* Resolve rules at runtime.
*/
protected static function RuntimeResolveRules()
{
return static::DEFAULT_RULES;
}
}