Failed Conditions
Pull Request — master (#1)
by Jonathan
13:22 queued 10:46
created

OnClearEventArgs::getEntityClass()   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 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace Doctrine\Common\Persistence\Event;
3
4
use Doctrine\Common\EventArgs;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\EventArgs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Doctrine\Common\Persistence\ObjectManager;
6
7
/**
8
 * Provides event arguments for the onClear event.
9
 *
10
 * @link   www.doctrine-project.org
11
 * @since  2.2
12
 * @author Roman Borschel <[email protected]>
13
 * @author Benjamin Eberlei <[email protected]>
14
 */
15
class OnClearEventArgs extends EventArgs
16
{
17
    /**
18
     * @var \Doctrine\Common\Persistence\ObjectManager
19
     */
20
    private $objectManager;
21
22
    /**
23
     * @var string|null
24
     */
25
    private $entityClass;
26
27
    /**
28
     * Constructor.
29
     *
30
     * @param ObjectManager $objectManager The object manager.
31
     * @param string|null   $entityClass   The optional entity class.
32
     */
33
    public function __construct($objectManager, $entityClass = null)
34
    {
35
        $this->objectManager = $objectManager;
36
        $this->entityClass   = $entityClass;
37
    }
38
39
    /**
40
     * Retrieves the associated ObjectManager.
41
     *
42
     * @return \Doctrine\Common\Persistence\ObjectManager
43
     */
44
    public function getObjectManager()
45
    {
46
        return $this->objectManager;
47
    }
48
49
    /**
50
     * Returns the name of the entity class that is cleared, or null if all are cleared.
51
     *
52
     * @return string|null
53
     */
54
    public function getEntityClass()
55
    {
56
        return $this->entityClass;
57
    }
58
59
    /**
60
     * Returns whether this event clears all entities.
61
     *
62
     * @return bool
63
     */
64
    public function clearsAllEntities()
65
    {
66
        return ($this->entityClass === null);
67
    }
68
}
69