EntityRepositoryManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 30
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\LaminasEntity\Service;
6
7
use Arp\DoctrineEntityRepository\EntityRepositoryInterface;
8
use Arp\DoctrineEntityRepository\EntityRepositoryProviderInterface;
9
use Laminas\ServiceManager\AbstractPluginManager;
10
11
/**
12
 * @author  Alex Patterson <[email protected]>
13
 * @package Arp\LaminasEntity\Service
14
 */
15
final class EntityRepositoryManager extends AbstractPluginManager implements EntityRepositoryProviderInterface
16
{
17
    /**
18
     * An object type that the created instance must be instanced of
19
     *
20
     * @var null|string
21
     */
22
    protected $instanceOf = EntityRepositoryInterface::class;
23
24
    /**
25
     * @param string $entityName
26
     *
27
     * @return bool
28
     */
29
    public function hasRepository(string $entityName): bool
30
    {
31
        return $this->has($entityName);
32
    }
33
34
    /**
35
     * @param string $entityName
36
     * @param array  $options
37
     *
38
     * @return EntityRepositoryInterface
39
     *
40
     * @throws \Throwable
41
     */
42
    public function getRepository(string $entityName, array $options = []): EntityRepositoryInterface
43
    {
44
        return $this->get($entityName, $options);
45
    }
46
}
47