@@ -199,13 +199,8 @@ public function isDirectAccessFrontendName($code)
199
199
*/
200
200
public function getBasePath ()
201
201
{
202
- $ path = parent ::getBasePath ();
203
- if (empty ($ path )) {
204
- $ path = '/ ' ;
205
- } else {
206
- $ path = str_replace ('\\' , '/ ' , $ path );
207
- }
208
- return $ path ;
202
+ return empty (parent ::getBasePath ()) ? '/ '
203
+ : str_replace ('\\' , '/ ' , parent ::getBasePath ());
209
204
}
210
205
211
206
/**
@@ -228,8 +223,7 @@ public function getFrontName()
228
223
public function setRouteName ($ route )
229
224
{
230
225
$ this ->route = $ route ;
231
- $ module = $ this ->routeConfig ->getRouteFrontName ($ route );
232
- if ($ module ) {
226
+ if ($ module = $ this ->routeConfig ->getRouteFrontName ($ route )) {
233
227
$ this ->setModuleName ($ module );
234
228
}
235
229
return $ this ;
@@ -292,13 +286,11 @@ public function initForward()
292
286
* If passed name will be null whole state array will be returned.
293
287
*
294
288
* @param string $name
295
- * @return array|string |null
289
+ * @return mixed |null
296
290
*/
297
291
public function getBeforeForwardInfo ($ name = null )
298
292
{
299
- if ($ name === null ) {
300
- return $ this ->beforeForwardInfo ;
301
- } elseif (isset ($ this ->beforeForwardInfo [$ name ])) {
293
+ if ($ name !== null && isset ($ this ->beforeForwardInfo [$ name ])) {
302
294
return $ this ->beforeForwardInfo [$ name ];
303
295
}
304
296
return null ;
@@ -311,13 +303,9 @@ public function getBeforeForwardInfo($name = null)
311
303
*/
312
304
public function isAjax ()
313
305
{
314
- if ($ this ->isXmlHttpRequest ()) {
315
- return true ;
316
- }
317
- if ($ this ->getParam ('ajax ' ) || $ this ->getParam ('isAjax ' )) {
318
- return true ;
319
- }
320
- return false ;
306
+ return $ this ->isXmlHttpRequest ()
307
+ || $ this ->getParam ('ajax ' , null )
308
+ || $ this ->getParam ('isAjax ' , null );
321
309
}
322
310
323
311
/**
@@ -365,7 +353,7 @@ public static function getDistroBaseUrlPath($server)
365
353
$ result = '' ;
366
354
if (isset ($ server ['SCRIPT_NAME ' ])) {
367
355
$ envPath = str_replace ('\\' , '/ ' , dirname (str_replace ('\\' , '/ ' , $ server ['SCRIPT_NAME ' ])));
368
- if ($ envPath != '. ' && $ envPath != '/ ' ) {
356
+ if ($ envPath !== '. ' && $ envPath != = '/ ' ) {
369
357
$ result = $ envPath ;
370
358
}
371
359
}
@@ -425,11 +413,8 @@ public function __sleep()
425
413
public function isSafeMethod ()
426
414
{
427
415
if ($ this ->isSafeMethod === null ) {
428
- if (isset ($ _SERVER ['REQUEST_METHOD ' ]) && (in_array ($ _SERVER ['REQUEST_METHOD ' ], $ this ->safeRequestTypes ))) {
429
- $ this ->isSafeMethod = true ;
430
- } else {
431
- $ this ->isSafeMethod = false ;
432
- }
416
+ $ this ->isSafeMethod = isset ($ _SERVER ['REQUEST_METHOD ' ])
417
+ && (in_array ($ _SERVER ['REQUEST_METHOD ' ], $ this ->safeRequestTypes ));
433
418
}
434
419
return $ this ->isSafeMethod ;
435
420
}
0 commit comments