GroupedEndpointsFromCamelDir.php 742 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Knuckles\Scribe\GroupedEndpoints;
  3. use Knuckles\Camel\Camel;
  4. use Knuckles\Scribe\Configuration\PathConfig;
  5. class GroupedEndpointsFromCamelDir implements GroupedEndpointsContract
  6. {
  7. public function __construct(protected PathConfig $paths)
  8. {
  9. }
  10. public function get(): array
  11. {
  12. if (!is_dir(Camel::camelDir($this->paths))) {
  13. throw new \InvalidArgumentException(
  14. "Can't use --no-extraction because there are no endpoints in the " . Camel::camelDir($this->paths) . " directory."
  15. );
  16. }
  17. return Camel::loadEndpointsIntoGroups(Camel::camelDir($this->paths));
  18. }
  19. public function hasEncounteredErrors(): bool
  20. {
  21. return false;
  22. }
  23. }