Completed
Pull Request — master (#1984)
by Maciej
22:01
created

OnClearEventArgs::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A OnClearEventArgs::getDocumentClass() 0 4 1
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