/**
  * @return array
  */
 private function readConfig()
 {
     $directories = array($this->system->getPath());
     $locator = new FileLocator($directories);
     $loader = new YamlConfigLoader($locator);
     $configValues = $loader->load($locator->locate($this->system->getFileName()));
     foreach ($configValues['deploy']['type'] as $typeName => &$type) {
         foreach ($type as $instanceName => &$instance) {
             foreach ($instance as $configPartName => $configPart) {
                 switch ($typeName) {
                     case 'database':
                         if (isset($instance['options']) && isset($instance['options']['ignoreTables'])) {
                             $instance['options']['ignoreTables'] = $this->flattenYamlMergedSequenceWithScalars($instance['options']['ignoreTables']);
                         }
                         if (isset($instance['options']) && isset($instance['options']['databases'])) {
                             foreach ($instance['options']['databases'] as $key => $databaseConfig) {
                                 if (isset($databaseConfig['configFile']) && strlen($databaseConfig['configFile'])) {
                                     if ($this->driver->supports($databaseConfig['configFile'])) {
                                         $databaseConfigImported = $this->driver->load($this->rootPath . $databaseConfig['configFile']);
                                         $instance['options']['databases'][$key] = array_merge($instance['options']['databases'][$key], $databaseConfigImported);
                                     } else {
                                         throw new \InvalidArgumentException(sprintf("The config file '%s' appears to have an invalid format.", $databaseConfig['configFile']));
                                     }
                                 }
                             }
                         }
                         break;
                     case 'media':
                         if (isset($instance['options'])) {
                             if (isset($instance['options']['excludePatterns'])) {
                                 $instance['options']['excludePatterns'] = $this->flattenYamlMergedSequenceWithArrays($instance['options']['excludePatterns']);
                             }
                             if (isset($instance['options']['folders'])) {
                                 $instance['options']['folders'] = $this->flattenYamlMergedSequenceWithArrays($instance['options']['folders']);
                             }
                         }
                         break;
                 }
             }
         }
     }
     $processor = new Processor();
     $configuration = new BaseConfiguration();
     $processedConfiguration = $processor->processConfiguration($configuration, $configValues);
     foreach ($processedConfiguration['type'] as $typeName => &$type) {
         foreach ($type as $instanceName => &$instance) {
             foreach ($this->settingsTypes as $configPartName) {
                 if ($instanceName != '_allInstances' && $typeName != '_allTypes') {
                     switch ($configPartName) {
                         case 'instance':
                             $this->fallbackNode('accessIp', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('host', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('user', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('port', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         case 'proxy':
                             $this->fallbackNode('user', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('host', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('port', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         case 'options':
                             $this->fallbackNode('folders', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('excludePatterns', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('ignoreTables', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('databases', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         default:
                     }
                 }
             }
             if ($instanceName != '_allInstances' && $typeName != '_allTypes') {
                 $this->checkPaths($instance);
             }
         }
     }
     return $processedConfiguration;
 }
 /**
  * @return array
  */
 private function readConfig()
 {
     $directories = array($this->system->getPath());
     $locator = new FileLocator($directories);
     $loader = new YamlConfigLoader($locator);
     $configValues = $loader->load($locator->locate($this->system->getFileName()));
     foreach ($configValues['deploy']['type'] as $typeName => &$type) {
         foreach ($type as $instanceName => &$instance) {
             foreach ($instance as $configPartName => $configPart) {
                 switch ($typeName) {
                     case 'database':
                         if (isset($instance['options']) && isset($instance['options']['ignoreTables'])) {
                             $instance['options']['ignoreTables'] = $this->flattenYamlMergedSequenceWithScalars($instance['options']['ignoreTables']);
                         }
                         if (isset($instance['options']) && isset($instance['options']['databases'])) {
                             foreach ($instance['options']['databases'] as $key => $databaseConfig) {
                                 if (isset($databaseConfig['configFile']) && isset($databaseConfig['code']) && isset($databaseConfig['configFile']['filePath']) && is_array($databaseConfig['configFile'])) {
                                     $configType = isset($databaseConfig['configFile']['type']) ? $databaseConfig['configFile']['type'] : null;
                                     switch ($configType) {
                                         case 'typo3':
                                             $driver = new Typo3Driver();
                                             break;
                                         case 'symfony':
                                             $driver = new Symfony2Driver();
                                             break;
                                         case 'magento':
                                             $driver = new MagentoDriver();
                                             break;
                                         default:
                                             $driver = new InstanceManagerDriver();
                                     }
                                     $databaseConfigImported = $driver->getDatabaseConfig(array('configFilePath' => $this->rootPath . $databaseConfig['configFile']['filePath'], 'databaseCode' => $databaseConfig['code']));
                                     $instance['options']['databases'][$key] = array_merge($instance['options']['databases'][$key], $databaseConfigImported);
                                 }
                             }
                         }
                         break;
                     case 'media':
                         if (isset($instance['options'])) {
                             if (isset($instance['options']['excludePatterns'])) {
                                 $instance['options']['excludePatterns'] = $this->flattenYamlMergedSequenceWithArrays($instance['options']['excludePatterns']);
                             }
                             if (isset($instance['options']['folders'])) {
                                 $instance['options']['folders'] = $this->flattenYamlMergedSequenceWithArrays($instance['options']['folders']);
                             }
                         }
                         break;
                 }
             }
         }
     }
     $processor = new Processor();
     $configuration = new BaseConfiguration();
     $processedConfiguration = $processor->processConfiguration($configuration, $configValues);
     foreach ($processedConfiguration['type'] as $typeName => &$type) {
         foreach ($type as $instanceName => &$instance) {
             foreach ($this->settingsTypes as $configPartName) {
                 if ($instanceName != '_allInstances' && $typeName != '_allTypes') {
                     switch ($configPartName) {
                         case 'instance':
                             $this->fallbackNode('accessIp', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('host', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('user', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('port', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         case 'proxy':
                             $this->fallbackNode('user', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('host', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('port', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         case 'options':
                             $this->fallbackNode('folders', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('excludePatterns', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('ignoreTables', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             $this->fallbackNode('databases', $instance, $instanceName, $type, $typeName, $configPartName, $processedConfiguration);
                             break;
                         default:
                     }
                 }
             }
             if ($instanceName != '_allInstances' && $typeName != '_allTypes') {
                 $this->checkPaths($instance);
             }
         }
     }
     //        print_r($processedConfiguration); die('$processedConfiguration at 04.02.2016 21:28');
     return $processedConfiguration;
 }