Passed
Push — master ( 9f5a4d...eb071b )
by Jan
04:08
created

ElementEditedLogEntry   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
7
 *
8
 * Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
23
 */
24
25
namespace App\Entity\LogSystem;
26
27
use App\Entity\Base\AbstractDBElement;
28
use Doctrine\ORM\Mapping as ORM;
29
30
/**
31
 * @ORM\Entity()
32
 */
33
class ElementEditedLogEntry extends AbstractLogEntry
34
{
35
    protected $typeString = 'element_edited';
36
37
    public function __construct(AbstractDBElement $changed_element)
38
    {
39
        parent::__construct();
40
        $this->level = self::LEVEL_INFO;
41
42
        $this->setTargetElement($changed_element);
43
    }
44
45
    /**
46
     * Returns the message associated with this edit change.
47
     *
48
     * @return string
49
     */
50
    public function getMessage(): string
51
    {
52
        return $this->extra['m'] ?? '';
53
    }
54
}
55