|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Game\Lib\View\Provider\Message; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use request; |
|
9
|
|
|
use Stu\Component\Game\GameEnum; |
|
|
|
|
|
|
10
|
|
|
use Stu\Lib\Component\ComponentRegistrationInterface; |
|
11
|
|
|
use Stu\Module\Control\GameControllerInterface; |
|
12
|
|
|
use Stu\Module\Game\Component\GameComponentEnum; |
|
13
|
|
|
use Stu\Module\Game\Lib\View\Provider\ViewComponentProviderInterface; |
|
14
|
|
|
use Stu\Module\Message\Lib\PrivateMessageFolderItem; |
|
15
|
|
|
use Stu\Module\Message\Lib\PrivateMessageUiFactoryInterface; |
|
16
|
|
|
use Stu\Orm\Entity\PrivateMessageFolderInterface; |
|
17
|
|
|
use Stu\Orm\Repository\PrivateMessageFolderRepositoryInterface; |
|
18
|
|
|
|
|
19
|
|
|
final class MessageProvider implements ViewComponentProviderInterface |
|
20
|
|
|
{ |
|
21
|
1 |
|
public function __construct( |
|
22
|
|
|
private PrivateMessageFolderRepositoryInterface $privateMessageFolderRepository, |
|
23
|
|
|
private ComponentRegistrationInterface $componentRegistration, |
|
24
|
|
|
private ClassicStyleProvider $ClassicStyleProvider, |
|
|
|
|
|
|
25
|
|
|
private MessengerStyleProvider $messengerStyleProvider, |
|
26
|
|
|
private PrivateMessageUiFactoryInterface $privateMessageUiFactory |
|
27
|
1 |
|
) {} |
|
28
|
|
|
|
|
29
|
2 |
|
#[Override] |
|
30
|
|
|
public function setTemplateVariables(GameControllerInterface $game): void |
|
31
|
|
|
{ |
|
32
|
2 |
|
if (!request::has('pmcat') && $game->getUser()->isInboxMessengerStyle()) { |
|
33
|
1 |
|
$this->messengerStyleProvider->setTemplateVariables($game); |
|
34
|
|
|
} else { |
|
35
|
1 |
|
$this->ClassicStyleProvider->setTemplateVariables($game); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
2 |
|
$game->setTemplateVar( |
|
39
|
2 |
|
'PM_CATEGORIES', |
|
40
|
2 |
|
array_map( |
|
41
|
2 |
|
fn(PrivateMessageFolderInterface $folder): PrivateMessageFolderItem => |
|
42
|
2 |
|
$this->privateMessageUiFactory->createPrivateMessageFolderItem($folder), |
|
43
|
2 |
|
$this->privateMessageFolderRepository->getOrderedByUser($game->getUser()) |
|
44
|
2 |
|
) |
|
45
|
2 |
|
); |
|
46
|
|
|
|
|
47
|
2 |
|
$this->componentRegistration->addComponentUpdate(GameComponentEnum::PM); |
|
48
|
2 |
|
$game->addExecuteJS("initTranslations();", GameEnum::JS_EXECUTION_AFTER_RENDER); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
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