From f546025bae0aaf4c17201a940150255e96282e7a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 8 Mar 2012 01:46:49 +0100 Subject: [PATCH] Move some code around --- src/Composer/Repository/PackageRepository.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Composer/Repository/PackageRepository.php b/src/Composer/Repository/PackageRepository.php index fe2e83187..0bace24cc 100644 --- a/src/Composer/Repository/PackageRepository.php +++ b/src/Composer/Repository/PackageRepository.php @@ -34,6 +34,11 @@ class PackageRepository extends ArrayRepository public function __construct(array $config) { $this->config = $config['package']; + + // make sure we have an array of package definitions + if (!is_numeric(key($this->config))) { + $this->config = array($this->config); + } } /** @@ -43,10 +48,6 @@ class PackageRepository extends ArrayRepository { parent::initialize(); - if (!is_numeric(key($this->config))) { - $this->config = array($this->config); - } - $loader = new ArrayLoader(); foreach ($this->config as $package) { $package = $loader->load($package);