SectionHistory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 2
b 0
f 0
dl 0
loc 37
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setSection() 0 5 1
A setVersioned() 0 5 1
A getSection() 0 3 1
A getVersioned() 0 3 1
A removeSection() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the SexyField package.
5
 *
6
 * (c) Dion Snoeijen <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare (strict_types = 1);
13
14
namespace Tardigrades\Entity;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\Common\Collections\Collection;
18
use Tardigrades\SectionField\ValueObject\Created;
19
use Tardigrades\SectionField\ValueObject\Handle;
20
use Tardigrades\SectionField\ValueObject\Id;
21
use Tardigrades\SectionField\ValueObject\Name;
22
use Tardigrades\SectionField\ValueObject\SectionConfig;
23
use Tardigrades\SectionField\ValueObject\Updated;
24
use Tardigrades\SectionField\ValueObject\Version;
25
use Tardigrades\SectionField\ValueObject\Versioned;
26
27
class SectionHistory extends SectionBase implements SectionInterface, SectionHistoryInterface
28
{
29
    /** @var SectionInterface|null */
30
    private $section;
31
32
    /** @var \DateTime */
33
    protected $versioned;
34
35
    public function getVersioned(): Versioned
36
    {
37
        return Versioned::fromDateTime($this->versioned);
38
    }
39
40
    public function setVersioned(\DateTime $versioned): SectionHistoryInterface
41
    {
42
        $this->versioned = $versioned;
43
44
        return $this;
45
    }
46
47
    public function setSection(SectionInterface $section): SectionHistoryInterface
48
    {
49
        $this->section = $section;
50
51
        return $this;
52
    }
53
54
    public function getSection(): ?SectionInterface
55
    {
56
        return $this->section;
57
    }
58
59
    public function removeSection(): SectionHistoryInterface
60
    {
61
        $this->section = null;
62
63
        return $this;
64
    }
65
}
66