Code Duplication    Length = 15-17 lines in 2 locations

src/Badger/Bundle/GameBundle/Security/TaggedEntityVoter.php 1 location

@@ 40-54 (lines=15) @@
37
    /**
38
     * {@inheritdoc}
39
     */
40
    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
41
    {
42
        $user = $token->getUser();
43
44
        if (!$user instanceof TaggableInterface) {
45
            return false;
46
        }
47
48
        switch ($attribute) {
49
            case self::VIEW:
50
                return $this->canView($subject, $user);
51
        }
52
53
        throw new \LogicException('This code should not be reached!');
54
    }
55
56
    /**
57
     * Return true if the given $user can view the given $entity.

src/Badger/Bundle/GameBundle/Security/TagVoter.php 1 location

@@ 40-56 (lines=17) @@
37
    /**
38
     * {@inheritdoc}
39
     */
40
    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
58
    /**
59
     * Return true if the given $user can view the given $tag.