Code Duplication    Length = 19-22 lines in 2 locations

Core/Matcher/ContentVersionMatcher.php 2 locations

@@ 110-131 (lines=22) @@
107
        }
108
    }
109
110
    protected function matchAnd(array $conditionsArray, $content = null)
111
    {
112
        /// @todo introduce proper re-validation of all child conditions
113
        if (!is_array($conditionsArray) || !count($conditionsArray)) {
114
            throw new \Exception($this->returns . " can not be matched because no matching conditions found for 'and' clause.");
115
        }
116
117
        if (is_null($content)) {
118
            throw new \Exception($this->returns . " can not be matched because there was no content to match for 'and' clause.");
119
        }
120
121
        foreach ($conditionsArray as $conditions) {
122
            $out = $this->matchContentVersions($conditions, $content);
123
            if (!isset($results)) {
124
                $results = $out;
125
            } else {
126
                $results = array_intersect_key($results, $out);
127
            }
128
        }
129
130
        return $results;
131
    }
132
133
    protected function matchOr(array $conditionsArray, $content = null)
134
    {
@@ 133-151 (lines=19) @@
130
        return $results;
131
    }
132
133
    protected function matchOr(array $conditionsArray, $content = null)
134
    {
135
        /// @todo introduce proper re-validation of all child conditions
136
        if (!is_array($conditionsArray) || !count($conditionsArray)) {
137
            throw new \Exception($this->returns . " can not be matched because no matching conditions found for 'or' clause.");
138
        }
139
140
        if (is_null($content)) {
141
            throw new \Exception($this->returns . " can not be matched because there was no content to match for 'or' clause.");
142
        }
143
144
        $results = array();
145
        foreach ($conditionsArray as $conditions) {
146
            $out = $this->matchContentVersions($conditions, $content);
147
            $results = array_replace($results, $out);
148
        }
149
150
        return $results;
151
    }
152
153
    /**
154
     * @param Content $content