| @@ 269-290 (lines=22) @@ | ||
| 266 | * |
|
| 267 | * @return AssetMapping |
|
| 268 | */ |
|
| 269 | private function getMappingByUuidPrefix($uuidPrefix) |
|
| 270 | { |
|
| 271 | $expr = Expr::method('getUuid', Expr::startsWith($uuidPrefix)); |
|
| 272 | ||
| 273 | $mappings = $this->assetManager->findAssetMappings($expr); |
|
| 274 | ||
| 275 | if (!$mappings) { |
|
| 276 | throw new RuntimeException(sprintf( |
|
| 277 | 'The mapping with the UUID prefix "%s" does not exist.', |
|
| 278 | $uuidPrefix |
|
| 279 | )); |
|
| 280 | } |
|
| 281 | ||
| 282 | if (count($mappings) > 1) { |
|
| 283 | throw new RuntimeException(sprintf( |
|
| 284 | 'More than one mapping matches the UUID prefix "%s".', |
|
| 285 | $uuidPrefix |
|
| 286 | )); |
|
| 287 | } |
|
| 288 | ||
| 289 | return reset($mappings); |
|
| 290 | } |
|
| 291 | ||
| 292 | private function mappingsEqual(AssetMapping $mapping1, AssetMapping $mapping2) |
|
| 293 | { |
|
| @@ 445-462 (lines=18) @@ | ||
| 442 | * |
|
| 443 | * @return BindingDescriptor |
|
| 444 | */ |
|
| 445 | private function getBindingByUuidPrefix($uuidPrefix) |
|
| 446 | { |
|
| 447 | $expr = Expr::method('getUuid', Expr::startsWith($uuidPrefix)); |
|
| 448 | $descriptors = $this->discoveryManager->findBindingDescriptors($expr); |
|
| 449 | ||
| 450 | if (0 === count($descriptors)) { |
|
| 451 | throw new RuntimeException(sprintf('The binding "%s" does not exist.', $uuidPrefix)); |
|
| 452 | } |
|
| 453 | ||
| 454 | if (count($descriptors) > 1) { |
|
| 455 | throw new RuntimeException(sprintf( |
|
| 456 | 'More than one binding matches the UUID prefix "%s".', |
|
| 457 | $uuidPrefix |
|
| 458 | )); |
|
| 459 | } |
|
| 460 | ||
| 461 | return reset($descriptors); |
|
| 462 | } |
|
| 463 | ||
| 464 | private function bindingsEqual(BindingDescriptor $descriptor1, BindingDescriptor $descriptor2) |
|
| 465 | { |
|