|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* Copyright (C) |
|
6
|
|
|
* Nathan Boiron <[email protected]> |
|
7
|
|
|
* Romain Canon <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This file is part of the TYPO3 NotiZ project. |
|
10
|
|
|
* It is free software; you can redistribute it and/or modify it |
|
11
|
|
|
* under the terms of the GNU General Public License, either |
|
12
|
|
|
* version 3 of the License, or any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* For the full copyright and license information, see: |
|
15
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace CuyZ\Notiz\Backend\Module\Uri; |
|
19
|
|
|
|
|
20
|
|
|
use CuyZ\Notiz\Backend\Module\ModuleHandler; |
|
21
|
|
|
use CuyZ\Notiz\Core\Support\NotizConstants; |
|
22
|
|
|
use Psr\Http\Message\UriInterface; |
|
23
|
|
|
use TYPO3\CMS\Core\Http\Uri; |
|
24
|
|
|
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder as ExbaseUriBuilder; |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
class UriBuilder |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $controller; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $action; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var array |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $arguments = []; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var ModuleHandler |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $moduleHandler; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var ExbaseUriBuilder |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $uriBuilder; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param ModuleHandler $moduleHandler |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct(ModuleHandler $moduleHandler) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->moduleHandler = $moduleHandler; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param $controller |
|
63
|
|
|
* @return $this |
|
64
|
|
|
*/ |
|
65
|
|
|
public function forController($controller) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->controller = $controller; |
|
68
|
|
|
|
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param $action |
|
74
|
|
|
* @return $this |
|
75
|
|
|
*/ |
|
76
|
|
|
public function forAction($action) |
|
77
|
|
|
{ |
|
78
|
|
|
$this->action = $action; |
|
79
|
|
|
|
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @param array $arguments |
|
85
|
|
|
* @return $this |
|
86
|
|
|
*/ |
|
87
|
|
|
public function withArguments(array $arguments) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->arguments = $arguments; |
|
90
|
|
|
|
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return UriInterface |
|
96
|
|
|
*/ |
|
97
|
|
|
public function build(): UriInterface |
|
98
|
|
|
{ |
|
99
|
|
|
$module = $this->moduleHandler->getModuleName(); |
|
100
|
|
|
$controller = $this->controller ?: $this->moduleHandler->getDefaultControllerName(); |
|
101
|
|
|
|
|
102
|
|
|
$uri = $this->uriBuilder |
|
103
|
|
|
->reset() |
|
104
|
|
|
->setArguments([ |
|
105
|
|
|
/* |
|
106
|
|
|
* @deprecated `M` arguments must be removed when TYPO3 v8 is |
|
107
|
|
|
* not supported anymore. |
|
108
|
|
|
*/ |
|
109
|
|
|
'M' => $module, |
|
110
|
|
|
'route' => $module, |
|
111
|
|
|
]) |
|
112
|
|
|
->uriFor( |
|
113
|
|
|
$this->action, |
|
114
|
|
|
$this->arguments, |
|
115
|
|
|
$controller, |
|
116
|
|
|
NotizConstants::EXTENSION_KEY, |
|
117
|
|
|
$module |
|
118
|
|
|
); |
|
119
|
|
|
|
|
120
|
|
|
return new Uri($uri); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param ExbaseUriBuilder $uriBuilder |
|
125
|
|
|
*/ |
|
126
|
|
|
public function injectUriBuilder(ExbaseUriBuilder $uriBuilder) |
|
127
|
|
|
{ |
|
128
|
|
|
$this->uriBuilder = $uriBuilder; |
|
129
|
|
|
} |
|
130
|
|
|
} |
|
131
|
|
|
|
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