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...
26
{
27
/**
28
* @var ObjectMapInterface
29
*/
30
private $map;
31
32
public function __construct(ObjectMapInterface $map)
33
{
34
$this->map = $map;
35
}
36
37
/**
38
* {@inheritdoc}
39
*/
40
public function has(ObjectValue $object): bool
41
{
42
return $this->map->has($object);
43
}
44
45
/**
46
* {@inheritdoc}
47
*/
48
public function get(ObjectValue $object)
49
{
50
if (!$this->map->has($object)) {
51
throw new UnexpectedValueException('Object mapping not found');
52
}
53
54
return $this->map->get($object);
55
}
56
57
/**
58
* {@inheritdoc}
59
*/
60
public function put(ObjectValue $object, $value)
61
{
62
if ($this->map->has($object)) {
63
throw new OverflowException('Object mapping already exists');
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.