No Description

generate.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of resource-operations.
  5. *
  6. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. $functions = require __DIR__ . '/arginfo.php';
  12. $resourceFunctions = [];
  13. foreach ($functions as $function => $arguments) {
  14. foreach ($arguments as $argument) {
  15. if ($argument == 'resource') {
  16. $resourceFunctions[] = $function;
  17. }
  18. }
  19. }
  20. $resourceFunctions = array_unique($resourceFunctions);
  21. sort($resourceFunctions);
  22. $buffer = <<<EOT
  23. <?php
  24. /*
  25. * This file is part of resource-operations.
  26. *
  27. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  28. *
  29. * For the full copyright and license information, please view the LICENSE
  30. * file that was distributed with this source code.
  31. */
  32. namespace SebastianBergmann\ResourceOperations;
  33. class ResourceOperations
  34. {
  35. /**
  36. * @return string[]
  37. */
  38. public static function getFunctions()
  39. {
  40. return [
  41. EOT;
  42. foreach ($resourceFunctions as $function) {
  43. $buffer .= sprintf(" '%s',\n", $function);
  44. }
  45. $buffer .= <<< EOT
  46. ];
  47. }
  48. }
  49. EOT;
  50. file_put_contents(__DIR__ . '/../src/ResourceOperations.php', $buffer);