| @@ 332-349 (lines=18) @@ | ||
| 329 | * @return ContentTypeCollection |
|
| 330 | * @throws \Exception |
|
| 331 | */ |
|
| 332 | protected function matchContentTypes($action, $step) |
|
| 333 | { |
|
| 334 | if (!isset($step->dsl['identifier']) && !isset($step->dsl['match'])) { |
|
| 335 | throw new \Exception("The identifier of a content type or a match condition is required to $action it"); |
|
| 336 | } |
|
| 337 | ||
| 338 | // Backwards compat |
|
| 339 | if (isset($step->dsl['match'])) { |
|
| 340 | $match = $step->dsl['match']; |
|
| 341 | } else { |
|
| 342 | $match = array('identifier' => $step->dsl['identifier']); |
|
| 343 | } |
|
| 344 | ||
| 345 | // convert the references passed in the match |
|
| 346 | $match = $this->resolveReferencesRecursively($match); |
|
| 347 | ||
| 348 | return $this->contentTypeMatcher->match($match); |
|
| 349 | } |
|
| 350 | ||
| 351 | /** |
|
| 352 | * @param ContentType $contentType |
|
| @@ 151-168 (lines=18) @@ | ||
| 148 | * @return RoleCollection |
|
| 149 | * @throws \Exception |
|
| 150 | */ |
|
| 151 | protected function matchRoles($action, $step) |
|
| 152 | { |
|
| 153 | if (!isset($step->dsl['name']) && !isset($step->dsl['match'])) { |
|
| 154 | throw new \Exception("The name of a role or a match condition is required to $action it"); |
|
| 155 | } |
|
| 156 | ||
| 157 | // Backwards compat |
|
| 158 | if (isset($step->dsl['match'])) { |
|
| 159 | $match = $step->dsl['match']; |
|
| 160 | } else { |
|
| 161 | $match = array('identifier' => $step->dsl['name']); |
|
| 162 | } |
|
| 163 | ||
| 164 | // convert the references passed in the match |
|
| 165 | $match = $this->resolveReferencesRecursively($match); |
|
| 166 | ||
| 167 | return $this->roleMatcher->match($match); |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @param Role $role |
|