| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class IncrementalDataDirGenerator implements DataDirGeneratorInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | private $baseDir; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string[] |
||
| 16 | */ |
||
| 17 | private $dirs = []; |
||
| 18 | |||
| 19 | public function __construct(string $baseDir) |
||
| 20 | { |
||
| 21 | while (substr($baseDir, -1) === "/") { |
||
| 22 | $baseDir = substr($baseDir, 0, -1); |
||
| 23 | } |
||
| 24 | |||
| 25 | $this->baseDir = $baseDir; |
||
| 26 | } |
||
| 27 | |||
| 28 | protected function getNextId(): string |
||
| 31 | } |
||
| 32 | |||
| 33 | public function createNextDir(): string |
||
| 34 | { |
||
| 35 | $this->dirs[] = $dataDir = "{$this->baseDir}/{$this->getNextId()}"; |
||
| 36 | return $dataDir; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getDirs(): array |
||
| 42 | } |
||
| 43 | } |
||
| 44 |