This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Jumilla\Addomnipot\Laravel; |
||
4 | |||
5 | use Illuminate\Contracts\Foundation\Application; |
||
6 | use Illuminate\Config\Repository; |
||
7 | use RuntimeException; |
||
8 | |||
9 | class Addon |
||
10 | { |
||
11 | /** |
||
12 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
13 | * @param string $name |
||
14 | * @param string $path |
||
15 | * |
||
16 | * @return static |
||
17 | */ |
||
18 | 6 | public static function create($app, $name, $path) |
|
19 | { |
||
20 | 6 | $pathComponents = explode('/', $path); |
|
21 | |||
22 | 6 | $config = static::loadAddonConfig($path, $name); |
|
23 | |||
24 | 5 | return new static($app, $name, $path, $config); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param string $path |
||
29 | * @param string $name |
||
30 | * |
||
31 | * @return array |
||
32 | */ |
||
33 | 6 | protected static function loadAddonConfig($path, $name) |
|
34 | { |
||
35 | 6 | if (file_exists($path.'/addon.php')) { |
|
36 | 5 | $config = require $path.'/addon.php'; |
|
37 | } else { |
||
38 | 1 | throw new RuntimeException("No such config file for addon '$name', need 'addon.php'."); |
|
39 | } |
||
40 | |||
41 | 5 | $version = array_get($config, 'version', 5); |
|
42 | 5 | if ($version != 5) { |
|
43 | throw new RuntimeException($version.': Illigal addon version.'); |
||
44 | } |
||
45 | |||
46 | 5 | return $config; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @var \Illuminate\Contracts\Foundation\Application |
||
51 | */ |
||
52 | protected $app; |
||
53 | |||
54 | /** |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $name; |
||
58 | |||
59 | /** |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $path; |
||
63 | |||
64 | /** |
||
65 | * @var \Illuminate\Contracts\Config\Repository |
||
66 | */ |
||
67 | protected $config; |
||
68 | |||
69 | /** |
||
70 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
71 | * @param string $name |
||
72 | * @param string $path |
||
73 | * @param array $config |
||
74 | */ |
||
75 | 12 | public function __construct($app, $name, $path, array $config) |
|
76 | { |
||
77 | 12 | $this->app = $app; |
|
78 | 12 | $this->name = $name; |
|
79 | 12 | $this->path = $path; |
|
80 | 12 | $this->config = new Repository(); |
|
81 | 12 | $this->config->set('addon', $config); |
|
82 | 12 | } |
|
83 | |||
84 | /** |
||
85 | * get name. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | 7 | public function name() |
|
90 | { |
||
91 | 7 | return $this->name; |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * get fullpath. |
||
96 | * |
||
97 | * @param string $path |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 5 | public function path($path = null) |
|
102 | { |
||
103 | 5 | if (func_num_args() == 0) { |
|
104 | 2 | return $this->path; |
|
105 | } else { |
||
106 | 5 | return $this->path.'/'.$path; |
|
107 | } |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * get relative path. |
||
112 | * |
||
113 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | 5 | public function relativePath(Application $app) |
|
118 | { |
||
119 | 5 | return substr($this->path, strlen($app->basePath()) + 1); |
|
120 | } |
||
121 | |||
122 | /** |
||
123 | * get version. |
||
124 | * |
||
125 | * @return int |
||
126 | */ |
||
127 | 2 | public function version() |
|
128 | { |
||
129 | 2 | return $this->config('addon.version', 5); |
|
130 | } |
||
131 | |||
132 | /** |
||
133 | * get PHP namespace. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | 7 | public function phpNamespace() |
|
138 | { |
||
139 | 7 | return trim($this->config('addon.namespace', ''), '\\'); |
|
140 | } |
||
141 | |||
142 | /** |
||
143 | * get config value. |
||
144 | * |
||
145 | * @param string $key |
||
146 | * @param mixed $default |
||
147 | * |
||
148 | * @return mixed |
||
149 | */ |
||
150 | 9 | public function config($key, $default = null) |
|
151 | { |
||
152 | 9 | return $this->config->get($key, $default); |
|
153 | } |
||
154 | |||
155 | /** |
||
156 | * set config value. |
||
157 | * |
||
158 | * @param string $key |
||
159 | * @param mixed $value |
||
160 | */ |
||
161 | public function setConfig($key, $value) |
||
162 | { |
||
163 | $this->config->set($key, $value); |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * Get a lang resource name |
||
168 | * |
||
169 | * @param string $resource |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | 1 | public function transName($resource) |
|
174 | { |
||
175 | 1 | return $this->name.'::'.$resource; |
|
176 | } |
||
177 | |||
178 | /** |
||
179 | * Translate the given message. |
||
180 | * |
||
181 | * @param string $id |
||
0 ignored issues
–
show
|
|||
182 | * @param array $parameters |
||
0 ignored issues
–
show
There is no parameter named
$parameters . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
183 | * @param string $domain |
||
0 ignored issues
–
show
There is no parameter named
$domain . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
184 | * @param string $locale |
||
0 ignored issues
–
show
There is no parameter named
$locale . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
185 | * @return string |
||
186 | */ |
||
187 | 1 | View Code Duplication | public function trans() |
188 | { |
||
189 | 1 | $args = func_get_args(); |
|
190 | 1 | $args[0] = $this->transName($args[0]); |
|
191 | |||
192 | 1 | return call_user_func_array([$this->app['translator'], 'trans'], $args); |
|
193 | } |
||
194 | |||
195 | /** |
||
196 | * Translates the given message based on a count. |
||
197 | * |
||
198 | * @param string $id |
||
0 ignored issues
–
show
There is no parameter named
$id . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
199 | * @param int $number |
||
0 ignored issues
–
show
There is no parameter named
$number . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
200 | * @param array $parameters |
||
0 ignored issues
–
show
There is no parameter named
$parameters . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
201 | * @param string $domain |
||
0 ignored issues
–
show
There is no parameter named
$domain . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
202 | * @param string $locale |
||
0 ignored issues
–
show
There is no parameter named
$locale . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
203 | * @return string |
||
204 | */ |
||
205 | 1 | View Code Duplication | public function transChoice() |
206 | { |
||
207 | 1 | $args = func_get_args(); |
|
208 | 1 | $args[0] = $this->transName($args[0]); |
|
209 | |||
210 | 1 | return call_user_func_array([$this->app['translator'], 'transChoice'], $args); |
|
211 | } |
||
212 | |||
213 | /** |
||
214 | * Get a view resource name |
||
215 | * |
||
216 | * @param string $resource |
||
217 | * |
||
218 | * @return string |
||
219 | */ |
||
220 | public function viewName($resource) |
||
221 | { |
||
222 | return $this->name.'::'.$resource; |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * @param string $view |
||
227 | * @param array $data |
||
228 | * @param array $mergeData |
||
229 | * |
||
230 | * @return \Illuminate\View\View |
||
231 | */ |
||
232 | public function view($view, $data = [], $mergeData = []) |
||
233 | { |
||
234 | return $this->app['view']->make($this->viewname($view), $data, $mergeData); |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * Get a spec resource name |
||
239 | * |
||
240 | * @param string $resource |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | public function specName($resource) |
||
245 | { |
||
246 | return $this->name.'::'.$resource; |
||
247 | } |
||
248 | |||
249 | /** |
||
250 | * Get spec. |
||
251 | * |
||
252 | * @param string $path |
||
253 | * |
||
254 | * @return \Jumilla\Addomnipot\Laravel\Specs\InputSpec |
||
255 | */ |
||
256 | public function spec($path) |
||
257 | { |
||
258 | return $this->app[SpecFactory::class]->make($this->specName($path)); |
||
259 | } |
||
260 | } |
||
261 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.