1: <?php
2: namespace Contrib\Bundle\CoverallsV1Bundle\Entity\Git;
3:
4: use Contrib\Bundle\CoverallsV1Bundle\Entity\Coveralls;
5:
6: /**
7: * Commit info.
8: *
9: * @author Kitamura Satoshi <with.no.parachute@gmail.com>
10: */
11: class Commit extends Coveralls
12: {
13: /**
14: * Commit ID.
15: *
16: * @var string
17: */
18: protected $id;
19:
20: /**
21: * Author name.
22: *
23: * @var string
24: */
25: protected $authorName;
26:
27: /**
28: * Author email.
29: *
30: * @var string
31: */
32: protected $authorEmail;
33:
34: /**
35: * Committer name.
36: *
37: * @var string
38: */
39: protected $committerName;
40:
41: /**
42: * Committer email.
43: *
44: * @var string
45: */
46: protected $committerEmail;
47:
48: /**
49: * Commit message.
50: *
51: * @var string
52: */
53: protected $message;
54:
55: // API
56:
57: /**
58: * {@inheritdoc}
59: *
60: * @see \Contrib\Bundle\CoverallsBundle\Entity\ArrayConvertable::toArray()
61: */
62: public function toArray()
63: {
64: return array(
65: 'id' => $this->id,
66: 'author_name' => $this->authorName,
67: 'author_email' => $this->authorEmail,
68: 'committer_name' => $this->committerName,
69: 'committer_email' => $this->committerEmail,
70: 'message' => $this->message,
71: );
72: }
73:
74: // accessor
75:
76: /**
77: * Set commit ID.
78: *
79: * @param string $id
80: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
81: */
82: public function setId($id)
83: {
84: $this->id = $id;
85:
86: return $this;
87: }
88:
89: /**
90: * Return commit ID.
91: *
92: * @return string|null
93: */
94: public function getId()
95: {
96: if (isset($this->id)) {
97: return $this->id;
98: }
99:
100: return null;
101: }
102:
103: /**
104: * Set author name.
105: *
106: * @param string $authorName
107: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
108: */
109: public function setAuthorName($authorName)
110: {
111: $this->authorName = $authorName;
112:
113: return $this;
114: }
115:
116: /**
117: * Return author name.
118: *
119: * @return string|null
120: */
121: public function getAuthorName()
122: {
123: if (isset($this->authorName)) {
124: return $this->authorName;
125: }
126:
127: return null;
128: }
129:
130: /**
131: * Set author email.
132: *
133: * @param string $authorEmail
134: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
135: */
136: public function setAuthorEmail($authorEmail)
137: {
138: $this->authorEmail = $authorEmail;
139:
140: return $this;
141: }
142:
143: /**
144: * Return author email.
145: *
146: * @return string|null
147: */
148: public function getAuthorEmail()
149: {
150: if (isset($this->authorEmail)) {
151: return $this->authorEmail;
152: }
153:
154: return null;
155: }
156:
157: /**
158: * Set committer name.
159: *
160: * @param string $committerName
161: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
162: */
163: public function setCommitterName($committerName)
164: {
165: $this->committerName = $committerName;
166:
167: return $this;
168: }
169:
170: /**
171: * Return committer name.
172: *
173: * @return string|null
174: */
175: public function getCommitterName()
176: {
177: if (isset($this->committerName)) {
178: return $this->committerName;
179: }
180:
181: return null;
182: }
183:
184: /**
185: * Set committer email.
186: *
187: * @param string $committerEmail
188: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
189: */
190: public function setCommitterEmail($committerEmail)
191: {
192: $this->committerEmail = $committerEmail;
193:
194: return $this;
195: }
196:
197: /**
198: * Return committer email.
199: *
200: * @return string|null
201: */
202: public function getCommitterEmail()
203: {
204: if (isset($this->committerEmail)) {
205: return $this->committerEmail;
206: }
207:
208: return null;
209: }
210:
211: /**
212: * Set commit message.
213: *
214: * @param string $message
215: * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
216: */
217: public function setMessage($message)
218: {
219: $this->message = $message;
220:
221: return $this;
222: }
223:
224: /**
225: * Return commit message.
226: *
227: * @return string|null
228: */
229: public function getMessage()
230: {
231: if (isset($this->message)) {
232: return $this->message;
233: }
234:
235: return null;
236: }
237: }
238: