Code Duplication    Length = 7-7 lines in 4 locations

Core/Matcher/QueryBasedMatcher.php 2 locations

@@ 125-131 (lines=7) @@
122
            case self::MATCH_CONTENT_TYPE_IDENTIFIER:
123
                return new Query\Criterion\ContentTypeIdentifier($values);
124
125
            case self::MATCH_CREATION_DATE:
126
                $match = reset($values);
127
                $operator = key($values);
128
                if (!isset(self::$operatorsMap[$operator])) {
129
                    throw new \Exception("Can not use '$operator' as comparison operator for dates");
130
                }
131
                return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::CREATED, self::$operatorsMap[$operator], $match);
132
133
            case self::MATCH_GROUP:
134
                foreach($values as &$value) {
@@ 141-147 (lines=7) @@
138
                }
139
                return new Query\Criterion\UserMetadata(Query\Criterion\UserMetadata::GROUP, Operator::IN, $values);
140
141
            case self::MATCH_MODIFICATION_DATE:
142
                $match = reset($values);
143
                $operator = key($values);
144
                if (!isset(self::$operatorsMap[$operator])) {
145
                    throw new \Exception("Can not use '$operator' as comparison operator for dates");
146
                }
147
                return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::MODIFIED, self::$operatorsMap[$operator], $match);
148
149
            case self::MATCH_OBJECT_STATE:
150
                foreach($values as &$value) {

Core/Matcher/LocationMatcher.php 2 locations

@@ 101-107 (lines=7) @@
98
        }
99
100
        switch ($key) {
101
            case self::MATCH_DEPTH:
102
                $match = reset($values);
103
                $operator = key($values);
104
                if (!isset(self::$operatorsMap[$operator])) {
105
                    throw new \Exception("Can not use '$operator' as comparison operator for depth");
106
                }
107
                return new Query\Criterion\Location\Depth(self::$operatorsMap[$operator], $match);
108
109
            case self::MATCH_IS_MAIN_LOCATION:
110
            case 'is_main':
@@ 119-125 (lines=7) @@
116
                    return new Query\Criterion\Location\IsMainLocation(Query\Criterion\Location\IsMainLocation::NOT_MAIN);
117
                }
118
119
            case self::MATCH_PRIORITY:
120
                $match = reset($values);
121
                $operator = key($values);
122
                if (!isset(self::$operatorsMap[$operator])) {
123
                    throw new \Exception("Can not use '$operator' as comparison operator for depth");
124
                }
125
                return new Query\Criterion\Location\Priority(self::$operatorsMap[$operator], $match);
126
        }
127
128
        return parent::getQueryCriterion($key, $values);