Failed Conditions
Pull Request — release-11.1.x (#3164)
by
unknown
17:11
created

DomainObjectObserverRegistry::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace ApacheSolrForTypo3\Solr\IndexQueue;
3
4
/**
5
 * DomainObject observer registry
6
 */
7
class DomainObjectObserverRegistry implements \TYPO3\CMS\Core\SingletonInterface
8
{
9
10
    /**
11
     * @var array
12
     */
13
    protected $domainObjectClassNames = [];
14
15
    /**
16
     *
17
     * @param string $domainObjectClassName
18
     */
19
    public function register(
20
        $domainObjectClassName
21
    ) {
22
        if (!is_subclass_of($domainObjectClassName, \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject::class)) {
23
            throw new \LogicException($domainObjectClassName . ' must be a subclass of AbstractDomainObject', 1519394042);
24
        }
25
26
        $this->domainObjectClassNames[$domainObjectClassName] = $domainObjectClassName;
27
    }
28
29
    /**
30
     * @param string $domainObjectClassName
31
     * @return bool
32
     */
33
    public function isRegistered($domainObjectClassName)
34
    {
35
        return isset($this->domainObjectClassNames[$domainObjectClassName]);
36
    }
37
38
    /**
39
     *
40
     * @return array
41
     */
42
    public function getAll()
43
    {
44
        return $this->domainObjectClassNames;
45
    }
46
}
47