|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Communication\View\ShowKnComments; |
|
6
|
|
|
|
|
7
|
|
|
use Noodlehaus\ConfigInterface; |
|
8
|
|
|
use Override; |
|
|
|
|
|
|
9
|
|
|
use Stu\Orm\Entity\KnCommentInterface; |
|
10
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
11
|
|
|
|
|
12
|
|
|
final class KnCommentWrapper implements KnCommentWrapperInterface |
|
13
|
|
|
{ |
|
14
|
12 |
|
public function __construct(private ConfigInterface $config, private KnCommentInterface $comment, private UserInterface $currentUser) {} |
|
15
|
|
|
|
|
16
|
2 |
|
#[Override] |
|
17
|
|
|
public function getId(): int |
|
18
|
|
|
{ |
|
19
|
2 |
|
return $this->comment->getId(); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
2 |
|
#[Override] |
|
23
|
|
|
public function getKnId(): int |
|
24
|
|
|
{ |
|
25
|
2 |
|
return $this->comment->getPosting()->getId(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
2 |
|
#[Override] |
|
29
|
|
|
public function getText(): string |
|
30
|
|
|
{ |
|
31
|
2 |
|
return $this->comment->getText(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
2 |
|
#[Override] |
|
35
|
|
|
public function getDate(): int |
|
36
|
|
|
{ |
|
37
|
2 |
|
return $this->comment->getDate(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
1 |
|
#[Override] |
|
41
|
|
|
public function getUserId(): int |
|
42
|
|
|
{ |
|
43
|
1 |
|
return $this->comment->getUser()->getId(); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
2 |
|
#[Override] |
|
47
|
|
|
public function getDisplayUserName(): string |
|
48
|
|
|
{ |
|
49
|
2 |
|
$commentUserName = $this->comment->getUserName(); |
|
50
|
2 |
|
if ($commentUserName !== '') { |
|
51
|
1 |
|
return $commentUserName; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
return $this->comment->getUser()->getName(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
3 |
|
#[Override] |
|
58
|
|
|
public function getUserAvatarPath(): string |
|
59
|
|
|
{ |
|
60
|
3 |
|
if ($this->comment->getUserName() !== '') { |
|
61
|
1 |
|
return ''; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
2 |
|
if ($this->comment->getUser()->getAvatar() === '') { |
|
65
|
1 |
|
return sprintf( |
|
66
|
1 |
|
'assets/rassen/%skn.png', |
|
67
|
1 |
|
$this->comment->getUser()->getFactionId() |
|
68
|
1 |
|
); |
|
69
|
|
|
} else { |
|
70
|
|
|
|
|
71
|
1 |
|
return sprintf( |
|
72
|
1 |
|
'/%s/%s.png', |
|
73
|
1 |
|
$this->config->get('game.user_avatar_path'), |
|
74
|
1 |
|
$this->comment->getUser()->getAvatar() |
|
75
|
1 |
|
); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
3 |
|
#[Override] |
|
80
|
|
|
public function isDeleteable(): bool |
|
81
|
|
|
{ |
|
82
|
3 |
|
return $this->comment->getUser() === $this->currentUser; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
1 |
|
#[Override] |
|
86
|
|
|
public function getUser(): UserInterface |
|
87
|
|
|
{ |
|
88
|
1 |
|
return $this->comment->getUser(); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths