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 $decoders;
27
28
/**
29
* The constructor class.
30
*
31
* @param array $decoders List of decoders (default empty).
32
*/
33
public function __construct(array $decoders = [])
34
{
35
$this->decoders = $decoders;
36
}
37
38
/**
39
* @param string $format The format of decoder.
40
*
41
* @throws \InvalidArgumentException
42
*
43
* @return DecoderInterface
44
*/
45
public function getDecoder($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.