Code Duplication    Length = 24-26 lines in 2 locations

Core/Matcher/TagMatcher.php 1 location

@@ 62-87 (lines=26) @@
59
60
        $this->validateConditions($conditions);
61
62
        foreach ($conditions as $key => $values) {
63
64
            if (!is_array($values)) {
65
                $values = array($values);
66
            }
67
68
            switch ($key) {
69
                case 'id':
70
                case self::MATCH_TAG_ID:
71
                   return new TagCollection($this->findTagsByIds($values));
72
73
                case 'remote_id':
74
                case self::MATCH_TAG_REMOTE_ID:
75
                    return new TagCollection($this->findTagsByRemoteIds($values));
76
77
                case 'keyword':
78
                case self::MATCH_TAG_KEYWORD:
79
                    return new TagCollection($this->findTagsByKeywords($values));
80
81
                case self::MATCH_AND:
82
                    return $this->matchAnd($values);
83
84
                case self::MATCH_OR:
85
                    return $this->matchOr($values);
86
            }
87
        }
88
    }
89
90
    protected function getConditionsFromKey($key)

Core/Matcher/UserMatcher.php 1 location

@@ 42-65 (lines=24) @@
39
    {
40
        $this->validateConditions($conditions);
41
42
        foreach ($conditions as $key => $values) {
43
44
            if (!is_array($values)) {
45
                $values = array($values);
46
            }
47
48
            switch ($key) {
49
                case 'id':
50
                case self::MATCH_USER_ID:
51
                   return new UserCollection($this->findUsersById($values));
52
53
                case self::MATCH_USER_LOGIN:
54
                    return new UserCollection($this->findUsersByLogin($values));
55
56
                case self::MATCH_USER_EMAIL:
57
                    return new UserCollection($this->findUsersByEmail($values));
58
59
                case self::MATCH_AND:
60
                    return $this->matchAnd($values);
61
62
                case self::MATCH_OR:
63
                    return $this->matchOr($values);
64
            }
65
        }
66
    }
67
68
    /**