[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Functional / Fixtures / Extensions / blog_example / Classes / Domain / Model / Comment.php
1 <?php
2 namespace ExtbaseTeam\BlogExample\Domain\Model;
3 /**
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16 /**
17 * A blog post comment
18 */
19 class Comment extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
20
21 /**
22 * @var \DateTime
23 */
24 protected $date;
25
26 /**
27 * @var string
28 * @validate NotEmpty
29 */
30 protected $author = '';
31
32 /**
33 * @var string
34 * @validate EmailAddress
35 */
36 protected $email = '';
37
38 /**
39 * @var string
40 * @validate StringLength(maximum = 500)
41 */
42 protected $content = '';
43
44 /**
45 * Constructs this post
46 */
47 public function __construct() {
48 $this->date = new \DateTime();
49 }
50
51 /**
52 * Setter for date
53 *
54 * @param \DateTime $date
55 * @return void
56 */
57 public function setDate(\DateTime $date) {
58 $this->date = $date;
59 }
60
61 /**
62 * Getter for date
63 *
64 * @return \DateTime
65 */
66 public function getDate() {
67 return $this->date;
68 }
69
70 /**
71 * Sets the author for this comment
72 *
73 * @param string $author
74 * @return void
75 */
76 public function setAuthor($author) {
77 $this->author = $author;
78 }
79
80 /**
81 * Getter for author
82 *
83 * @return string
84 */
85 public function getAuthor() {
86 return $this->author;
87 }
88
89 /**
90 * Sets the authors email for this comment
91 *
92 * @param string $email email of the author
93 * @return void
94 */
95 public function setEmail($email) {
96 $this->email = $email;
97 }
98
99 /**
100 * Getter for authors email
101 *
102 * @return string
103 */
104 public function getEmail() {
105 return $this->email;
106 }
107
108 /**
109 * Sets the content for this comment
110 *
111 * @param string $content
112 * @return void
113 */
114 public function setContent($content) {
115 $this->content = $content;
116 }
117
118 /**
119 * Getter for content
120 *
121 * @return string
122 */
123 public function getContent() {
124 return $this->content;
125 }
126
127 /**
128 * Returns this comment as a formatted string
129 *
130 * @return string
131 */
132 public function __toString() {
133 return $this->author . ' (' . $this->email . ') said on ' . $this->date->format('Y-m-d') . ':' . chr(10) .
134 $this->content . chr(10);
135 }
136 }
137 ?>