@@ -8,7 +8,7 @@ |
||
8 | 8 | use LTDBeget\vim\Options; |
9 | 9 | use LTDBeget\vim\Vim; |
10 | 10 | |
11 | - require(__DIR__ . '/vendor/autoload.php'); |
|
11 | + require(__DIR__.'/vendor/autoload.php'); |
|
12 | 12 | |
13 | 13 | $vim = new Vim( |
14 | 14 | (new Options())->setDiffMode(true)->setReadonlyMode(true) |
@@ -148,23 +148,23 @@ |
||
148 | 148 | { |
149 | 149 | $options = []; |
150 | 150 | |
151 | - if($this->isDiffMode()) { |
|
151 | + if ($this->isDiffMode()) { |
|
152 | 152 | $options[] = '-d'; |
153 | 153 | } |
154 | 154 | |
155 | - if($this->isEasyMode()) { |
|
155 | + if ($this->isEasyMode()) { |
|
156 | 156 | $options[] = '-y'; |
157 | 157 | } |
158 | 158 | |
159 | - if($this->isReadonlyMode()) { |
|
159 | + if ($this->isReadonlyMode()) { |
|
160 | 160 | $options[] = '-R'; |
161 | 161 | } |
162 | 162 | |
163 | - if($this->encoding) { |
|
163 | + if ($this->encoding) { |
|
164 | 164 | $options[] = "-c 'set encoding=".escapeshellarg($this->encoding)."'"; |
165 | 165 | } |
166 | 166 | |
167 | - if($this->termEncoding) { |
|
167 | + if ($this->termEncoding) { |
|
168 | 168 | $options[] = "-c 'set termencoding=".escapeshellarg($this->termEncoding)."'"; |
169 | 169 | } |
170 | 170 |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | public function __construct(Options $options = NULL) |
70 | 70 | { |
71 | 71 | $editor = shell_exec('which vim'); |
72 | - if(empty($editor)) { |
|
72 | + if (empty($editor)) { |
|
73 | 73 | throw new \LogicException('Install vim'); |
74 | 74 | } |
75 | - $this->editor = trim($editor); |
|
75 | + $this->editor = trim($editor); |
|
76 | 76 | $this->options = $options ?? new Options(); |
77 | 77 | } |
78 | 78 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function __destruct() |
132 | 132 | { |
133 | 133 | foreach ($this->getFilesPath() as $fileName) { |
134 | - if(is_file($fileName)) { |
|
134 | + if (is_file($fileName)) { |
|
135 | 135 | unlink($fileName); |
136 | 136 | } |
137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | private function getFilesPath() : array |
144 | 144 | { |
145 | - $paths =[]; |
|
145 | + $paths = []; |
|
146 | 146 | foreach ($this->tempFiles as $fileName) { |
147 | 147 | $paths[] = $fileName; |
148 | 148 | } |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $command = []; |
158 | 158 | |
159 | 159 | if (!empty($this->prependCommand)) { |
160 | - $command[] = escapeshellcmd($this->prependCommand) . " &&"; |
|
160 | + $command[] = escapeshellcmd($this->prependCommand)." &&"; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $command = array_merge($command, [ |
164 | 164 | $this->editor, |
165 | - (string)$this->options, |
|
166 | - implode(' ', array_map(function (string $path) { |
|
165 | + (string) $this->options, |
|
166 | + implode(' ', array_map(function(string $path) { |
|
167 | 167 | return escapeshellarg($path); |
168 | 168 | }, $this->getFilesPath())), |
169 | 169 | '2> /dev/null' |