Code Duplication    Length = 19-22 lines in 2 locations

Core/Matcher/ContentVersionMatcher.php 2 locations

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