-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
58 lines (49 loc) · 1.72 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
58
<?php
use \Symfony\Component\Yaml\Yaml;
class WP_Beautiful_Config
{
private $_finder;
public function __construct()
{
$this->_finder = \PhpCsFixer\Finder::create()
->exclude('wp-content/plugins')
->notPath('wp-config.php')
;
if (file_exists('wp-cli.yml')) {
$config_env = Yaml::parse(file_get_contents('wp-cli.yml'));
if (!empty($config_env['php-fixer']['excludes'])) {
$excludes = $config_env['php-fixer']['excludes'];
if (!empty($excludes['files'])) {
foreach ($excludes['files'] as $filename) {
$this->_finder = $this->_finder->notPath($filename);
}
}
if (!empty($excludes['folders'])) {
foreach ($excludes['folders'] as $folder) {
$this->_finder = $this->_finder->exclude($folder);
}
}
}
}
}
public function exportConfig()
{
return \PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'single_quote' => true,
'trim_array_spaces' => true,
'no_useless_else' => true,
'elseif' => true,
'binary_operator_spaces' => array(
'align_double_arrow' => true,
'align_equals' => true
)
])
->setUsingCache(false)
->setFinder($this->_finder)
;
}
}
$config = new WP_Beautiful_Config();
return $config->exportConfig();