| @@ 128-148 (lines=21) @@ | ||
| 125 | * @return ObjectStateGroupCollection |
|
| 126 | * @throws \Exception |
|
| 127 | */ |
|
| 128 | protected function matchObjectStateGroups($action) |
|
| 129 | { |
|
| 130 | if (!isset($this->dsl['match'])) { |
|
| 131 | throw new \Exception("A match condition is required to $action an ObjectStateGroup."); |
|
| 132 | } |
|
| 133 | ||
| 134 | $match = $this->dsl['match']; |
|
| 135 | ||
| 136 | // convert the references passed in the match |
|
| 137 | foreach ($match as $condition => $values) { |
|
| 138 | if (is_array($values)) { |
|
| 139 | foreach ($values as $position => $value) { |
|
| 140 | $match[$condition][$position] = $this->referenceResolver->resolveReference($value); |
|
| 141 | } |
|
| 142 | } else { |
|
| 143 | $match[$condition] = $this->referenceResolver->resolveReference($values); |
|
| 144 | } |
|
| 145 | } |
|
| 146 | ||
| 147 | return $this->objectStateGroupMatcher->match($match); |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * {@inheritdoc} |
|
| @@ 143-163 (lines=21) @@ | ||
| 140 | * @return ObjectStateCollection |
|
| 141 | * @throws \Exception |
|
| 142 | */ |
|
| 143 | private function matchObjectStates($action) |
|
| 144 | { |
|
| 145 | if (!isset($this->dsl['match'])) { |
|
| 146 | throw new \Exception("A match Condition is required to $action an object state."); |
|
| 147 | } |
|
| 148 | ||
| 149 | $match = $this->dsl['match']; |
|
| 150 | ||
| 151 | // convert the references passed in the match |
|
| 152 | foreach ($match as $condition => $values) { |
|
| 153 | if (is_array($values)) { |
|
| 154 | foreach ($values as $position => $value) { |
|
| 155 | $match[$condition][$position] = $this->referenceResolver->resolveReference($value); |
|
| 156 | } |
|
| 157 | } else { |
|
| 158 | $match[$condition] = $this->referenceResolver->resolveReference($values); |
|
| 159 | } |
|
| 160 | } |
|
| 161 | ||
| 162 | return $this->objectStateMatcher->match($match); |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * {@inheritdoc} |
|