@@ -15,11 +15,11 @@ |
||
| 15 | 15 | public function getImageTagsOnDockerHub(string $image): array |
| 16 | 16 | { |
| 17 | 17 | $client = new Client(); |
| 18 | - $res = $client->request('GET', 'https://registry.hub.docker.com/v1/repositories/'.$image.'/tags'); |
|
| 18 | + $res = $client->request('GET', 'https://registry.hub.docker.com/v1/repositories/' . $image . '/tags'); |
|
| 19 | 19 | |
| 20 | 20 | $response = \GuzzleHttp\json_decode($res->getBody(), true); |
| 21 | 21 | |
| 22 | - $tags = \array_map(function (array $item) { |
|
| 22 | + $tags = \array_map(function(array $item) { |
|
| 23 | 23 | return $item['name']; |
| 24 | 24 | }, $response); |
| 25 | 25 | |
@@ -7,6 +7,6 @@ |
||
| 7 | 7 | { |
| 8 | 8 | public static function cannotHandleEvent(string $eventName): self |
| 9 | 9 | { |
| 10 | - throw new self('Could not find an Aent that can handle events of type "'.$eventName.'"'); |
|
| 10 | + throw new self('Could not find an Aent that can handle events of type "' . $eventName . '"'); |
|
| 11 | 11 | } |
| 12 | 12 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | public function jsonSerialize(): array |
| 83 | 83 | { |
| 84 | - $jsonSerializeMap = function (\JsonSerializable $obj): array { |
|
| 84 | + $jsonSerializeMap = function(\JsonSerializable $obj): array { |
|
| 85 | 85 | return $obj->jsonSerialize(); |
| 86 | 86 | }; |
| 87 | 87 | |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | private function getAllEventNames(): array |
| 60 | 60 | { |
| 61 | - return array_map(function (EventCommand $event) { |
|
| 61 | + return array_map(function(EventCommand $event) { |
|
| 62 | 62 | return $event->getEventName(); |
| 63 | - }, \array_filter($this->getApplication()->all(), function (Command $command) { |
|
| 63 | + }, \array_filter($this->getApplication()->all(), function(Command $command) { |
|
| 64 | 64 | return $command instanceof EventCommand && !$command->isHidden(); |
| 65 | 65 | })); |
| 66 | 66 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $output->writeln('It seems that Aenthill does not know how or where to store this new service. You need to install a dedicated Aent for this.'); |
| 38 | 38 | $output->writeln('Most of the time, you want to put this service in a docker-compose.yml file. We have a pretty good Aent for this: <info>theaentmachine/aent-docker-compose</info>.'); |
| 39 | 39 | $question = new Question('Do you want me to add this Aent for you? (y/n) ', 'y'); |
| 40 | - $question->setValidator(function (string $value) { |
|
| 40 | + $question->setValidator(function(string $value) { |
|
| 41 | 41 | $value = \strtolower(trim($value)); |
| 42 | 42 | |
| 43 | 43 | if ($value !== 'y' && $value !== 'n') { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $output->writeln('It seems that Aenthill does not know how to bind your container to a domain name. You need to install a reverse proxy for this.'); |
| 87 | 87 | $output->writeln('Traefik is a good reverse proxy. We have an Aent to add Traefik to your project: <info>theaentmachine/aent-traefik</info>.'); |
| 88 | 88 | $question = new Question('Do you want me to add this Aent for you? (y/n) ', 'y'); |
| 89 | - $question->setValidator(function (string $value) { |
|
| 89 | + $question->setValidator(function(string $value) { |
|
| 90 | 90 | $value = \strtolower(trim($value)); |
| 91 | 91 | |
| 92 | 92 | if ($value !== 'y' && $value !== 'n') { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public function filterBestTags(array $tags): array |
| 19 | 19 | { |
| 20 | 20 | // filter numeric versions only |
| 21 | - $versions = \array_filter($tags, function (string $tag) { |
|
| 21 | + $versions = \array_filter($tags, function(string $tag) { |
|
| 22 | 22 | return \preg_match('/^\d+(\.\d+)*$/', $tag); |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | foreach ($subtree as $key => $subsubtree) { |
| 74 | 74 | $values = $this->getMaxLeafs($subsubtree); |
| 75 | 75 | foreach ($values as $val) { |
| 76 | - $arr[] = $key.'.'.$val; |
|
| 76 | + $arr[] = $key . '.' . $val; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | return $arr; |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | public function __construct(string $replyDirectory = null) |
| 17 | 17 | { |
| 18 | 18 | if ($replyDirectory === null) { |
| 19 | - $replyDirectory = \sys_get_temp_dir().'/replies'; |
|
| 19 | + $replyDirectory = \sys_get_temp_dir() . '/replies'; |
|
| 20 | 20 | } |
| 21 | - $this->replyDirectory = rtrim($replyDirectory, '/').'/'; |
|
| 21 | + $this->replyDirectory = rtrim($replyDirectory, '/') . '/'; |
|
| 22 | 22 | if (!\file_exists($replyDirectory)) { |
| 23 | 23 | \mkdir($replyDirectory, 0777, true); |
| 24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function clear(): void |
| 31 | 31 | { |
| 32 | - $files = glob($this->replyDirectory.'*'); // get all file names |
|
| 32 | + $files = glob($this->replyDirectory . '*'); // get all file names |
|
| 33 | 33 | foreach ($files as $file) { // iterate files |
| 34 | 34 | if (is_file($file)) { |
| 35 | 35 | unlink($file); // delete file |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | private function getNextFileName(): string |
| 41 | 41 | { |
| 42 | 42 | $i = 0; |
| 43 | - while (\file_exists($this->replyDirectory.'tmp'.$i)) { |
|
| 43 | + while (\file_exists($this->replyDirectory . 'tmp' . $i)) { |
|
| 44 | 44 | $i++; |
| 45 | 45 | } |
| 46 | - return 'tmp'.$i; |
|
| 46 | + return 'tmp' . $i; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function storeReply(string $payload): void |
| 50 | 50 | { |
| 51 | - $path = $this->replyDirectory.$this->getNextFileName(); |
|
| 51 | + $path = $this->replyDirectory . $this->getNextFileName(); |
|
| 52 | 52 | \file_put_contents($path, $payload); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $i = 0; |
| 61 | 61 | $replies = []; |
| 62 | - while (\file_exists($this->replyDirectory.'tmp'.$i)) { |
|
| 63 | - $replies[] = \file_get_contents($this->replyDirectory.'tmp'.$i); |
|
| 62 | + while (\file_exists($this->replyDirectory . 'tmp' . $i)) { |
|
| 63 | + $replies[] = \file_get_contents($this->replyDirectory . 'tmp' . $i); |
|
| 64 | 64 | $i++; |
| 65 | 65 | } |
| 66 | 66 | return $replies; |
@@ -37,11 +37,11 @@ |
||
| 37 | 37 | public static function dispatchJson(string $event, $payload): array |
| 38 | 38 | { |
| 39 | 39 | if (\is_object($payload) && !$payload instanceof \JsonSerializable) { |
| 40 | - throw new \RuntimeException('Payload object should implement JsonSerializable. Got an instance of '.\get_class($payload)); |
|
| 40 | + throw new \RuntimeException('Payload object should implement JsonSerializable. Got an instance of ' . \get_class($payload)); |
|
| 41 | 41 | } |
| 42 | 42 | $replies = self::dispatch($event, \json_encode($payload)); |
| 43 | 43 | |
| 44 | - return \array_map(function (string $reply) { |
|
| 44 | + return \array_map(function(string $reply) { |
|
| 45 | 45 | return \GuzzleHttp\json_decode($reply, true); |
| 46 | 46 | }, $replies); |
| 47 | 47 | } |