Completed
Pull Request — master (#1984)
by Maciej
21:32
created

OnClearEventArgs::getDocumentClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB\Event;
6
7
use Doctrine\Common\Persistence\Event\OnClearEventArgs as BaseOnClearEventArgs;
8
use Doctrine\ODM\MongoDB\DocumentManager;
9
use function assert;
10
11
/**
12
 * Provides event arguments for the onClear event.
13
 */
14
final class OnClearEventArgs extends BaseOnClearEventArgs
15
{
16
    public function getDocumentManager() : DocumentManager
17
    {
18
        $dm = $this->getObjectManager();
19
        assert($dm instanceof DocumentManager);
20
        return $dm;
21
    }
22
23
    public function getDocumentClass() : ?string
24
    {
25
        return $this->getEntityClass();
26
    }
27
28
    /**
29
     * Returns whether this event clears all documents.
30
     */
31
    public function clearsAllDocuments() : bool
32
    {
33
        return $this->clearsAllEntities();
34
    }
35
}
36