/**
  * Creates a phpbu configuration.
  *
  * @return \phpbu\App\Configuration
  */
 protected function createConfiguration()
 {
     // check if a phpbu xml/json config file is configured
     $phpbuConfigFile = $this->configProxy->get('phpbu.phpbu');
     if (!empty($phpbuConfigFile)) {
         // load xml or json configurations
         $configLoader = PhpbuConfigLoaderFactory::createLoader($phpbuConfigFile);
         $configuration = $configLoader->getConfiguration();
     } else {
         $this->validateConfig();
         // no phpbu config so translate the laravel settings
         $translator = new Translator();
         $configuration = $translator->translate($this->configProxy);
         // in laravel mode we sync everything using the Laravel Filesystems
         PhpbuFactory::register('sync', 'laravel-storage', '\\phpbu\\Laravel\\Backup\\Sync\\LaravelStorage');
     }
     return $configuration;
 }
Example #2
0
 /**
  * Create a application configuration.
  *
  * @return \phpbu\App\Configuration
  */
 protected function createConfiguration()
 {
     $configLoader = Configuration\Loader\Factory::createLoader($this->arguments['configuration']);
     $configuration = $configLoader->getConfiguration();
     // command line arguments overrule the config file settings
     if (Arr::getValue($this->arguments, 'verbose') === true) {
         $configuration->setVerbose(true);
     }
     if (Arr::getValue($this->arguments, 'colors') === true) {
         $configuration->setColors(true);
     }
     if (Arr::getValue($this->arguments, 'debug') === true) {
         $configuration->setDebug(true);
     }
     if (Arr::getValue($this->arguments, 'simulate') === true) {
         $configuration->setSimulate(true);
     }
     $bootstrap = Arr::getValue($this->arguments, 'bootstrap');
     if (!empty($bootstrap)) {
         $configuration->setBootstrap($bootstrap);
     }
     // add a cli printer for some output
     $configuration->addLogger(new Result\PrinterCli($configuration->getVerbose(), $configuration->getColors(), $configuration->getDebug()));
     return $configuration;
 }