@@ -10,6 +10,6 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public function __construct() |
| 12 | 12 | { |
| 13 | - parent::__construct('environment variable ' . PheromoneEnum::PHEROMONE_CONTAINER_PROJECT_DIR . ' is empty'); |
|
| 13 | + parent::__construct('environment variable '.PheromoneEnum::PHEROMONE_CONTAINER_PROJECT_DIR.' is empty'); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | if (!empty($toDelete)) { |
| 42 | 42 | foreach ($toDelete as $file) { |
| 43 | - $this->log->info('Deleting ' . $file); |
|
| 43 | + $this->log->info('Deleting '.$file); |
|
| 44 | 44 | unlink($file); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public static function emptyPayload(string $event): PayloadException |
| 12 | 12 | { |
| 13 | - return new self('payload missing for the event : ' . $event); |
|
| 13 | + return new self('payload missing for the event : '.$event); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 16 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 17 | 17 | |
| 18 | 18 | use TheAentMachine\AentApplication; |
| 19 | 19 | use TheAentMachine\AentDockerCompose\Command\AddEventCommand; |
@@ -29,22 +29,22 @@ |
||
| 29 | 29 | foreach ($dockerComposeFilePathnames as $file) { |
| 30 | 30 | $ymlData = Yaml::parseFile($file); |
| 31 | 31 | if (array_key_exists('serviceName', $ymlData) && array_key_exists($payload['serviceName'], $ymlData['services'])) { |
| 32 | - $toDelete = 'services.' . $payload['serviceName']; |
|
| 32 | + $toDelete = 'services.'.$payload['serviceName']; |
|
| 33 | 33 | $question = $this->getDeleteConfirmationQuestion($toDelete); |
| 34 | 34 | $doDelete = $helper->ask($this->input, $this->output, $question); |
| 35 | 35 | if ($doDelete) { |
| 36 | - $this->log->info('deleting ' . $toDelete . ' in ' . $file); |
|
| 36 | + $this->log->info('deleting '.$toDelete.' in '.$file); |
|
| 37 | 37 | YamlTools::delete($toDelete, $file, $file); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | if (array_key_exists('namedVolumes', $payload) && array_key_exists('volumes', $ymlData)) { |
| 41 | 41 | foreach ($payload['namedVolumes'] as $namedVolume) { |
| 42 | 42 | if (array_key_exists($namedVolume, $ymlData['volumes'])) { |
| 43 | - $toDelete = 'volumes.' . $namedVolume; |
|
| 43 | + $toDelete = 'volumes.'.$namedVolume; |
|
| 44 | 44 | $question = $this->getDeleteConfirmationQuestion($toDelete); |
| 45 | 45 | $doDelete = $helper->ask($this->input, $this->output, $question); |
| 46 | 46 | if ($doDelete) { |
| 47 | - $this->log->info('deleting ' . $toDelete . ' in ' . $file); |
|
| 47 | + $this->log->info('deleting '.$toDelete.' in '.$file); |
|
| 48 | 48 | YamlTools::delete($toDelete, $file, $file); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | |
| 7 | 7 | class YamlTools |
| 8 | 8 | { |
| 9 | - public const TMP_YAML_FILE = __DIR__ . '/tmp.yml'; |
|
| 10 | - public const TMP_MERGED_FILE = __DIR__ . '/tmp-merge.yml'; |
|
| 9 | + public const TMP_YAML_FILE = __DIR__.'/tmp.yml'; |
|
| 10 | + public const TMP_MERGED_FILE = __DIR__.'/tmp-merge.yml'; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Merge the content of $inputFile2 with $inputFile1's one, then write it into $outputFile (or stdout if empty) |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $finder = new Finder(); |
| 44 | - $dockerComposeFileFilter = function (\SplFileInfo $file) { |
|
| 44 | + $dockerComposeFileFilter = function(\SplFileInfo $file) { |
|
| 45 | 45 | return $file->isFile() && preg_match('/^docker-compose(.)*\.(yaml|yml)$/', $file->getFilename()); |
| 46 | 46 | }; |
| 47 | 47 | $finder->files()->filter($dockerComposeFileFilter)->in($containerProjectDir)->depth('== 0'); |
| 48 | 48 | |
| 49 | 49 | if (!$finder->hasResults()) { |
| 50 | 50 | $this->log->info("no docker-compose file found, let's create it"); |
| 51 | - $this->createDockerComposeFile($containerProjectDir . '/docker-compose.yml'); |
|
| 51 | + $this->createDockerComposeFile($containerProjectDir.'/docker-compose.yml'); |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** @var \SplFileInfo $file */ |
| 56 | 56 | foreach ($finder as $file) { |
| 57 | 57 | $this->files[] = new DockerComposeFile($file); |
| 58 | - $this->log->info($file->getFilename() . ' has been found'); |
|
| 58 | + $this->log->info($file->getFilename().' has been found'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /*if (count($this->files) === 1) { |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | private function createDockerComposeFile(string $path): void |
| 89 | 89 | { |
| 90 | 90 | // TODO ask questions about version and so on! |
| 91 | - file_put_contents($path, "version: '" . self::VERSION . "'"); |
|
| 91 | + file_put_contents($path, "version: '".self::VERSION."'"); |
|
| 92 | 92 | chown($path, fileowner(\dirname($path))); |
| 93 | 93 | chgrp($path, filegroup(\dirname($path))); |
| 94 | 94 | |
| 95 | 95 | $file = new DockerComposeFile(new \SplFileInfo($path)); |
| 96 | 96 | $this->files[] = $file; |
| 97 | - $this->log->info($file->getFilename() . ' was successfully created!'); |
|
| 97 | + $this->log->info($file->getFilename().' was successfully created!'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,20 +104,20 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public static function dockerComposeServiceSerialize(Service $service, string $version = self::VERSION): array |
| 106 | 106 | { |
| 107 | - $portMap = function (array $port): string { |
|
| 108 | - return $port['source'] . ':' . $port['target']; |
|
| 107 | + $portMap = function(array $port): string { |
|
| 108 | + return $port['source'].':'.$port['target']; |
|
| 109 | 109 | }; |
| 110 | - $labelMap = function (array $label): string { |
|
| 110 | + $labelMap = function(array $label): string { |
|
| 111 | 111 | return $label['value']; |
| 112 | 112 | }; |
| 113 | - $envMap = function (EnvVariable $e): string { |
|
| 113 | + $envMap = function(EnvVariable $e): string { |
|
| 114 | 114 | return $e->getValue(); |
| 115 | 115 | }; |
| 116 | 116 | /** |
| 117 | 117 | * @param NamedVolume|BindVolume|TmpfsVolume $v |
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | - $volumeMap = function ($v): array { |
|
| 120 | + $volumeMap = function($v): array { |
|
| 121 | 121 | $array = [ |
| 122 | 122 | 'type' => $v->getType(), |
| 123 | 123 | 'source' => $v->getSource(), |