/** * @param string $action * @return ObjectStateGroupCollection * @throws \Exception */ protected function matchObjectStateGroups($action) { if (!isset($this->dsl['match'])) { throw new \Exception("A match condition is required to {$action} an ObjectStateGroup."); } $match = $this->dsl['match']; // convert the references passed in the match foreach ($match as $condition => $values) { if (is_array($values)) { foreach ($values as $position => $value) { $match[$condition][$position] = $this->referenceResolver->resolveReference($value); } } else { $match[$condition] = $this->referenceResolver->resolveReference($values); } } return $this->objectStateGroupMatcher->match($match); }