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.
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...
41
{
42
$user = $token->getUser();
43
44
if (!$user instanceof TaggableInterface) {
45
return false;
46
}
47
48
$tag = $subject;
49
50
switch ($attribute) {
51
case self::VIEW:
52
return $this->canView($tag, $user);
53
}
54
55
throw new \LogicException('This code should not be reached!');
56
}
57
58
/**
59
* Return true if the given $user can view the given $tag.
60
* The $entity can be viewed by the $user if the user is linked to that $tag.
61
*
62
* @param TagInterface $tag
63
* @param TaggableInterface $user
64
*
65
* @return bool
66
*/
67
private function canView(TagInterface $tag, TaggableInterface $user)
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.