original_string: private function startNewService(Service $restoreService,StorageboxData $data, $backupKey, OutputInterface $output) {
  		$stackName = $data->getBackup()->getStackName();
  		$restoreServiceName = $restoreService->getName();
  
  		$dockerCompose = [
  			'version' => '2',
  			'services' => array_merge(
  				[$data->getBackup()->getServiceName() => $data->getService()],
  				$data->getSidekicks()
  			)
  		];
  		$rancherCompose = $data->getRancherData();
  
  		// TODO: Allow to set as option. If not set: ask user
  		$regex = '~$~';
  		$replacement = '-'.$backupKey;
  
  		foreach($this->modifiers as $modifier) {
  			if($modifier instanceof RequiresReplacementRegex)
  				$modifier->setReplacementRegex($regex, $replacement);
  
  			$modifier->modify($dockerCompose, $rancherCompose, $data);
  		}
  
  		// Start on the same server as the restore service
  		$compose = &$dockerCompose;
  		foreach([
  			        'services',
  			        $data->getNewServiceName(),
  			        'labels',
  		        ] as $key) {
  			if( !array_key_exists($key, $compose) )
  				$compose[$key] = [];
  			$compose = &$compose[$key];
  		}
  		$dockerCompose['services'][$data->getNewServiceName()]['labels']['io.rancher.scheduler.affinity:container_label_soft'] = "io.rancher.stack_service.name=${stackName}/${restoreServiceName}";
  
  		$dockerFileContent = Yaml::dump($dockerCompose, 100, 2);
  		$this->buildService->createDockerCompose($dockerFileContent);
  
  		$rancherFileContent = Yaml::dump($rancherCompose, 100, 2);
  		$this->buildService->createRancherCompose($rancherFileContent);
  
  		$stackName = $data->getBackup()->getStackName();
  		$newServiceName = $data->getNewServiceName();
  		$output->writeln("Starting $newServiceName.");
  		$this->rancherService->start( $this->getWorkDirectory(), $stackName);
  		$output->writeln("Waiting for $newServiceName to start.");
  		$this->rancherService->wait($stackName, $newServiceName, new SingleStateMatcher('active') );
  		$output->writeln("$newServiceName Started.");
  	}
code: private function startNewService(Service $restoreService,StorageboxData $data, $backupKey, OutputInterface $output) {
  		$stackName = $data->getBackup()->getStackName();
  		$restoreServiceName = $restoreService->getName();
  
  		$dockerCompose = [
  			'version' => '2',
  			'services' => array_merge(
  				[$data->getBackup()->getServiceName() => $data->getService()],
  				$data->getSidekicks()
  			)
  		];
  		$rancherCompose = $data->getRancherData();
  
  		// TODO: Allow to set as option. If not set: ask user
  		$regex = '~$~';
  		$replacement = '-'.$backupKey;
  
  		foreach($this->modifiers as $modifier) {
  			if($modifier instanceof RequiresReplacementRegex)
  				$modifier->setReplacementRegex($regex, $replacement);
  
  			$modifier->modify($dockerCompose, $rancherCompose, $data);
  		}
  
  		// Start on the same server as the restore service
  		$compose = &$dockerCompose;
  		foreach([
  			        'services',
  			        $data->getNewServiceName(),
  			        'labels',
  		        ] as $key) {
  			if( !array_key_exists($key, $compose) )
  				$compose[$key] = [];
  			$compose = &$compose[$key];
  		}
  		$dockerCompose['services'][$data->getNewServiceName()]['labels']['io.rancher.scheduler.affinity:container_label_soft'] = "io.rancher.stack_service.name=${stackName}/${restoreServiceName}";
  
  		$dockerFileContent = Yaml::dump($dockerCompose, 100, 2);
  		$this->buildService->createDockerCompose($dockerFileContent);
  
  		$rancherFileContent = Yaml::dump($rancherCompose, 100, 2);
  		$this->buildService->createRancherCompose($rancherFileContent);
  
  		$stackName = $data->getBackup()->getStackName();
  		$newServiceName = $data->getNewServiceName();
  		$output->writeln("Starting $newServiceName.");
  		$this->rancherService->start( $this->getWorkDirectory(), $stackName);
  		$output->writeln("Waiting for $newServiceName to start.");
  		$this->rancherService->wait($stackName, $newServiceName, new SingleStateMatcher('active') );
  		$output->writeln("$newServiceName Started.");
  	}
code_tokens: private function startNewService ( Service $ restoreService , StorageboxData $ data , $ backupKey , OutputInterface $ output ) { $ stackName = $ data -> getBackup ( ) -> getStackName ( ) ; $ restoreServiceName = $ restoreService -> getName ( ) ; $ dockerCompose = [ 'version' => '2' , 'services' => array_merge ( [ $ data -> getBackup ( ) -> getServiceName ( ) => $ data -> getService ( ) ] , $ data -> getSidekicks ( ) ) ] ; $ rancherCompose = $ data -> getRancherData ( ) ; // TODO: Allow to set as option. If not set: ask user $ regex = '~$~' ; $ replacement = '-' . $ backupKey ; foreach ( $ this -> modifiers as $ modifier ) { if ( $ modifier instanceof RequiresReplacementRegex ) $ modifier -> setReplacementRegex ( $ regex , $ replacement ) ; $ modifier -> modify ( $ dockerCompose , $ rancherCompose , $ data ) ; } // Start on the same server as the restore service $ compose = & $ dockerCompose ; foreach ( [ 'services' , $ data -> getNewServiceName ( ) , 'labels' , ] as $ key ) { if ( ! array_key_exists ( $ key , $ compose ) ) $ compose [ $ key ] = [ ] ; $ compose = & $ compose [ $ key ] ; } $ dockerCompose [ 'services' ] [ $ data -> getNewServiceName ( ) ] [ 'labels' ] [ 'io.rancher.scheduler.affinity:container_label_soft' ] = "io.rancher.stack_service.name=${stackName}/${restoreServiceName}" ; $ dockerFileContent = Yaml :: dump ( $ dockerCompose , 100 , 2 ) ; $ this -> buildService -> createDockerCompose ( $ dockerFileContent ) ; $ rancherFileContent = Yaml :: dump ( $ rancherCompose , 100 , 2 ) ; $ this -> buildService -> createRancherCompose ( $ rancherFileContent ) ; $ stackName = $ data -> getBackup ( ) -> getStackName ( ) ; $ newServiceName = $ data -> getNewServiceName ( ) ; $ output -> writeln ( "Starting $newServiceName." ) ; $ this -> rancherService -> start ( $ this -> getWorkDirectory ( ) , $ stackName ) ; $ output -> writeln ( "Waiting for $newServiceName to start." ) ; $ this -> rancherService -> wait ( $ stackName , $ newServiceName , new SingleStateMatcher ( 'active' ) ) ; $ output -> writeln ( "$newServiceName Started." ) ; }
docstring: Start the new service
  @param Service $restoreService
  @param StorageboxData $data
  @param $backupKey
  @param OutputInterface $output
docstring_tokens: Start the new service