1 | <?php |
||
13 | class Build implements IBuild |
||
14 | { |
||
15 | |||
16 | protected $container; |
||
17 | |||
18 | protected $arguments; |
||
19 | |||
20 | |||
21 | 14 | public function __construct(Config\Container $container, array $arguments = NULL) |
|
26 | |||
27 | |||
28 | 9 | public function setup() |
|
29 | { |
||
30 | 9 | } |
|
31 | |||
32 | |||
33 | 3 | public function runDefault() |
|
44 | |||
45 | |||
46 | 3 | protected function detectAvailableTasks() |
|
47 | { |
||
48 | 3 | $tasks = []; |
|
49 | 3 | $classReflection = new \ReflectionClass($this); |
|
50 | 3 | foreach ($classReflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { |
|
51 | 3 | if (preg_match('#^run(.*)#', $method->name, $match)) { |
|
52 | 3 | $doc = $method->getDocComment(); |
|
53 | 3 | $section = NULL; |
|
54 | 3 | if (preg_match('#@section ?([^\s]*)\s#s', $doc, $m)) { |
|
55 | 3 | $section = trim($m[1]); |
|
56 | 3 | } |
|
57 | 3 | $description = NULL; |
|
58 | 3 | if (preg_match('#([^@][a-zA-Z0-9]+)+#', $doc, $m)) { |
|
59 | 3 | $description = trim($m[0]); |
|
60 | 3 | } |
|
61 | 3 | $tasks[$section][lcfirst($match[1])] = $description != '' ? $description : NULL; |
|
62 | 3 | } |
|
63 | 3 | } |
|
64 | 3 | return $tasks; |
|
65 | } |
||
66 | |||
67 | |||
68 | 1 | protected function error($message) |
|
72 | |||
73 | |||
74 | 3 | protected function logSection($message) |
|
78 | |||
79 | |||
80 | 8 | protected function log($message) |
|
84 | |||
85 | } |