/
Author.php
98 lines (87 loc) · 1.81 KB
/
Author.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace Concrete\Core\Conversation\Message;
use Concrete\Core\User\UserInfo;
class Author
{
/** @var \Concrete\Core\User\UserInfo */
protected $user;
/** @var string|null */
protected $name;
/** @var string|null */
protected $email;
/** @var string|null */
protected $website;
/**
* @return \Concrete\Core\User\UserInfo
*/
public function getUser()
{
return $this->user;
}
/**
* @param \Concrete\Core\User\User|\Concrete\Core\User\UserInfo $user
* @return void
*/
public function setUser($user)
{
if ($user instanceof \Concrete\Core\User\User) {
$this->user = UserInfo::getByID($user->getUserID());
} else {
$this->user = $user;
}
$this->name = $this->user->getUserName();
$this->email = $this->user->getUserEmail();
}
/**
* @return string|null
*/
public function getName()
{
return $this->name;
}
/**
* @param string|null $name
* @return void
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string|null
*/
public function getWebsite()
{
return $this->website;
}
/**
* @param string|null $website
* @return void
*/
public function setWebsite($website)
{
$this->website = $website;
}
/**
* @return string|null
*/
public function getEmail()
{
return $this->email;
}
/**
* @param string|null $email
* @return void
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return AuthorFormatter
*/
public function getFormatter()
{
return app(AuthorFormatter::class, ['author'=>$this]);
}
}