minor #21529 [FrameworkBundle] Simplify createPackageDefinition (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Simplify createPackageDefinition

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Minor simplification.

Commits
-------

4b81393 [FrameworkBundle] Simplify createPackageDefinition
This commit is contained in:
Nicolas Grekas 2017-02-14 13:45:10 +01:00
commit 298060d0a0

View File

@ -619,23 +619,14 @@ class FrameworkExtension extends Extension
throw new \LogicException('An asset package cannot have base URLs and base paths.');
}
if (!$baseUrls) {
$package = new DefinitionDecorator('assets.path_package');
return $package
->setPublic(false)
->replaceArgument(0, $basePath)
->replaceArgument(1, $version)
;
}
$package = new DefinitionDecorator('assets.url_package');
return $package
$package = new DefinitionDecorator($baseUrls ? 'assets.url_package' : 'assets.path_package');
$package
->setPublic(false)
->replaceArgument(0, $baseUrls)
->replaceArgument(0, $baseUrls ?: $basePath)
->replaceArgument(1, $version)
;
return $package;
}
private function createVersion(ContainerBuilder $container, $version, $format, $name)