| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 1 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 1 | public function getGenerator(string $scheme = '*') : \Generator |
|
| 44 | { |
||
| 45 | foreach ($this->getResourceListGenerator() as list($class, $file)) { |
||
| 46 | $paths = explode('\\', $class); |
||
| 47 | $path = array_slice($paths, 3); |
||
| 48 | array_walk($path, [$this, 'camel2kebab']); |
||
| 49 | if ($scheme === '*') { |
||
| 50 | $uri = sprintf('%s://self/%s', $path[0], implode('/', array_slice($path, 1))); |
||
| 51 | |||
| 52 | yield new ResMeta($uri, $class, $file); |
||
| 53 | } |
||
| 54 | if ($scheme === $path[0]) { |
||
| 55 | $uri = sprintf('/%s', implode('/', array_slice($path, 1))); |
||
| 56 | |||
| 57 | yield new ResMeta($uri, $class, $file); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 67 |