parse() публичный статический Метод

The returned array contains the following keys: * "scheme": The scheme part before the "://"; * "path": The path part after the "://". The URI must fulfill a few constraints: * the scheme must consist of alphabetic characters only; * the scheme may be omitted. Then "://" must be omitted too; * the path must not be empty; * the path must start with a forward slash ("/"). If any of these constraints is not fulfilled, an {@link InvalidUriException} is thrown.
public static parse ( string $uri ) : string[]
$uri string A URI string.
Результат string[] The parts of the URI.
Пример #1
0
 /**
  * @dataProvider provideInvalidUris
  * @expectedException \Puli\Repository\Uri\InvalidUriException
  */
 public function testParseInvalid($uri)
 {
     Uri::parse($uri);
 }
 /**
  * {@inheritdoc}
  *
  * @internal
  */
 public function url_stat($uri, $flags)
 {
     try {
         $parts = Uri::parse($uri);
         $resource = $this->getRepository($parts['scheme'])->get($parts['path']);
         if ($resource instanceof FilesystemResource) {
             $path = $resource->getFilesystemPath();
             if ($flags & STREAM_URL_STAT_LINK) {
                 return lstat($path);
             }
             return stat($path);
         }
         $stat = self::$defaultStat;
         if ($resource instanceof BodyResource) {
             $stat[self::SIZE_NUM] = $stat[self::SIZE_ASSOC] = $resource->getSize();
         }
         $metadata = $resource->getMetadata();
         $stat[self::ACCESS_TIME_NUM] = $stat[self::ACCESS_TIME_ASSOC] = $metadata->getAccessTime();
         $stat[self::MODIFY_TIME_NUM] = $stat[self::MODIFY_TIME_ASSOC] = $metadata->getModificationTime();
         return $stat;
     } catch (ResourceNotFoundException $e) {
         if ($flags & STREAM_URL_STAT_QUIET) {
             // Same result as stat() returns on error
             // file_exists() returns false for this resource
             return false;
         }
         throw $e;
     }
 }