isAbsolute() public static method

An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, the base URI. Relative references can be divided into several forms: - network-path references, e.g. '//example.com/path' - absolute-path references, e.g. '/path' - relative-path references, e.g. 'subpath'
See also: Uri::isNetworkPathReference
See also: Uri::isAbsolutePathReference
See also: Uri::isRelativePathReference
public static isAbsolute ( Psr\Http\Message\UriInterface $uri ) : boolean
$uri Psr\Http\Message\UriInterface
return boolean
Example #1
0
 public function testIsAbsolute()
 {
     $this->assertTrue(Uri::isAbsolute(new Uri('http://example.org')));
     $this->assertFalse(Uri::isAbsolute(new Uri('//example.org')));
     $this->assertFalse(Uri::isAbsolute(new Uri('/abs-path')));
     $this->assertFalse(Uri::isAbsolute(new Uri('rel-path')));
 }