Completed
Push — 2.0 ( c26230...1f3cee )
by Paweł
09:48 queued 11s
created

SoftDeletableTrait::setDeletedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the Superdesk Web Publisher Common Component.
4
 *
5
 * Copyright 2016 Sourcefabric z.ú. and contributors.
6
 *
7
 * For the full copyright and license information, please see the
8
 * AUTHORS and LICENSE files distributed with this source code.
9
 *
10
 * @copyright 2016 Sourcefabric z.ú
11
 * @license http://www.superdesk.org/license
12
 */
13
14
namespace SWP\Component\Common\Model;
15
16
trait SoftDeletableTrait
17
{
18
    protected $deletedAt;
19
20
    public function getDeletedAt(): ?\DateTimeInterface
21
    {
22
        return $this->deletedAt;
23
    }
24
25
    public function setDeletedAt(\DateTime $deletedAt = null): void
26
    {
27
        $this->deletedAt = $deletedAt;
28
    }
29
30
    public function isDeleted(): bool
31
    {
32
        return null !== $this->deletedAt;
33
    }
34
35
    public function restore(): void
36
    {
37
        $this->deletedAt = null;
38
    }
39
}
40