| Total Complexity | 3 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class RepositoryFactoryConfigurator |
||
| 14 | { |
||
| 15 | private $metadatas; |
||
| 16 | private $repositories; |
||
| 17 | |||
| 18 | 4 | public function __construct(Metadatas $metadatas) |
|
| 19 | { |
||
| 20 | 4 | $this->metadatas = $metadatas; |
|
| 21 | 4 | $this->repositories = new Map('string', Repository::class); |
|
| 22 | 4 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Register a newrepository for the given entity class |
||
| 26 | * |
||
| 27 | * @param string $class |
||
| 28 | * @param Repository $repository |
||
| 29 | * |
||
| 30 | * @return self |
||
| 31 | */ |
||
| 32 | 2 | public function register(string $class, Repository $repository): self |
|
| 33 | { |
||
| 34 | 2 | $this->repositories = $this->repositories->put($class, $repository); |
|
| 35 | |||
| 36 | 2 | return $this; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Inject registered repositories into the given repository factory |
||
| 41 | * |
||
| 42 | * @param RepositoryFactory $factory |
||
| 43 | * |
||
| 44 | * @return RepositoryFactory |
||
| 45 | */ |
||
| 46 | 4 | public function configure(RepositoryFactory $factory): RepositoryFactory |
|
| 63 | } |
||
| 64 | } |
||
| 65 |