| @@ 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} |
|
| @@ 142-162 (lines=21) @@ | ||
| 139 | * @return ObjectStateCollection |
|
| 140 | * @throws \Exception |
|
| 141 | */ |
|
| 142 | private function matchObjectStates($action) |
|
| 143 | { |
|
| 144 | if (!isset($this->dsl['match'])) { |
|
| 145 | throw new \Exception("A match Condition is required to $action an object state."); |
|
| 146 | } |
|
| 147 | ||
| 148 | $match = $this->dsl['match']; |
|
| 149 | ||
| 150 | // convert the references passed in the match |
|
| 151 | foreach ($match as $condition => $values) { |
|
| 152 | if (is_array($values)) { |
|
| 153 | foreach ($values as $position => $value) { |
|
| 154 | $match[$condition][$position] = $this->referenceResolver->resolveReference($value); |
|
| 155 | } |
|
| 156 | } else { |
|
| 157 | $match[$condition] = $this->referenceResolver->resolveReference($values); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| 161 | return $this->objectStateMatcher->match($match); |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * {@inheritdoc} |
|
| @@ 100-120 (lines=21) @@ | ||
| 97 | * @return SectionCollection |
|
| 98 | * @throws \Exception |
|
| 99 | */ |
|
| 100 | protected function matchSections($action) |
|
| 101 | { |
|
| 102 | if (!isset($this->dsl['match'])) { |
|
| 103 | throw new \Exception("A match condition is required to $action a section."); |
|
| 104 | } |
|
| 105 | ||
| 106 | $match = $this->dsl['match']; |
|
| 107 | ||
| 108 | // convert the references passed in the match |
|
| 109 | foreach ($match as $condition => $values) { |
|
| 110 | if (is_array($values)) { |
|
| 111 | foreach ($values as $position => $value) { |
|
| 112 | $match[$condition][$position] = $this->referenceResolver->resolveReference($value); |
|
| 113 | } |
|
| 114 | } else { |
|
| 115 | $match[$condition] = $this->referenceResolver->resolveReference($values); |
|
| 116 | } |
|
| 117 | } |
|
| 118 | ||
| 119 | return $this->sectionMatcher->match($match); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * Sets references to certain section attributes. |
|