@@ -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); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->ask(); |
| 35 | 35 | |
| 36 | 36 | if ($doDelete) { |
| 37 | - $this->log->debug('deleting ' . $elemToDelete . ' in ' . $file); |
|
| 37 | + $this->log->debug('deleting '.$elemToDelete.' in '.$file); |
|
| 38 | 38 | YamlTools::deleteYamlItem($elemToDelete, $file); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ->ask(); |
| 51 | 51 | |
| 52 | 52 | if ($doDelete) { |
| 53 | - $this->log->debug('deleting ' . $elemToDelete . ' in ' . $file); |
|
| 53 | + $this->log->debug('deleting '.$elemToDelete.' in '.$file); |
|
| 54 | 54 | YamlTools::deleteYamlItem($elemToDelete, $file); |
| 55 | 55 | } |
| 56 | 56 | } |