DocumentMutatorTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A document() 0 8 2
1
<?php declare(strict_types=1);
2
3
namespace Goose\Traits;
4
5
use DOMWrap\Document;
6
7
/**
8
 * Document Mutator Trait
9
 *
10
 * @package Goose\Traits
11
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
12
 */
13
trait DocumentMutatorTrait {
14
    /** @var Document|null */
15
    protected $document;
16
17
    /**
18
     * @param Document $document
19
     *
20
     * @return Document|null
21
     */
22
    protected function document(Document $document = null): ?Document {
23
        if ($document === null) {
24
            return $this->document;
25
        }
26
27
        $this->document = $document;
28
29
        return $this->document;
30
    }
31
}
32