Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 17 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
40 | View Code Duplication | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) |
|
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 | |||
72 |
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.