These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * AwsS3v3Factory.php |
||
4 | * |
||
5 | * @copyright More in license.md |
||
6 | * @license http://www.ipublikuj.eu |
||
7 | * @author Adam Kadlec http://www.ipublikuj.eu |
||
8 | * @package iPublikuj:Flysystem! |
||
9 | * @subpackage Adapters |
||
10 | * @since 1.0.0 |
||
11 | * |
||
12 | * @date 19.04.16 |
||
13 | */ |
||
14 | |||
15 | namespace IPub\Flysystem\Factories\Adapters; |
||
16 | |||
17 | use Nette; |
||
18 | use Nette\Utils; |
||
19 | |||
20 | use League\Flysystem; |
||
21 | use League\Flysystem\AwsS3v3; |
||
22 | |||
23 | use Aws\S3\S3Client; |
||
24 | |||
25 | /** |
||
26 | * AWS S3 v3 adapter filesystem factory |
||
27 | * |
||
28 | * @package iPublikuj:Flysystem! |
||
29 | * @subpackage Adapters |
||
30 | * |
||
31 | * @author Adam Kadlec <[email protected]> |
||
32 | */ |
||
33 | class AwsS3v3Factory |
||
34 | { |
||
35 | /** |
||
36 | * @param Utils\ArrayHash $parameters |
||
37 | * |
||
38 | * @return AwsS3v3\AwsS3Adapter |
||
39 | */ |
||
40 | public static function create(Utils\ArrayHash $parameters) |
||
41 | { |
||
42 | $client = new S3Client( |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
43 | [ |
||
44 | 'credentials' => [ |
||
45 | 'key' => $parameters->accessKey, |
||
46 | 'secret' => $parameters->accessSecret, |
||
47 | ], |
||
48 | 'region' => $parameters->region, |
||
49 | 'version' => $parameters->version, |
||
50 | ] |
||
51 | ); |
||
52 | |||
53 | return new AwsS3v3\AwsS3Adapter( |
||
54 | $client, |
||
55 | $parameters->bucket, |
||
56 | $parameters->prefix |
||
57 | ); |
||
58 | } |
||
59 | } |
||
60 |