@@ -203,7 +203,7 @@ public function __construct(array $parameters = [])
203
203
*/
204
204
public function run ()
205
205
{
206
- if (PHP_SAPI == 'cli ' ) {
206
+ if (PHP_SAPI === 'cli ' ) {
207
207
set_time_limit (0 );
208
208
}
209
209
@@ -219,7 +219,7 @@ public function run()
219
219
*
220
220
* @return string
221
221
*/
222
- public function getOutput ()
222
+ public function getOutput (): string
223
223
{
224
224
return $ this ->app ->handle ($ this ->getCurrentUri ())->getContent ();
225
225
}
@@ -231,7 +231,7 @@ public function getOutput()
231
231
*
232
232
* @return $this
233
233
*/
234
- public function setPtoolsPath ($ path )
234
+ public function setPtoolsPath (string $ path ): Bootstrap
235
235
{
236
236
$ this ->ptoolsPath = rtrim ($ path , '\\/ ' );
237
237
@@ -243,7 +243,7 @@ public function setPtoolsPath($path)
243
243
*
244
244
* @return string
245
245
*/
246
- public function getPtoolsPath ()
246
+ public function getPtoolsPath (): string
247
247
{
248
248
return $ this ->ptoolsPath ;
249
249
}
@@ -255,7 +255,7 @@ public function getPtoolsPath()
255
255
*
256
256
* @return $this
257
257
*/
258
- public function setPtoolsIp ($ ip )
258
+ public function setPtoolsIp (string $ ip ): Bootstrap
259
259
{
260
260
$ this ->ptoolsIp = trim ($ ip );
261
261
@@ -267,7 +267,7 @@ public function setPtoolsIp($ip)
267
267
*
268
268
* @return string
269
269
*/
270
- public function getPtoolsIp ()
270
+ public function getPtoolsIp (): string
271
271
{
272
272
return $ this ->ptoolsIp ;
273
273
}
@@ -279,7 +279,7 @@ public function getPtoolsIp()
279
279
*
280
280
* @return $this
281
281
*/
282
- public function setBasePath ($ path )
282
+ public function setBasePath (string $ path ): Bootstrap
283
283
{
284
284
$ this ->basePath = rtrim ($ path , '\\/ ' );
285
285
@@ -291,7 +291,7 @@ public function setBasePath($path)
291
291
*
292
292
* @return string
293
293
*/
294
- public function getBasePath ()
294
+ public function getBasePath (): string
295
295
{
296
296
return $ this ->basePath ;
297
297
}
@@ -303,7 +303,7 @@ public function getBasePath()
303
303
*
304
304
* @return $this
305
305
*/
306
- public function setTemplatesPath ($ path )
306
+ public function setTemplatesPath (string $ path ): Bootstrap
307
307
{
308
308
$ this ->templatesPath = rtrim ($ path , '\\/ ' );
309
309
@@ -315,7 +315,7 @@ public function setTemplatesPath($path)
315
315
*
316
316
* @return string
317
317
*/
318
- public function getTemplatesPath ()
318
+ public function getTemplatesPath (): string
319
319
{
320
320
return $ this ->templatesPath ;
321
321
}
@@ -327,7 +327,7 @@ public function getTemplatesPath()
327
327
*
328
328
* @return $this
329
329
*/
330
- public function setMode ($ mode )
330
+ public function setMode (string $ mode ): Bootstrap
331
331
{
332
332
$ mode = strtolower (trim ($ mode ));
333
333
@@ -345,7 +345,7 @@ public function setMode($mode)
345
345
*
346
346
* @return string
347
347
*/
348
- public function getMode ()
348
+ public function getMode (): string
349
349
{
350
350
return $ this ->mode ;
351
351
}
@@ -357,7 +357,7 @@ public function getMode()
357
357
*
358
358
* @return $this
359
359
*/
360
- public function setHostName ($ name )
360
+ public function setHostName (string $ name ): Bootstrap
361
361
{
362
362
$ this ->hostName = trim ($ name );
363
363
@@ -369,7 +369,7 @@ public function setHostName($name)
369
369
*
370
370
* @return string
371
371
*/
372
- public function getHostName ()
372
+ public function getHostName (): string
373
373
{
374
374
return $ this ->hostName ;
375
375
}
@@ -381,7 +381,7 @@ public function getHostName()
381
381
* @return $this
382
382
* @throws InvalidArgumentException
383
383
*/
384
- public function setParameters (array $ parameters )
384
+ public function setParameters (array $ parameters ): Bootstrap
385
385
{
386
386
foreach ($ this ->configurable as $ param ) {
387
387
if (!isset ($ parameters [$ param ])) {
@@ -401,7 +401,7 @@ public function setParameters(array $parameters)
401
401
* @param mixed $value The value
402
402
* @return $this
403
403
*/
404
- public function setParameter (string $ parameter , $ value )
404
+ public function setParameter (string $ parameter , $ value ): Bootstrap
405
405
{
406
406
$ method = 'set ' . Text::camelize ($ parameter );
407
407
@@ -417,10 +417,10 @@ public function setParameter(string $parameter, $value)
417
417
*
418
418
* @return $this
419
419
*/
420
- public function initFromConstants ()
420
+ public function initFromConstants (): Bootstrap
421
421
{
422
422
foreach ($ this ->defines as $ const => $ property ) {
423
- if (defined ($ const ) && in_array ($ property , $ this ->configurable )) {
423
+ if (defined ($ const ) && in_array ($ property , $ this ->configurable , true )) {
424
424
$ this ->setParameter ($ property , constant ($ const ));
425
425
}
426
426
}
@@ -430,8 +430,12 @@ public function initFromConstants()
430
430
431
431
public function getCurrentUri (): string
432
432
{
433
- $ webToolsFileName = basename ( $ _SERVER [ ' SCRIPT_FILENAME ' ] );
433
+ $ baseUrl = $ this -> di -> getShared ( ' url ' )-> getBaseUri ( );
434
434
435
- return str_replace ($ webToolsFileName . '/ ' , '' , $ _SERVER ['REQUEST_URI ' ]);
435
+ return str_replace (
436
+ basename ($ _SERVER ['SCRIPT_FILENAME ' ]),
437
+ '' ,
438
+ substr ($ _SERVER ['REQUEST_URI ' ], strpos ($ _SERVER ['REQUEST_URI ' ], $ baseUrl ) + strlen ($ baseUrl ))
439
+ );
436
440
}
437
441
}
0 commit comments