Passed
Push — master ( db66d7...806da6 )
by Adam
03:24
created

Flysystem/Factories/Adapters/AwsS3v2Factory.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * AwsS3v2Factory.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
declare(strict_types = 1);
16
17
namespace IPub\Flysystem\Factories\Adapters;
18
19
use Nette\DI;
20
use Nette\Utils;
21
22
use League\Flysystem\AwsS3v2;
23
24
use Aws\S3\S3Client;
25
26
/**
27
 * AWS S3 v2 adapter filesystem factory
28
 *
29
 * @package        iPublikuj:Flysystem!
30
 * @subpackage     Adapters
31
 *
32
 * @author         Adam Kadlec <[email protected]>
33
 */
34
class AwsS3v2Factory
35
{
36
	/**
37
	 * @param Utils\ArrayHash $parameters
38
	 * @param DI\Container $container
39
	 *
40
	 * @return AwsS3v2\AwsS3Adapter
41
	 */
42 View Code Duplication
	public static function create(Utils\ArrayHash $parameters, DI\Container $container) : AwsS3v2\AwsS3Adapter
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
	{
44
		/** @var S3Client $client */
45
		$client = $container->getService($parameters->client);
46
47
		return new AwsS3v2\AwsS3Adapter(
48
			$client,
49
			$parameters->bucket,
50
			$parameters->prefix
51
		);
52
	}
53
}
54