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

SoftDeletableTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeletedAt() 0 4 1
A setDeletedAt() 0 4 1
A isDeleted() 0 4 1
A restore() 0 4 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