@@ -192,7 +192,7 @@ public static function getEscaper()
192192 public function isValid ()
193193 {
194194 if ($ this ->host ) {
195- if (strlen ($ this ->path ) > 0 && substr ($ this ->path , 0 , 1 ) != '/ ' ) {
195+ if (strlen ($ this ->path ) > 0 && 0 !== strpos ($ this ->path , '/ ' ) ) {
196196 return false ;
197197 }
198198 return true ;
@@ -204,7 +204,7 @@ public function isValid()
204204
205205 if ($ this ->path ) {
206206 // Check path-only (no host) URI
207- if (substr ($ this ->path , 0 , 2 ) == '// ' ) {
207+ if (0 === strpos ($ this ->path , '// ' ) ) {
208208 return false ;
209209 }
210210 return true ;
@@ -231,7 +231,7 @@ public function isValidRelative()
231231
232232 if ($ this ->path ) {
233233 // Check path-only (no host) URI
234- if (substr ($ this ->path , 0 , 2 ) == '// ' ) {
234+ if (0 === strpos ($ this ->path , '// ' ) ) {
235235 return false ;
236236 }
237237 return true ;
@@ -337,7 +337,7 @@ public function parse($uri)
337337 }
338338
339339 // All that's left is the fragment
340- if ($ uri && substr ( $ uri , 0 , 1 ) == '# ' ) {
340+ if ($ uri && 0 === strpos ( $ uri , '# ' ) ) {
341341 $ this ->setFragment (substr ($ uri , 1 ));
342342 }
343343
@@ -483,7 +483,7 @@ public function resolve($baseUri)
483483 $ this ->setQuery ($ baseUri ->getQuery ());
484484 }
485485 } else {
486- if (substr ( $ relPath , 0 , 1 ) == '/ ' ) {
486+ if (0 === strpos ( $ relPath , '/ ' ) ) {
487487 $ this ->setPath (static ::removePathDotSegments ($ relPath ));
488488 } else {
489489 if ($ baseUri ->getHost () && ! $ basePath ) {
@@ -1105,21 +1105,21 @@ public static function removePathDotSegments($path)
11051105 }
11061106 $ output = substr ($ output , 0 , $ lastSlashPos );
11071107 break ;
1108- case (substr ( $ path , 0 , 4 ) == '/../ ' ):
1108+ case (0 === strpos ( $ path , '/../ ' ) ):
11091109 $ path = '/ ' . substr ($ path , 4 );
11101110 $ lastSlashPos = strrpos ($ output , '/ ' , -1 );
11111111 if (false === $ lastSlashPos ) {
11121112 break ;
11131113 }
11141114 $ output = substr ($ output , 0 , $ lastSlashPos );
11151115 break ;
1116- case (substr ( $ path , 0 , 3 ) == '/./ ' ):
1116+ case (0 === strpos ( $ path , '/./ ' ) ):
11171117 $ path = substr ($ path , 2 );
11181118 break ;
1119- case (substr ( $ path , 0 , 2 ) == './ ' ):
1119+ case (0 === strpos ( $ path , './ ' ) ):
11201120 $ path = substr ($ path , 2 );
11211121 break ;
1122- case (substr ( $ path , 0 , 3 ) == '../ ' ):
1122+ case (0 === strpos ( $ path , '../ ' ) ):
11231123 $ path = substr ($ path , 3 );
11241124 break ;
11251125 default :
0 commit comments