@@ -118,7 +118,7 @@ public function __construct($uri = '')
118
118
));
119
119
}
120
120
121
- if (! empty ( $ uri) ) {
121
+ if ('' !== $ uri ) {
122
122
$ this ->parseUri ($ uri );
123
123
}
124
124
}
@@ -167,12 +167,12 @@ public function getScheme()
167
167
*/
168
168
public function getAuthority ()
169
169
{
170
- if (empty ( $ this ->host ) ) {
170
+ if ('' === $ this ->host ) {
171
171
return '' ;
172
172
}
173
173
174
174
$ authority = $ this ->host ;
175
- if (! empty ( $ this ->userInfo ) ) {
175
+ if ('' !== $ this ->userInfo ) {
176
176
$ authority = $ this ->userInfo . '@ ' . $ authority ;
177
177
}
178
178
@@ -496,27 +496,26 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
496
496
{
497
497
$ uri = '' ;
498
498
499
- if (! empty ( $ scheme) ) {
499
+ if ('' !== $ scheme ) {
500
500
$ uri .= sprintf ('%s: ' , $ scheme );
501
501
}
502
502
503
- if (! empty ( $ authority) ) {
503
+ if ('' !== $ authority ) {
504
504
$ uri .= '// ' . $ authority ;
505
505
}
506
506
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 ;
513
509
}
514
510
515
- if ($ query ) {
511
+ $ uri .= $ path ;
512
+
513
+
514
+ if ('' !== $ query ) {
516
515
$ uri .= sprintf ('?%s ' , $ query );
517
516
}
518
517
519
- if ($ fragment ) {
518
+ if ('' !== $ fragment ) {
520
519
$ uri .= sprintf ('#%s ' , $ fragment );
521
520
}
522
521
@@ -533,14 +532,11 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
533
532
*/
534
533
private function isNonStandardPort ($ scheme , $ host , $ port )
535
534
{
536
- if (! $ scheme ) {
537
- if ($ host && ! $ port ) {
538
- return false ;
539
- }
540
- return true ;
535
+ if ('' === $ scheme ) {
536
+ return '' === $ host || null !== $ port ;
541
537
}
542
538
543
- if (! $ host || ! $ port ) {
539
+ if ('' === $ host || null === $ port ) {
544
540
return false ;
545
541
}
546
542
@@ -559,7 +555,7 @@ private function filterScheme($scheme)
559
555
$ scheme = strtolower ($ scheme );
560
556
$ scheme = preg_replace ('#:(//)?$# ' , '' , $ scheme );
561
557
562
- if (empty ( $ scheme) ) {
558
+ if ('' === $ scheme ) {
563
559
return '' ;
564
560
}
565
561
@@ -605,7 +601,7 @@ private function filterPath($path)
605
601
$ path
606
602
);
607
603
608
- if (empty ( $ path) ) {
604
+ if ('' === $ path ) {
609
605
// No path
610
606
return $ path ;
611
607
}
@@ -629,7 +625,7 @@ private function filterPath($path)
629
625
*/
630
626
private function filterQuery ($ query )
631
627
{
632
- if (! empty ( $ query) && strpos ($ query , '? ' ) === 0 ) {
628
+ if ('' !== $ query && strpos ($ query , '? ' ) === 0 ) {
633
629
$ query = substr ($ query , 1 );
634
630
}
635
631
@@ -673,7 +669,7 @@ private function splitQueryValue($value)
673
669
*/
674
670
private function filterFragment ($ fragment )
675
671
{
676
- if (! empty ( $ fragment) && strpos ($ fragment , '# ' ) === 0 ) {
672
+ if ('' !== $ fragment && strpos ($ fragment , '# ' ) === 0 ) {
677
673
$ fragment = '%23 ' . substr ($ fragment , 1 );
678
674
}
679
675
0 commit comments