AbstractBuilding::getType()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
1
<?php
2
3
/**
4
 * Copyright (c) 2016 Francois-Xavier Soubirou.
5
 *
6
 * This file is part of eco4.
7
 *
8
 * eco4 is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * eco4 is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with eco4. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace AppBundle\Entity;
24
25
use DateTime;
26
use Doctrine\ORM\Mapping as ORM;
27
28
/**
29
 * Building abstract entity class.
30
 *
31
 * @category  Eco4 App
32
 *
33
 * @author    Francois-Xavier Soubirou <[email protected]>
34
 * @copyright 2016 Francois-Xavier Soubirou
35
 * @license   http://www.gnu.org/licenses/   GPLv3
36
 *
37
 * @link      https://www.eco4.io
38
 */
39
abstract class AbstractBuilding
40
{
41
    /**
42
     * @var int
43
     *
44
     * @ORM\Column(name="id", type="integer")
45
     * @ORM\Id
46
     * @ORM\GeneratedValue(strategy="AUTO")
47
     */
48
    protected $id;
49
50
    /**
51
     * @var int
52
     *
53
     * @ORM\Column(name="level", type="smallint")
54
     */
55
    protected $level;
56
57
    /**
58
     * @var \DateTime
59
     *
60
     * @ORM\Column(name="lastUpdate", type="datetime")
61
     */
62
    protected $lastUpdate;
63
64
    /**
65
     * Get id.
66
     *
67
     * @return int
68
     */
69
    public function getId(): int
70
    {
71
        return $this->id;
72
    }
73
74
    /**
75
     * Upgrade level of mine.
76
     *
77
     * @return Building
78
     */
79
    public function upgrade(): AbstractBuilding
80
    {
81
        ++$this->level;
82
83
        return $this;
84
    }
85
86
    /**
87
     * Set level.
88
     *
89
     * @param int $level
90
     *
91
     * @return Building
92
     */
93
    public function setLevel(int $level): AbstractBuilding
94
    {
95
        $this->level = $level;
96
97
        return $this;
98
    }
99
100
    /**
101
     * Get level.
102
     *
103
     * @return int
104
     */
105
    public function getLevel(): int
106
    {
107
        return $this->level;
108
    }
109
110
    /**
111
     * Set lastUpdate.
112
     *
113
     * @param DateTime $lastUpdate
114
     *
115
     * @return Building
116
     */
117
    public function setLastUpdate(DateTime $lastUpdate): AbstractBuilding
118
    {
119
        $this->lastUpdate = $lastUpdate;
120
121
        return $this;
122
    }
123
124
    /**
125
     * Get lastUpdate.
126
     *
127
     * @return DateTime
128
     */
129
    public function getLastUpdate(): DateTime
130
    {
131
        return $this->lastUpdate;
132
    }
133
134
    /**
135
     * Get type.
136
     *
137
     * @return int Event const
138
     */
139
    abstract public function getType(): int;
140
}
141