| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class IdRegistry implements IdHandlerInterface |
||
| 9 | { |
||
| 10 | private $ids = []; |
||
| 11 | /** |
||
| 12 | * @var \Faker\Generator |
||
| 13 | */ |
||
| 14 | private $faker; |
||
| 15 | |||
| 16 | public function __construct() |
||
| 19 | } |
||
| 20 | |||
| 21 | public function generateStringId(string $entity): string |
||
| 26 | } |
||
| 27 | |||
| 28 | public function generateIntId(string $entity, bool $increment): int |
||
| 29 | { |
||
| 30 | if ($increment) { |
||
| 31 | $this->ids[$entity] = isset($this->ids[$entity]) ? ++$this->ids[$entity] : 1; |
||
| 32 | } else { |
||
| 33 | $this->ids[$entity] = $this->faker->unique()->numberBetween(0,100); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $this->ids[$entity]; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param string $entity |
||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | public function getId(string $entity) |
||
| 46 | } |
||
| 47 | } |
||
| 48 |