RepositoryManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
eloc 5
c 4
b 0
f 1
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRepository() 0 3 1
A hasRepository() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine\Repository;
6
7
use Arp\Entity\EntityInterface;
8
use Laminas\ServiceManager\AbstractPluginManager;
9
use Laminas\ServiceManager\Exception\InvalidServiceException;
10
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
11
12
/**
13
 * @extends AbstractPluginManager<EntityRepositoryInterface>
14
 */
15
final class RepositoryManager extends AbstractPluginManager implements EntityRepositoryProviderInterface
16
{
17
    protected $autoAddInvokableClass = false;
18
19
    /**
20
     * @var class-string<EntityRepositoryInterface<EntityInterface>>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<EntityRepos...rface<EntityInterface>> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<EntityRepositoryInterface<EntityInterface>>.
Loading history...
21
     */
22
    protected $instanceOf = EntityRepositoryInterface::class;
23
24
    public function hasRepository(string $entityName): bool
25
    {
26
        return $this->has($entityName);
27
    }
28
29
    /**
30
     * @param array<string, mixed> $options
31
     *
32
     * @return EntityRepositoryInterface<EntityInterface>
33
     *
34
     * @throws InvalidServiceException
35
     * @throws ServiceNotFoundException
36
     */
37
    public function getRepository(string $entityName, array $options = []): EntityRepositoryInterface
38
    {
39
        return $this->get($entityName, $options);
40
    }
41
}
42