| @@ -44,21 +44,21 @@ discard block | ||
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | 46 | $finder = new Finder(); | 
| 47 | -        $dockerComposeFileFilter = function (\SplFileInfo $file) { | |
| 47 | +        $dockerComposeFileFilter = function(\SplFileInfo $file) { | |
| 48 | 48 |              return $file->isFile() && preg_match('/^docker-compose(.)*\.(yaml|yml)$/', $file->getFilename()); | 
| 49 | 49 | }; | 
| 50 | 50 |          $finder->files()->filter($dockerComposeFileFilter)->in($containerProjectDir)->depth('== 0'); | 
| 51 | 51 | |
| 52 | 52 |          if (!$finder->hasResults()) { | 
| 53 | 53 |              $this->log->info("no docker-compose file found, let's create it"); | 
| 54 | - $this->createDockerComposeFile($containerProjectDir . '/docker-compose.yml'); | |
| 54 | + $this->createDockerComposeFile($containerProjectDir.'/docker-compose.yml'); | |
| 55 | 55 | return; | 
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | /** @var \SplFileInfo $file */ | 
| 59 | 59 |          foreach ($finder as $file) { | 
| 60 | 60 | $this->files[] = new DockerComposeFile($file); | 
| 61 | - $this->log->info($file->getFilename() . ' has been found'); | |
| 61 | + $this->log->info($file->getFilename().' has been found'); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 |          /*if (count($this->files) === 1) { | 
| @@ -91,13 +91,13 @@ discard block | ||
| 91 | 91 | private function createDockerComposeFile(string $path): void | 
| 92 | 92 |      { | 
| 93 | 93 | // TODO ask questions about version and so on! | 
| 94 | - file_put_contents($path, "version: '" . self::VERSION . "'"); | |
| 94 | + file_put_contents($path, "version: '".self::VERSION."'"); | |
| 95 | 95 | chown($path, fileowner(\dirname($path))); | 
| 96 | 96 | chgrp($path, filegroup(\dirname($path))); | 
| 97 | 97 | |
| 98 | 98 | $file = new DockerComposeFile(new \SplFileInfo($path)); | 
| 99 | 99 | $this->files[] = $file; | 
| 100 | - $this->log->info($file->getFilename() . ' was successfully created!'); | |
| 100 | + $this->log->info($file->getFilename().' was successfully created!'); | |
| 101 | 101 | } | 
| 102 | 102 | |
| 103 | 103 | /** | 
| @@ -107,20 +107,20 @@ discard block | ||
| 107 | 107 | */ | 
| 108 | 108 | public static function dockerComposeServiceSerialize(Service $service, string $version = self::VERSION): array | 
| 109 | 109 |      { | 
| 110 | -        $portMap = function (array $port): string { | |
| 111 | - return $port['source'] . ':' . $port['target']; | |
| 110 | +        $portMap = function(array $port): string { | |
| 111 | + return $port['source'].':'.$port['target']; | |
| 112 | 112 | }; | 
| 113 | -        $labelMap = function (array $label): string { | |
| 113 | +        $labelMap = function(array $label): string { | |
| 114 | 114 | return $label['value']; | 
| 115 | 115 | }; | 
| 116 | -        $envMap = function (EnvVariable $e): string { | |
| 116 | +        $envMap = function(EnvVariable $e): string { | |
| 117 | 117 | return $e->getValue(); | 
| 118 | 118 | }; | 
| 119 | 119 | /** | 
| 120 | 120 | * @param NamedVolume|BindVolume|TmpfsVolume $v | 
| 121 | 121 | * @return array | 
| 122 | 122 | */ | 
| 123 | -        $volumeMap = function ($v): array { | |
| 123 | +        $volumeMap = function($v): array { | |
| 124 | 124 | $array = [ | 
| 125 | 125 | 'type' => $v->getType(), | 
| 126 | 126 | 'source' => $v->getSource(), | 
| @@ -191,8 +191,8 @@ discard block | ||
| 191 | 191 | */ | 
| 192 | 192 | public static function mergeContentInDockerComposeFiles($content, array $files, bool $checkValidity = true): void | 
| 193 | 193 |      { | 
| 194 | - $tmpFile = __DIR__ . '/tmp-merge-content-file.yml'; | |
| 195 | - $tmpMergedFile = __DIR__ . '/tmp-merged-content-file.yml'; | |
| 194 | + $tmpFile = __DIR__.'/tmp-merge-content-file.yml'; | |
| 195 | + $tmpMergedFile = __DIR__.'/tmp-merged-content-file.yml'; | |
| 196 | 196 | |
| 197 | 197 |          if (\is_array($content)) { | 
| 198 | 198 | $content = Yaml::dump($content, 256, 2, Yaml::DUMP_OBJECT_AS_MAP); | 
| @@ -46,7 +46,7 @@ | ||
| 46 | 46 | */ | 
| 47 | 47 | public static function mergeContentIntoFile(string $content, string $file): void | 
| 48 | 48 |      { | 
| 49 | - $tmpFile = __DIR__ . '/tmp-yaml-tools-file.yml'; | |
| 49 | + $tmpFile = __DIR__.'/tmp-yaml-tools-file.yml'; | |
| 50 | 50 | $fileSystem = new Filesystem(); | 
| 51 | 51 | $fileSystem->dumpFile($tmpFile, $content); | 
| 52 | 52 | self::mergeTwoFiles($file, $tmpFile); | 
| @@ -30,18 +30,18 @@ discard block | ||
| 30 | 30 | $question = $this->getDeleteConfirmationQuestion($toDelete); | 
| 31 | 31 | $doDelete = $helper->ask($this->input, $this->output, $question); | 
| 32 | 32 |                  if ($doDelete) { | 
| 33 | -                    $this->log->debug('deleting ' . $toDelete . ' in ' . $file); | |
| 33 | +                    $this->log->debug('deleting '.$toDelete.' in '.$file); | |
| 34 | 34 | YamlTools::deleteYamlItem($toDelete, $file); | 
| 35 | 35 | } | 
| 36 | 36 | } | 
| 37 | 37 |              if (array_key_exists('namedVolumes', $payload) && array_key_exists('volumes', $ymlData)) { | 
| 38 | 38 |                  foreach ($payload['namedVolumes'] as $namedVolume) { | 
| 39 | 39 |                      if (array_key_exists($namedVolume, $ymlData['volumes'])) { | 
| 40 | - $toDelete = ['volumes', $namedVolume]; | |
| 40 | + $toDelete = ['volumes', $namedVolume]; | |
| 41 | 41 | $question = $this->getDeleteConfirmationQuestion($toDelete); | 
| 42 | 42 | $doDelete = $helper->ask($this->input, $this->output, $question); | 
| 43 | 43 |                          if ($doDelete) { | 
| 44 | -                            $this->log->debug('deleting ' . $toDelete . ' in ' . $file); | |
| 44 | +                            $this->log->debug('deleting '.$toDelete.' in '.$file); | |
| 45 | 45 | YamlTools::deleteYamlItem($toDelete, $file); | 
| 46 | 46 | } | 
| 47 | 47 | } | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | private function getDeleteConfirmationQuestion(array $elementToDel, bool $default = false): ConfirmationQuestion | 
| 60 | 60 |      { | 
| 61 | 61 | return new ConfirmationQuestion( | 
| 62 | -            'Do you want to delete ' . implode('->', $elementToDel) . " ? (y/n)\n > ", | |
| 62 | +            'Do you want to delete '.implode('->', $elementToDel)." ? (y/n)\n > ", | |
| 63 | 63 | $default | 
| 64 | 64 | ); | 
| 65 | 65 | } |