RepositoryManager::getRepository()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
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