Skip to content

Commit

Permalink
Merge pull request #180 from amauryvallier/patch-3
Browse files Browse the repository at this point in the history
Fix for mismatched method declarations
  • Loading branch information
gggeek authored Dec 6, 2018
2 parents e385a5f + 7fd4806 commit 4af18e2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Core/Matcher/ContentVersionMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,17 @@ public function matchContentVersions(array $versionConditions, Content $content)
}
}

protected function matchAnd(array $conditionsArray, $content)
protected function matchAnd(array $conditionsArray, $content = null)
{
/// @todo introduce proper re-validation of all child conditions
if (!is_array($conditionsArray) || !count($conditionsArray)) {
throw new \Exception($this->returns . " can not be matched because no matching conditions found for 'and' clause.");
}

if (is_null($content)) {
throw new \Exception($this->returns . " can not be matched because there was no content to match for 'and' clause.");
}

foreach ($conditionsArray as $conditions) {
$out = $this->matchContentVersions($conditions, $content);
if (!isset($results)) {
Expand All @@ -126,13 +130,17 @@ protected function matchAnd(array $conditionsArray, $content)
return $results;
}

protected function matchOr(array $conditionsArray, $content)
protected function matchOr(array $conditionsArray, $content = null)
{
/// @todo introduce proper re-validation of all child conditions
if (!is_array($conditionsArray) || !count($conditionsArray)) {
throw new \Exception($this->returns . " can not be matched because no matching conditions found for 'or' clause.");
}

if (is_null($content)) {
throw new \Exception($this->returns . " can not be matched because there was no content to match for 'or' clause.");
}

$results = array();
foreach ($conditionsArray as $conditions) {
$out = $this->matchContentVersions($conditions, $content);
Expand Down

0 comments on commit 4af18e2

Please sign in to comment.