Completed
Push — master ( 9c0788...1afd78 )
by Michael
03:46
created

Vote::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * Vote.
9
 *
10
 * @ORM\Table(name="votes")
11
 * @ORM\Entity(repositoryClass="AppBundle\Repository\VoteRepository")
12
 */
13
class Vote
14
{
15
    /**
16
     * @var int
17
     *
18
     * @ORM\Column(name="id", type="integer")
19
     * @ORM\Id
20
     * @ORM\GeneratedValue(strategy="AUTO")
21
     */
22
    private $id;
23
24
    /**
25
     * @var int
26
     *
27
     * @ORM\Column(name="weight", type="integer")
28
     */
29
    private $weight;
30
31
    /**
32
     * @var \AppBundle\Entity\Poll
33
     *
34
     * @ORM\ManyToOne(targetEntity="Poll", inversedBy="votes")
35
     * @ORM\JoinColumn(name="poll_id", referencedColumnName="id")
36
     */
37
    private $poll;
38
39
    /**
40
     * @var \AppBundle\Entity\User
41
     *
42
     * @ORM\ManyToOne(targetEntity="User", inversedBy="votes")
43
     * @ORM\JoinColumn(name="caster_id", referencedColumnName="id")
44
     */
45
    private $caster;
46
47
    /**
48
     * @var \DateTime
49
     *
50
     * @ORM\Column(name="time", type="datetime")
51
     */
52
    private $time;
53
54
    /**
55
     * @var \AppBundle\Entity\Choice
56
     *
57
     * @ORM\ManyToOne(targetEntity="Choice", inversedBy="votes")
58
     * @ORM\JoinColumn(name="choice_id", referencedColumnName="id")
59
     */
60
    private $choice;
61
62
    /**
63
     * Constructor
64
     */
65
    function __construct()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __construct.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
66
    {
67
        $this->time = new \DateTime();
68
        $this->weight = 1;
69
    }
70
71
    /**
72
     * Get id.
73
     *
74
     * @return int
75
     */
76
    public function getId(): int
77
    {
78
        return $this->id;
79
    }
80
81
    /**
82
     * Set time.
83
     *
84
     * @param \DateTime $time
85
     *
86
     * @return Vote
87
     */
88
    public function setTime(\DateTime $time)
89
    {
90
        $this->time = $time;
91
92
        return $this;
93
    }
94
95
    /**
96
     * Get time.
97
     *
98
     * @return \DateTime
99
     */
100
    public function getTime(): DateTime
101
    {
102
        return $this->time;
103
    }
104
105
    /**
106
     * Set poll.
107
     *
108
     * @param \AppBundle\Entity\Poll $poll
109
     *
110
     * @return Vote
111
     */
112
    public function setPoll(\AppBundle\Entity\Poll $poll = null)
113
    {
114
        $this->poll = $poll;
115
116
        return $this;
117
    }
118
119
    /**
120
     * Get poll.
121
     *
122
     * @return \AppBundle\Entity\Poll
123
     */
124
    public function getPoll(): AppBundle\Entity\Poll
125
    {
126
        return $this->poll;
127
    }
128
129
    /**
130
     * Set caster.
131
     *
132
     * @param \AppBundle\Entity\User $caster
133
     *
134
     * @return Vote
135
     */
136
    public function setCaster(\AppBundle\Entity\User $caster = null)
137
    {
138
        $this->caster = $caster;
139
140
        return $this;
141
    }
142
143
    /**
144
     * Get caster.
145
     *
146
     * @return \AppBundle\Entity\User
147
     */
148
    public function getCaster(): AppBundle\Entity\User
149
    {
150
        return $this->caster;
151
    }
152
153
    /**
154
     * Set choice.
155
     *
156
     * @param \AppBundle\Entity\Choice $choice
157
     *
158
     * @return Vote
159
     */
160
    public function setChoice(\AppBundle\Entity\Choice $choice = null)
161
    {
162
        $this->choice = $choice;
163
164
        return $this;
165
    }
166
167
    /**
168
     * Get choice.
169
     *
170
     * @return \AppBundle\Entity\Choice
171
     */
172
    public function getChoice(): AppBundle\Entity\Choice
173
    {
174
        return $this->choice;
175
    }
176
}
177