Completed
Push — master ( 5e4ebc...f96e76 )
by Florian
13s queued 11s
created

HideTrait::hide()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the vseth-semesterly-reports project.
5
 *
6
 * (c) Florian Moser <[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
namespace App\Entity\Traits;
13
14
use DateTime;
15
use Doctrine\ORM\Mapping as ORM;
16
use Exception;
17
18
/*
19
 * automatically keeps track of creation time & last change time
20
 */
21
22
trait HideTrait
23
{
24
    /**
25
     * @var \DateTime
26
     *
27
     * @ORM\Column(type="datetime", nullable=true)
28
     */
29
    private $hiddenAt;
30
31
    /**
32
     * @throws Exception
33
     */
34
    public function hide()
35
    {
36
        $this->hiddenAt = new DateTime();
37
    }
38
39
    /**
40
     * @throws Exception
41
     */
42
    public function unhide()
43
    {
44
        $this->hiddenAt = null;
45
    }
46
47
    /**
48
     * @return DateTime|null
49
     */
50
    public function getHiddenAt()
51
    {
52
        return $this->hiddenAt;
53
    }
54
}
55