File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727class UrlScript extends Url
2828{
2929 /** @var string */
30- private $ scriptPath = ' / ' ;
30+ private $ scriptPath ;
3131
3232
3333 /**
@@ -48,7 +48,7 @@ public function setScriptPath($value)
4848 */
4949 public function getScriptPath ()
5050 {
51- return $ this ->scriptPath ;
51+ return $ this ->scriptPath ?: $ this -> path ;
5252 }
5353
5454
@@ -58,7 +58,7 @@ public function getScriptPath()
5858 */
5959 public function getBasePath ()
6060 {
61- $ pos = strrpos ($ this ->scriptPath , '/ ' );
61+ $ pos = strrpos ($ this ->getScriptPath () , '/ ' );
6262 return $ pos === FALSE ? '' : substr ($ this ->getPath (), 0 , $ pos + 1 );
6363 }
6464
@@ -69,7 +69,7 @@ public function getBasePath()
6969 */
7070 public function getPathInfo ()
7171 {
72- return (string ) substr ($ this ->getPath (), strlen ($ this ->scriptPath ));
72+ return (string ) substr ($ this ->getPath (), strlen ($ this ->getScriptPath () ));
7373 }
7474
7575}
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ require __DIR__ . '/../bootstrap.php';
1212
1313
1414$ url = new UrlScript ('http://nette.org:8080/file.php?q=search ' );
15- Assert::same ('/ ' , $ url ->scriptPath );
15+ Assert::same ('/file.php ' , $ url ->scriptPath );
1616Assert::same ('http://nette.org:8080/ ' , $ url ->baseUrl );
1717Assert::same ('/ ' , $ url ->basePath );
1818Assert::same ('file.php?q=search ' , $ url ->relativeUrl );
19- Assert::same ('file.php ' , $ url ->pathInfo );
19+ Assert::same ('' , $ url ->pathInfo );
You can’t perform that action at this time.
0 commit comments