@@ -118,7 +118,7 @@ public function __construct($uri = '')
118118 ));
119119 }
120120
121- if (! empty ( $ uri) ) {
121+ if ('' !== $ uri ) {
122122 $ this ->parseUri ($ uri );
123123 }
124124 }
@@ -167,12 +167,12 @@ public function getScheme()
167167 */
168168 public function getAuthority ()
169169 {
170- if (empty ( $ this ->host ) ) {
170+ if ('' === $ this ->host ) {
171171 return '' ;
172172 }
173173
174174 $ authority = $ this ->host ;
175- if (! empty ( $ this ->userInfo ) ) {
175+ if ('' !== $ this ->userInfo ) {
176176 $ authority = $ this ->userInfo . '@ ' . $ authority ;
177177 }
178178
@@ -496,27 +496,26 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
496496 {
497497 $ uri = '' ;
498498
499- if (! empty ( $ scheme) ) {
499+ if ('' !== $ scheme ) {
500500 $ uri .= sprintf ('%s: ' , $ scheme );
501501 }
502502
503- if (! empty ( $ authority) ) {
503+ if ('' !== $ authority ) {
504504 $ uri .= '// ' . $ authority ;
505505 }
506506
507- if ($ path ) {
508- if (empty ($ path ) || '/ ' !== substr ($ path , 0 , 1 )) {
509- $ path = '/ ' . $ path ;
510- }
511-
512- $ uri .= $ path ;
507+ if ('' !== $ path && '/ ' !== substr ($ path , 0 , 1 )) {
508+ $ path = '/ ' . $ path ;
513509 }
514510
515- if ($ query ) {
511+ $ uri .= $ path ;
512+
513+
514+ if ('' !== $ query ) {
516515 $ uri .= sprintf ('?%s ' , $ query );
517516 }
518517
519- if ($ fragment ) {
518+ if ('' !== $ fragment ) {
520519 $ uri .= sprintf ('#%s ' , $ fragment );
521520 }
522521
@@ -533,14 +532,11 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
533532 */
534533 private function isNonStandardPort ($ scheme , $ host , $ port )
535534 {
536- if (! $ scheme ) {
537- if ($ host && ! $ port ) {
538- return false ;
539- }
540- return true ;
535+ if ('' === $ scheme ) {
536+ return '' === $ host || null !== $ port ;
541537 }
542538
543- if (! $ host || ! $ port ) {
539+ if ('' === $ host || null === $ port ) {
544540 return false ;
545541 }
546542
@@ -559,7 +555,7 @@ private function filterScheme($scheme)
559555 $ scheme = strtolower ($ scheme );
560556 $ scheme = preg_replace ('#:(//)?$# ' , '' , $ scheme );
561557
562- if (empty ( $ scheme) ) {
558+ if ('' === $ scheme ) {
563559 return '' ;
564560 }
565561
@@ -605,7 +601,7 @@ private function filterPath($path)
605601 $ path
606602 );
607603
608- if (empty ( $ path) ) {
604+ if ('' === $ path ) {
609605 // No path
610606 return $ path ;
611607 }
@@ -629,7 +625,7 @@ private function filterPath($path)
629625 */
630626 private function filterQuery ($ query )
631627 {
632- if (! empty ( $ query) && strpos ($ query , '? ' ) === 0 ) {
628+ if ('' !== $ query && strpos ($ query , '? ' ) === 0 ) {
633629 $ query = substr ($ query , 1 );
634630 }
635631
@@ -673,7 +669,7 @@ private function splitQueryValue($value)
673669 */
674670 private function filterFragment ($ fragment )
675671 {
676- if (! empty ( $ fragment) && strpos ($ fragment , '# ' ) === 0 ) {
672+ if ('' !== $ fragment && strpos ($ fragment , '# ' ) === 0 ) {
677673 $ fragment = '%23 ' . substr ($ fragment , 1 );
678674 }
679675
0 commit comments