| @@ 271-288 (lines=18) @@ | ||
| 268 | * @return ContentTypeCollection |
|
| 269 | * @throws \Exception |
|
| 270 | */ |
|
| 271 | protected function matchContentTypes($action, $step) |
|
| 272 | { |
|
| 273 | if (!isset($step->dsl['identifier']) && !isset($step->dsl['match'])) { |
|
| 274 | throw new \Exception("The identifier of a content type or a match condition is required to $action it"); |
|
| 275 | } |
|
| 276 | ||
| 277 | // Backwards compat |
|
| 278 | if (isset($step->dsl['match'])) { |
|
| 279 | $match = $step->dsl['match']; |
|
| 280 | } else { |
|
| 281 | $match = array('identifier' => $step->dsl['identifier']); |
|
| 282 | } |
|
| 283 | ||
| 284 | // convert the references passed in the match |
|
| 285 | $match = $this->resolveReferencesRecursively($match); |
|
| 286 | ||
| 287 | return $this->contentTypeMatcher->match($match); |
|
| 288 | } |
|
| 289 | ||
| 290 | /** |
|
| 291 | * Sets references to object attributes |
|
| @@ 224-241 (lines=18) @@ | ||
| 221 | * @return LocationCollection |
|
| 222 | * @throws \Exception |
|
| 223 | */ |
|
| 224 | protected function matchLocations($action, $step) |
|
| 225 | { |
|
| 226 | if (!isset($step->dsl['location_id']) && !isset($step->dsl['match'])) { |
|
| 227 | throw new \Exception("The id or a match condition is required to $action a location"); |
|
| 228 | } |
|
| 229 | ||
| 230 | // Backwards compat |
|
| 231 | if (isset($step->dsl['match'])) { |
|
| 232 | $match = $step->dsl['match']; |
|
| 233 | } else { |
|
| 234 | $match = array('location_id' => $step->dsl['location_id']); |
|
| 235 | } |
|
| 236 | ||
| 237 | // convert the references passed in the match |
|
| 238 | $match = $this->resolveReferencesRecursively($match); |
|
| 239 | ||
| 240 | return $this->locationMatcher->match($match); |
|
| 241 | } |
|
| 242 | ||
| 243 | /** |
|
| 244 | * Sets references to object attributes |
|
| @@ 138-155 (lines=18) @@ | ||
| 135 | * @return RoleCollection |
|
| 136 | * @throws \Exception |
|
| 137 | */ |
|
| 138 | protected function matchRoles($action, $step) |
|
| 139 | { |
|
| 140 | if (!isset($step->dsl['name']) && !isset($step->dsl['match'])) { |
|
| 141 | throw new \Exception("The name of a role or a match condition is required to $action it"); |
|
| 142 | } |
|
| 143 | ||
| 144 | // Backwards compat |
|
| 145 | if (isset($step->dsl['match'])) { |
|
| 146 | $match = $step->dsl['match']; |
|
| 147 | } else { |
|
| 148 | $match = array('identifier' => $step->dsl['name']); |
|
| 149 | } |
|
| 150 | ||
| 151 | // convert the references passed in the match |
|
| 152 | $match = $this->resolveReferencesRecursively($match); |
|
| 153 | ||
| 154 | return $this->roleMatcher->match($match); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * Set references to object attributes to be retrieved later. |
|