@@ -203,7 +203,7 @@ public function __construct(array $parameters = [])
203203 */
204204 public function run ()
205205 {
206- if (PHP_SAPI == 'cli ' ) {
206+ if (PHP_SAPI === 'cli ' ) {
207207 set_time_limit (0 );
208208 }
209209
@@ -219,7 +219,7 @@ public function run()
219219 *
220220 * @return string
221221 */
222- public function getOutput ()
222+ public function getOutput (): string
223223 {
224224 return $ this ->app ->handle ($ this ->getCurrentUri ())->getContent ();
225225 }
@@ -231,7 +231,7 @@ public function getOutput()
231231 *
232232 * @return $this
233233 */
234- public function setPtoolsPath ($ path )
234+ public function setPtoolsPath (string $ path ): Bootstrap
235235 {
236236 $ this ->ptoolsPath = rtrim ($ path , '\\/ ' );
237237
@@ -243,7 +243,7 @@ public function setPtoolsPath($path)
243243 *
244244 * @return string
245245 */
246- public function getPtoolsPath ()
246+ public function getPtoolsPath (): string
247247 {
248248 return $ this ->ptoolsPath ;
249249 }
@@ -255,7 +255,7 @@ public function getPtoolsPath()
255255 *
256256 * @return $this
257257 */
258- public function setPtoolsIp ($ ip )
258+ public function setPtoolsIp (string $ ip ): Bootstrap
259259 {
260260 $ this ->ptoolsIp = trim ($ ip );
261261
@@ -267,7 +267,7 @@ public function setPtoolsIp($ip)
267267 *
268268 * @return string
269269 */
270- public function getPtoolsIp ()
270+ public function getPtoolsIp (): string
271271 {
272272 return $ this ->ptoolsIp ;
273273 }
@@ -279,7 +279,7 @@ public function getPtoolsIp()
279279 *
280280 * @return $this
281281 */
282- public function setBasePath ($ path )
282+ public function setBasePath (string $ path ): Bootstrap
283283 {
284284 $ this ->basePath = rtrim ($ path , '\\/ ' );
285285
@@ -291,7 +291,7 @@ public function setBasePath($path)
291291 *
292292 * @return string
293293 */
294- public function getBasePath ()
294+ public function getBasePath (): string
295295 {
296296 return $ this ->basePath ;
297297 }
@@ -303,7 +303,7 @@ public function getBasePath()
303303 *
304304 * @return $this
305305 */
306- public function setTemplatesPath ($ path )
306+ public function setTemplatesPath (string $ path ): Bootstrap
307307 {
308308 $ this ->templatesPath = rtrim ($ path , '\\/ ' );
309309
@@ -315,7 +315,7 @@ public function setTemplatesPath($path)
315315 *
316316 * @return string
317317 */
318- public function getTemplatesPath ()
318+ public function getTemplatesPath (): string
319319 {
320320 return $ this ->templatesPath ;
321321 }
@@ -327,7 +327,7 @@ public function getTemplatesPath()
327327 *
328328 * @return $this
329329 */
330- public function setMode ($ mode )
330+ public function setMode (string $ mode ): Bootstrap
331331 {
332332 $ mode = strtolower (trim ($ mode ));
333333
@@ -345,7 +345,7 @@ public function setMode($mode)
345345 *
346346 * @return string
347347 */
348- public function getMode ()
348+ public function getMode (): string
349349 {
350350 return $ this ->mode ;
351351 }
@@ -357,7 +357,7 @@ public function getMode()
357357 *
358358 * @return $this
359359 */
360- public function setHostName ($ name )
360+ public function setHostName (string $ name ): Bootstrap
361361 {
362362 $ this ->hostName = trim ($ name );
363363
@@ -369,7 +369,7 @@ public function setHostName($name)
369369 *
370370 * @return string
371371 */
372- public function getHostName ()
372+ public function getHostName (): string
373373 {
374374 return $ this ->hostName ;
375375 }
@@ -381,7 +381,7 @@ public function getHostName()
381381 * @return $this
382382 * @throws InvalidArgumentException
383383 */
384- public function setParameters (array $ parameters )
384+ public function setParameters (array $ parameters ): Bootstrap
385385 {
386386 foreach ($ this ->configurable as $ param ) {
387387 if (!isset ($ parameters [$ param ])) {
@@ -401,7 +401,7 @@ public function setParameters(array $parameters)
401401 * @param mixed $value The value
402402 * @return $this
403403 */
404- public function setParameter (string $ parameter , $ value )
404+ public function setParameter (string $ parameter , $ value ): Bootstrap
405405 {
406406 $ method = 'set ' . Text::camelize ($ parameter );
407407
@@ -417,10 +417,10 @@ public function setParameter(string $parameter, $value)
417417 *
418418 * @return $this
419419 */
420- public function initFromConstants ()
420+ public function initFromConstants (): Bootstrap
421421 {
422422 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 )) {
424424 $ this ->setParameter ($ property , constant ($ const ));
425425 }
426426 }
@@ -430,8 +430,12 @@ public function initFromConstants()
430430
431431 public function getCurrentUri (): string
432432 {
433- $ webToolsFileName = basename ( $ _SERVER [ ' SCRIPT_FILENAME ' ] );
433+ $ baseUrl = $ this -> di -> getShared ( ' url ' )-> getBaseUri ( );
434434
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+ );
436440 }
437441}
0 commit comments