Failed Conditions
Push — master ( 3a6c46...2fbe69 )
by Luís
36s queued 11s
created

OnClearEventArgs   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 46
rs 10
c 0
b 0
f 0
ccs 0
cts 16
cp 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getObjectManager() 0 3 1
A clearsAllEntities() 0 3 1
A getEntityClass() 0 3 1
1
<?php
2
3
namespace Doctrine\Persistence\Event;
4
5
use Doctrine\Common\EventArgs;
6
use Doctrine\Persistence\ObjectManager;
7
8
/**
9
 * Provides event arguments for the onClear event.
10
 */
11
class OnClearEventArgs extends EventArgs
12
{
13
    /** @var ObjectManager */
14
    private $objectManager;
15
16
    /** @var string|null */
17
    private $entityClass;
18
19
    /**
20
     * @param ObjectManager $objectManager The object manager.
21
     * @param string|null   $entityClass   The optional entity class.
22
     */
23
    public function __construct($objectManager, $entityClass = null)
24
    {
25
        $this->objectManager = $objectManager;
26
        $this->entityClass   = $entityClass;
27
    }
28
29
    /**
30
     * Retrieves the associated ObjectManager.
31
     *
32
     * @return ObjectManager
33
     */
34
    public function getObjectManager()
35
    {
36
        return $this->objectManager;
37
    }
38
39
    /**
40
     * Returns the name of the entity class that is cleared, or null if all are cleared.
41
     *
42
     * @return string|null
43
     */
44
    public function getEntityClass()
45
    {
46
        return $this->entityClass;
47
    }
48
49
    /**
50
     * Returns whether this event clears all entities.
51
     *
52
     * @return bool
53
     */
54
    public function clearsAllEntities()
55
    {
56
        return $this->entityClass === null;
57
    }
58
}
59