@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $output = trim(join("\n", $output), "\n ,"); |
| 60 | 60 | |
| 61 | - if ($output !== '') { |
|
| 61 | + if ($output !== ''){ |
|
| 62 | 62 | $this->files->deleteDirectory($tmpDir); |
| 63 | 63 | throw new CompileException($output); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // copying files (using relative path and namespace) |
| 67 | 67 | $result = []; |
| 68 | - foreach ($this->files->getFiles($tmpDir) as $file) { |
|
| 68 | + foreach ($this->files->getFiles($tmpDir) as $file){ |
|
| 69 | 69 | $result[] = $this->copy($tmpDir, $file); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | private function copy(string $tmpDir, string $file): string |
| 83 | 83 | { |
| 84 | 84 | $source = ltrim($this->files->relativePath($file, $tmpDir), '\\/'); |
| 85 | - if (strpos($source, $this->baseNamespace) === 0) { |
|
| 85 | + if (strpos($source, $this->baseNamespace) === 0){ |
|
| 86 | 86 | $source = ltrim(substr($source, strlen($this->baseNamespace)), '\\/'); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $target = $this->files->normalizePath($this->basePath . '/' . $source); |
|
| 89 | + $target = $this->files->normalizePath($this->basePath.'/'.$source); |
|
| 90 | 90 | |
| 91 | 91 | $this->files->ensureDirectory(dirname($target)); |
| 92 | 92 | $this->files->copy($file, $target); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function tmpDir(): string |
| 101 | 101 | { |
| 102 | - $directory = sys_get_temp_dir() . '/' . spl_object_hash($this); |
|
| 102 | + $directory = sys_get_temp_dir().'/'.spl_object_hash($this); |
|
| 103 | 103 | $this->files->ensureDirectory($directory); |
| 104 | 104 | |
| 105 | 105 | return $this->files->normalizePath($directory, true); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function getProtoFiles(string $protoFile): array |
| 115 | 115 | { |
| 116 | - return array_filter($this->files->getFiles(dirname($protoFile)), function ($file) { |
|
| 116 | + return array_filter($this->files->getFiles(dirname($protoFile)), function ($file){ |
|
| 117 | 117 | return strpos($file, '.proto') !== false; |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -58,14 +58,16 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $output = trim(join("\n", $output), "\n ,"); |
| 60 | 60 | |
| 61 | - if ($output !== '') { |
|
| 61 | + if ($output !== '') |
|
| 62 | + { |
|
| 62 | 63 | $this->files->deleteDirectory($tmpDir); |
| 63 | 64 | throw new CompileException($output); |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | // copying files (using relative path and namespace) |
| 67 | 68 | $result = []; |
| 68 | - foreach ($this->files->getFiles($tmpDir) as $file) { |
|
| 69 | + foreach ($this->files->getFiles($tmpDir) as $file) |
|
| 70 | + { |
|
| 69 | 71 | $result[] = $this->copy($tmpDir, $file); |
| 70 | 72 | } |
| 71 | 73 | |
@@ -82,7 +84,8 @@ discard block |
||
| 82 | 84 | private function copy(string $tmpDir, string $file): string |
| 83 | 85 | { |
| 84 | 86 | $source = ltrim($this->files->relativePath($file, $tmpDir), '\\/'); |
| 85 | - if (strpos($source, $this->baseNamespace) === 0) { |
|
| 87 | + if (strpos($source, $this->baseNamespace) === 0) |
|
| 88 | + { |
|
| 86 | 89 | $source = ltrim(substr($source, strlen($this->baseNamespace)), '\\/'); |
| 87 | 90 | } |
| 88 | 91 | |
@@ -113,7 +116,8 @@ discard block |
||
| 113 | 116 | */ |
| 114 | 117 | private function getProtoFiles(string $protoFile): array |
| 115 | 118 | { |
| 116 | - return array_filter($this->files->getFiles(dirname($protoFile)), function ($file) { |
|
| 119 | + return array_filter($this->files->getFiles(dirname($protoFile)), function ($file) |
|
| 120 | + { |
|
| 117 | 121 | return strpos($file, '.proto') !== false; |
| 118 | 122 | }); |
| 119 | 123 | } |