@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | if ($this->default) { |
95 | 95 | if (!$this->yesNoQuestion) { |
96 | - $text .= ' ['.$this->default.']'; |
|
96 | + $text .= ' [' . $this->default . ']'; |
|
97 | 97 | } elseif ($this->default === 'y') { |
98 | 98 | $text .= ' [Y/n]'; |
99 | 99 | } elseif ($this->default === 'n') { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $validator = $this->validator; |
113 | 113 | |
114 | 114 | if ($this->yesNoQuestion) { |
115 | - $validator = function (?string $response) use ($validator) { |
|
115 | + $validator = function(?string $response) use ($validator) { |
|
116 | 116 | $response = $response ?? ''; |
117 | 117 | $response = \strtolower(trim($response)); |
118 | 118 | if (!\in_array($response, ['y', 'n', 'yes', 'no'])) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($this->helpText !== null) { |
127 | - $validator = function (?string $response) use ($validator) { |
|
127 | + $validator = function(?string $response) use ($validator) { |
|
128 | 128 | $response = $response ?? ''; |
129 | 129 | if (trim($response) === '?') { |
130 | 130 | $this->output->writeln($this->helpText ?: ''); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | if ($this->compulsory) { |
138 | - $validator = function (?string $response) use ($validator) { |
|
138 | + $validator = function(?string $response) use ($validator) { |
|
139 | 139 | $response = $response ?? ''; |
140 | 140 | if (trim($response) === '') { |
141 | 141 | throw new \InvalidArgumentException('This field is compulsory.'); |
@@ -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,10 +59,10 @@ discard block |
||
59 | 59 | { |
60 | 60 | $i = 0; |
61 | 61 | $replies = []; |
62 | - while (\file_exists($this->replyDirectory.'tmp'.$i)) { |
|
63 | - $content = \file_get_contents($this->replyDirectory.'tmp'.$i); |
|
62 | + while (\file_exists($this->replyDirectory . 'tmp' . $i)) { |
|
63 | + $content = \file_get_contents($this->replyDirectory . 'tmp' . $i); |
|
64 | 64 | if ($content === false) { |
65 | - throw new \RuntimeException('Failed to load file '.$this->replyDirectory.'tmp'.$i); |
|
65 | + throw new \RuntimeException('Failed to load file ' . $this->replyDirectory . 'tmp' . $i); |
|
66 | 66 | } |
67 | 67 | $replies[] = $content; |
68 | 68 | $i++; |
@@ -37,11 +37,11 @@ discard block |
||
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, \GuzzleHttp\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 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $aenthillJSONstr = file_get_contents($containerProjectDir . '/aenthill.json'); |
116 | 116 | if ($aenthillJSONstr === false) { |
117 | - throw new \RuntimeException('Failed to load file '.$containerProjectDir . '/aenthill.json'); |
|
117 | + throw new \RuntimeException('Failed to load file ' . $containerProjectDir . '/aenthill.json'); |
|
118 | 118 | } |
119 | 119 | $aenthillJSON = \GuzzleHttp\json_decode($aenthillJSONstr, true); |
120 | 120 |