@@ -41,24 +41,22 @@ public static function create()
41
41
/**
42
42
* @return GenericUri
43
43
**/
44
- final public function parse ($ uri , $ guessClass = false )
44
+ final public static function parse ($ uri , $ guessClass = false )
45
45
{
46
- $ schemePattern = '([^:/?#]+): ' ;
47
- $ authorityPattern = '(//([^/?#]*)) ' ;
48
- $ restPattern = '([^?#]*)(\?([^#]*))?(#(.*))? ' ;
46
+ static $ schemePattern = '([^:/?#]+): ' ;
47
+ static $ authorityPattern = '(//([^/?#]*)) ' ;
48
+ static $ restPattern = '([^?#]*)(\?([^#]*))?(#(.*))? ' ;
49
49
$ matches = array ();
50
50
51
51
if (
52
52
$ guessClass
53
- && ($ knownSubSchemes = $ this -> getKnownSubSchemes ())
53
+ && ($ knownSubSchemes = static :: getKnownSubSchemes ())
54
54
&& preg_match ("~^ {$ schemePattern }~ " , $ uri , $ matches )
55
55
&& isset ($ knownSubSchemes [strtolower ($ matches [1 ])])
56
56
)
57
- $ class = $ knownSubSchemes [strtolower ($ matches [1 ])];
57
+ $ result = new $ knownSubSchemes [strtolower ($ matches [1 ])];
58
58
else
59
- $ class = get_class ($ this );
60
-
61
- $ result = new $ class ;
59
+ $ result = new static ;
62
60
63
61
if ($ result instanceof Url)
64
62
$ pattern = "( {$ schemePattern }{$ authorityPattern })? " ;
@@ -171,11 +169,11 @@ final public function transform(GenericUri $reference, $strict = true)
171
169
return $ result ;
172
170
}
173
171
174
- public function getKnownSubSchemes ()
172
+ public static function getKnownSubSchemes ()
175
173
{
176
174
return array_merge (
177
- Urn::create ()-> getKnownSubSchemes (),
178
- Url::create ()-> getKnownSubSchemes ()
175
+ Urn::getKnownSubSchemes (),
176
+ Url::getKnownSubSchemes ()
179
177
);
180
178
}
181
179
0 commit comments