private function loadConfigs($basePath, array $config, $profile)
{
$configs = array();
// first load default profile from current config, but only if custom profile requested
if ('default' !== $profile && isset($config['default'])) {
$configs[] = $config['default'];
}
// then recursively load profiles from imports
if (isset($config['imports']) && is_array($config['imports'])) {
$configs = array_merge($configs, $this->loadImports($basePath, $config['imports'], $profile));
}
// then load specific profile from current config
if (isset($config[$profile])) {
$configs[] = $config[$profile];
$this->profileFound = true;
}
return $configs;
}