-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfig.php
More file actions
78 lines (65 loc) · 2.05 KB
/
Config.php
File metadata and controls
78 lines (65 loc) · 2.05 KB
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
<?php
declare(strict_types=1);
namespace Crmplease\Coder;
use function is_array;
use function is_bool;
use function is_callable;
/**
* @author Mougrim <rinat@mougrim.ru>
*/
class Config
{
protected $autoImport;
public function getAutoImport(): ?callable
{
if ($this->autoImport === null) {
return null;
}
if (is_bool($this->autoImport)) {
$autoImport = $this->autoImport;
$this->autoImport = static function () use ($autoImport): bool {
return $autoImport;
};
} elseif (is_array($this->autoImport) && !is_callable($this->autoImport)) {
$autoImportMap = $this->autoImport;
$this->autoImport = static function(string $file) use ($autoImportMap): ?bool {
return $autoImportMap[$file] ?? null;
};
}
return $this->autoImport;
}
/**
* @param callable|array|bool|null $autoImport if null, the use default value from rector.yaml;
* if true, the auto import will be always enabled;
* if false, the auto import will be always disabled;
* if array, they file name is used as key, value can be true/false/null;
* if callable then it will receive file name as first argument and should return true/false/null.
*
* @return $this
*/
public function setAutoImport($autoImport): self
{
$this->autoImport = $autoImport;
return $this;
}
protected $showProgressBar = true;
public function doShowProgressBar(): bool
{
return $this->showProgressBar;
}
public function setShowProgressBar(bool $showProgressBar): self
{
$this->showProgressBar = $showProgressBar;
return $this;
}
protected $rectorConfigPath = '';
public function getRectorConfigPath(): string
{
return $this->rectorConfigPath;
}
public function setRectorConfigPath(string $rectorConfigPath): self
{
$this->rectorConfigPath = $rectorConfigPath;
return $this;
}
}