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...
26
{
27
if (!isset($this->descriptors[$descriptorKey])) {
28
throw new \InvalidArgumentException(sprintf(
29
'Descriptor "%s" is not supported',
30
$descriptorKey,
31
implode('", "', array_keys($this->descriptors))
32
));
33
}
34
35
return $this->descriptors[$descriptorKey];
36
}
37
38
/**
39
* {@inheritdoc}
40
*/
41
public function has($descriptor): bool
42
{
43
return isset($this->descriptors[$descriptor]);
44
}
45
46
/**
47
* {@inheritdoc}
48
*/
49
public function all(): array
50
{
51
return $this->descriptors;
52
}
53
54
/**
55
* {@inheritdoc}
56
*/
57
public function set(string $key, DescriptorInterface $descriptor, int $priority = 0)
58
{
59
// do not overwrite descriptor if a lower priority is given.
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.