Completed
Push — master ( 3459f8...7d0244 )
by Julien
15s
created
src/Helper/ReplyAggregator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
     public function __construct(string $replyDirectory = null)
16 16
     {
17 17
         if ($replyDirectory === null) {
18
-            $replyDirectory = \sys_get_temp_dir().'/replies';
18
+            $replyDirectory = \sys_get_temp_dir() . '/replies';
19 19
         }
20
-        $this->replyDirectory = rtrim($replyDirectory, '/').'/';
20
+        $this->replyDirectory = rtrim($replyDirectory, '/') . '/';
21 21
         if (!\file_exists($replyDirectory)) {
22 22
             if (!mkdir($replyDirectory, 0777, true) && !is_dir($replyDirectory)) {
23 23
                 throw new \RuntimeException(sprintf('Directory "%s" was not created', $replyDirectory));
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function clear(): void
32 32
     {
33
-        $files = glob($this->replyDirectory.'*'); // get all file names
33
+        $files = glob($this->replyDirectory . '*'); // get all file names
34 34
         foreach ($files as $file) { // iterate files
35 35
             if (is_file($file)) {
36 36
                 unlink($file); // delete file
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
     private function getNextFileName(): string
42 42
     {
43 43
         $i = 0;
44
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
44
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
45 45
             $i++;
46 46
         }
47
-        return 'tmp'.$i;
47
+        return 'tmp' . $i;
48 48
     }
49 49
 
50 50
     public function storeReply(string $payload): void
51 51
     {
52
-        $path = $this->replyDirectory.$this->getNextFileName();
52
+        $path = $this->replyDirectory . $this->getNextFileName();
53 53
         \file_put_contents($path, $payload);
54 54
     }
55 55
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $i = 0;
62 62
         $replies = [];
63
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
64
-            $content = \file_get_contents($this->replyDirectory.'tmp'.$i);
63
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
64
+            $content = \file_get_contents($this->replyDirectory . 'tmp' . $i);
65 65
             if ($content === false) {
66
-                throw new \RuntimeException('Failed to load file '.$this->replyDirectory.'tmp'.$i);
66
+                throw new \RuntimeException('Failed to load file ' . $this->replyDirectory . 'tmp' . $i);
67 67
             }
68 68
             $replies[] = $content;
69 69
             $i++;
Please login to merge, or discard this patch.