Last active
November 2, 2016 01:26
-
-
Save sminnee/92d5486ba9d23d12ef4253b5ef274bf7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| interface ResourceLocator | |
| { | |
| /* | |
| * Return a reference to a package resource | |
| * | |
| * @param string $package The full composer package name | |
| * @param string $filename The name of the resource within that package | |
| * @return Resource An object representing the given resource | |
| */ | |
| public function getResource($package, $filename); | |
| /* | |
| * Return a reference to a package resource, based on another filename from that pacakge | |
| * | |
| * @param string $packageFilename The absolute path of a file contained within the given package | |
| * @param string $filename The name of the resource within that package | |
| * @return Resource An object representing the given resource | |
| */ | |
| public function getResourceBySibling($packageFilename, $filename); | |
| } | |
| interface Resource | |
| { | |
| /* | |
| * Return the URL for accessing the given resource over the web | |
| * | |
| * @param string $package The full composer package name | |
| * @param string $filename The name of the resource within that package | |
| * @return string A URL. If the URL is on the same domain as the site, it may be a root-relative URL. Otherwise it will be a protocol-agnostic URL. | |
| * @throws ResourceNotAvailableException If the resource does not exist or is not accessible via the client | |
| */ | |
| public function getURL(); | |
| /* | |
| * Return the absolute path of the source version of this file on the server | |
| * | |
| * @param string $package The full composer package name | |
| * @param string $filename The name of the resource within that package | |
| * @return string The absolute pathname of the files | |
| * @throws ResourceNotAvailableException If the resource does not exist or is private to the module | |
| */ | |
| public function getFilename(); | |
| /* | |
| * Returns true if the given exists | |
| * | |
| * @param string $package The full composer package name | |
| * @param string $filename The name of the resource within that package | |
| * @return boolean | |
| */ | |
| public function exists(); | |
| /* | |
| * Returns true if the given resource is available to the client | |
| * | |
| * @param string $package The full composer package name | |
| * @param string $filename The name of the resource within that package | |
| * @return boolean | |
| */ | |
| public function availableToClient(); | |
| } | |
| class ResourceNotAvailableException extends LogicException | |
| { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment