-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Albin Kerouanton
committed
Jun 2, 2017
1 parent
6346ace
commit 31b48c5
Showing
7 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,26 @@ | |
|
||
use Gaufrette\FilesystemInterface; | ||
|
||
/** | ||
* Filesystem decorator providing resolve() method to resolve an object path into URI. | ||
* | ||
* Example: | ||
* $client = // AwsS3 client instantiation | ||
* $decorated = new Filesystem(new AwsS3($client, 'my_bucket', ['directory' => 'root/dir'])); | ||
* $filesystem = new ResolvableFilesystem( | ||
* $decorated, | ||
* new AwsS3PresignedUrlResolver($client, 'my_bucket', 'root/dir') | ||
* ); | ||
* | ||
* try { | ||
* // should return something like "https://eu-west-1.blabla.aws.com/my_bucket/root/dir/foo/bar.png?token | ||
* var_dump($filesystem->resolve('foo/bar.png')); | ||
* } catch (ResolverException $e) { | ||
* | ||
* } | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
class ResolvableFilesystem implements FilesystemInterface | ||
{ | ||
/** @var FilesystemInterface */ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
/** | ||
* Resolves object paths into time-limited URLs, namely presigned URLs. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
* | ||
* @see http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html | ||
*/ | ||
class AwsS3PresignedUrlResolver implements ResolverInterface | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,9 @@ | |
use Gaufrette\Extras\Resolvable\ResolverInterface; | ||
|
||
/** | ||
* Resolves objects' path into public URLs. | ||
* Resolves path of public objects into URLs. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
class AwsS3PublicUrlResolver implements ResolverInterface | ||
{ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
|
||
/** | ||
* Resolves object path by prepending a static prefix. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
class StaticUrlResolver implements ResolverInterface | ||
{ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ | |
|
||
namespace Gaufrette\Extras\Resolvable; | ||
|
||
/** | ||
* Base exception thrown by resolvers if they fail to resolve an object path into URI. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
class ResolverException extends \Exception | ||
{ | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ | |
|
||
namespace Gaufrette\Extras\Resolvable; | ||
|
||
/** | ||
* Resolves an object path into an URI. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
interface ResolverInterface | ||
{ | ||
/** | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ | |
|
||
namespace Gaufrette\Extras\Resolvable; | ||
|
||
/** | ||
* Exception thrown by the filesystem when resolution fail. | ||
* | ||
* @author Albin Kerouanton <[email protected]> | ||
*/ | ||
class UnresolvableObjectException extends \Exception | ||
{ | ||
/** | ||
|