This class 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...
22
{
23
/**
24
* @var array
25
*/
26
protected $encoders;
27
28
/**
29
* The constructor class.
30
*
31
* @param array $encoders List of encoders (default empty).
32
*/
33
public function __construct(array $encoders = [])
34
{
35
$this->encoders = $encoders;
36
}
37
38
/**
39
* @param string $format The format of encoder.
40
*
41
* @throws \InvalidArgumentException
42
*
43
* @return EncoderInterface
44
*/
45
public function getEncoder($format)
46
{
47
if ($this->supports($format) === false) {
48
throw new \InvalidArgumentException(sprintf("Format '%s' is not supported.", $format));
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.