Skip to content

Commit 2f64374

Browse files
committed
Accept OR conditions
see: modmore#197
1 parent 45124d3 commit 2f64374

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Command/ExtractCommand.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,17 @@ public function extractContent($folder, $options)
109109

110110
// Prepare the criteria for this context
111111
$contextCriteria = ($criteria) ? $criteria : array();
112-
$contextCriteria['context_key'] = $contextKey;
112+
113+
// Accept OR conditions (see: https://github.com/modmore/Gitify/pull/197)
114+
if (empty($contextCriteria) || count(array_filter(array_keys($contextCriteria), 'is_string')) > 0) {
115+
// associative array => and conditions
116+
$contextCriteria['context_key'] = $contextKey;
117+
} else {
118+
// sequential array => or conditions
119+
foreach ($contextCriteria as $i => $orCondition) {
120+
$contextCriteria[$i]['context_key'] = $contextKey;
121+
}
122+
}
113123

114124
// Grab the count
115125
$count = $this->modx->getCount('modResource', $contextCriteria);

0 commit comments

Comments
 (0)