-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoboFile.php
More file actions
51 lines (45 loc) · 1.51 KB
/
RoboFile.php
File metadata and controls
51 lines (45 loc) · 1.51 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
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
define('PROJECT_ROOT', __DIR__);
class RoboFile extends \Robo\Tasks
{
use \GreenCape\Robo\Command\TestCommands;
use \GreenCape\Robo\Command\CodeSnifferCommands;
use \GreenCape\Robo\Command\QACommands;
/**
* Show the current configuration settings
*
* @param string $subset Restrict the output to configuration values for a specific section
*/
public function showConfig($subset = null, $options = [])
{
$pattern = empty($subset) ? '~^RoboFile\.(.*)$~' : $pattern = '~^RoboFile(\.' . $subset . '\..*)$~i';
if ($options['no-ansi']) {
$formatA = $formatB = "%-32s %s";
} else {
$formatA = "<fg=yellow>%-32s</fg=yellow> <fg=green>%s</fg=green>";
$formatB = "<fg=yellow>%-32s</fg=yellow> %s";
}
$config = new ReflectionProperty('\Robo\Config', 'config');
$config->setAccessible(true);
foreach ($config->getValue() as $key => $value) {
if (!preg_match($pattern, $key, $match)) {
continue;
}
$format = $formatA;
if (!is_scalar($value)) {
$value = gettype($value);
$format = $formatB;
}
if (empty($value)) {
$value = 'not set';
$format = $formatB;
}
$this->say(sprintf($format, $match[1], $value));
}
}
}