| @@ 643-650 (lines=8) @@ | ||
| 640 | $callable = self::$repos[$scheme]; |
|
| 641 | $result = $callable($scheme); |
|
| 642 | ||
| 643 | if (!$result instanceof ResourceRepository) { |
|
| 644 | throw new RepositoryFactoryException(sprintf( |
|
| 645 | 'The repository factory registered for scheme "%s" should '. |
|
| 646 | 'return a ResourceRepository instance. Got: %s', |
|
| 647 | $scheme, |
|
| 648 | is_object($result) ? get_class($result) : gettype($result) |
|
| 649 | )); |
|
| 650 | } |
|
| 651 | ||
| 652 | self::$repos[$scheme] = $result; |
|
| 653 | } |
|
| @@ 49-54 (lines=6) @@ | ||
| 46 | */ |
|
| 47 | public static function parse($uri) |
|
| 48 | { |
|
| 49 | if (!is_string($uri)) { |
|
| 50 | throw new InvalidUriException(sprintf( |
|
| 51 | 'The URI must be a string, but is a %s.', |
|
| 52 | is_object($uri) ? get_class($uri) : gettype($uri) |
|
| 53 | )); |
|
| 54 | } |
|
| 55 | ||
| 56 | if (false !== ($pos = strpos($uri, '://'))) { |
|
| 57 | $parts = array(substr($uri, 0, $pos), substr($uri, $pos + 3)); |
|