RoboFile.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. require_once 'vendor/autoload.php';
  3. /**
  4. * This is project's console commands configuration for Robo task runner.
  5. *
  6. * @see http://robo.li/
  7. */
  8. class RoboFile extends \Robo\Tasks
  9. {
  10. protected $docs = [
  11. 'docs/Stub.md' => 'Codeception\Stub',
  12. 'docs/Expected.md' => 'Codeception\Stub\Expected',
  13. 'docs/StubTrait.md' => 'Codeception\Test\Feature\Stub',
  14. ];
  15. public function docs()
  16. {
  17. foreach ($this->docs as $file => $class) {
  18. if (!class_exists($class, true) && !trait_exists($class, true)) {
  19. throw new Exception('ups');
  20. }
  21. $this->say("Here goes, $class");
  22. $this->taskGenDoc($file)
  23. ->docClass($class)
  24. ->filterMethods(function(\ReflectionMethod $method) {
  25. if ($method->isConstructor() or $method->isDestructor()) return false;
  26. if (!$method->isPublic()) return false;
  27. if (strpos($method->name, '_') === 0) return false;
  28. if (strpos($method->name, 'stub') === 0) return false;
  29. return true;
  30. })
  31. ->processMethodDocBlock(
  32. function (\ReflectionMethod $m, $doc) {
  33. $doc = str_replace(array('@since'), array(' * available since version'), $doc);
  34. $doc = str_replace(array(' @', "\n@"), array(" * ", "\n * "), $doc);
  35. return $doc;
  36. })
  37. ->processProperty(false)
  38. ->run();
  39. }
  40. }
  41. }