-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathRoboFile.php
47 lines (43 loc) · 1.59 KB
/
RoboFile.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
<?php
declare(strict_types=1);
use Robo\Tasks;
require_once 'vendor/autoload.php';
/**
* This is project's console commands configuration for Robo task runner.
*
* @see https://robo.li/
*/
class RoboFile extends Tasks
{
protected $docs = [
'docs/Stub.md' => 'Codeception\Stub',
'docs/Expected.md' => 'Codeception\Stub\Expected',
'docs/StubTrait.md' => 'Codeception\Test\Feature\Stub',
];
public function docs()
{
foreach ($this->docs as $file => $class) {
if (!class_exists($class, true) && !trait_exists($class, true)) {
throw new Exception('ups');
}
$this->say("Here goes, $class");
$this->taskGenDoc($file)
->docClass($class)
->filterMethods(function(ReflectionMethod $method) {
if ($method->isConstructor() or $method->isDestructor()) return false;
if (!$method->isPublic()) return false;
if (strpos($method->name, '_') === 0) return false;
if (strpos($method->name, 'stub') === 0) return false;
return true;
})
->processMethodDocBlock(
function (ReflectionMethod $m, $doc) {
$doc = str_replace(array('@since'), array(' * available since version'), $doc);
$doc = str_replace(array(' @', "\n@"), array(" * ", "\n * "), $doc);
return $doc;
})
->processProperty(false)
->run();
}
}
}