‪TYPO3CMS  11.5
Comment.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
27 {
31  protected ‪$date;
32 
37  protected ‪$author = '';
38 
43  protected ‪$email = '';
44 
49  protected ‪$content = '';
50 
54  public function ‪__construct()
55  {
56  $this->date = new \DateTime();
57  }
58 
64  public function ‪setDate(\DateTime ‪$date): void
65  {
66  $this->date = ‪$date;
67  }
68 
74  public function ‪getDate(): \DateTime
75  {
76  return ‪$this->date;
77  }
78 
84  public function ‪setAuthor(‪$author): void
85  {
86  $this->author = ‪$author;
87  }
88 
94  public function ‪getAuthor(): string
95  {
96  return ‪$this->author;
97  }
98 
104  public function ‪setEmail(‪$email): void
105  {
106  $this->email = ‪$email;
107  }
108 
114  public function ‪getEmail(): string
115  {
116  return ‪$this->email;
117  }
118 
124  public function ‪setContent(‪$content): void
125  {
126  $this->content = ‪$content;
127  }
128 
134  public function ‪getContent(): string
135  {
136  return ‪$this->content;
137  }
138 
144  public function ‪__toString()
145  {
146  return $this->author . ' (' . $this->email . ') said on ' . $this->date->format('Y-m-d') . ':' . chr(10) .
147  $this->content . chr(10);
148  }
149 }
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\__toString
‪string __toString()
Definition: Comment.php:140
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\setAuthor
‪setAuthor($author)
Definition: Comment.php:80
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:18
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\setContent
‪setContent($content)
Definition: Comment.php:120
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\getContent
‪string getContent()
Definition: Comment.php:130
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\$email
‪string $email
Definition: Comment.php:40
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\setEmail
‪setEmail($email)
Definition: Comment.php:100
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\$date
‪DateTime $date
Definition: Comment.php:30
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:22
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\setDate
‪setDate(\DateTime $date)
Definition: Comment.php:60
‪ExtbaseTeam\BlogExample\Domain\Model\Comment
Definition: Comment.php:27
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\$content
‪string $content
Definition: Comment.php:45
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\getDate
‪DateTime getDate()
Definition: Comment.php:70
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\getEmail
‪string getEmail()
Definition: Comment.php:110
‪ExtbaseTeam\BlogExample\Domain\Model
Definition: Administrator.php:18
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\$author
‪string $author
Definition: Comment.php:35
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\getAuthor
‪string getAuthor()
Definition: Comment.php:90
‪ExtbaseTeam\BlogExample\Domain\Model\Comment\__construct
‪__construct()
Definition: Comment.php:50