From 9cca065d8599d47ab78d24a5794e2ea1be3486d3 Mon Sep 17 00:00:00 2001 From: Alex Pods Date: Wed, 1 May 2013 10:39:32 +0400 Subject: [PATCH] [FrameworkBundle] Place initialization of $bundlesDir out of foreach loop Code enhancement. $bundlesDir variable doesnt't need any bundle information for initialization. So it must be placed out of the loop to not process unnecessary operations. --- .../Bundle/FrameworkBundle/Command/AssetsInstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 831c682e4b..863e14b22b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -80,13 +80,13 @@ EOT $filesystem = $this->getContainer()->get('filesystem'); // Create the bundles directory otherwise symlink will fail. - $filesystem->mkdir($targetArg.'/bundles/', 0777); + $bundlesDir = $targetArg.'/bundles/'; + $filesystem->mkdir($bundlesDir, 0777); $output->writeln(sprintf("Installing assets using the %s option", $input->getOption('symlink') ? 'symlink' : 'hard copy')); foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) { if (is_dir($originDir = $bundle->getPath().'/Resources/public')) { - $bundlesDir = $targetArg.'/bundles/'; $targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName())); $output->writeln(sprintf('Installing assets for %s into %s', $bundle->getNamespace(), $targetDir));