1 | <?php |
||
15 | final class Vim |
||
16 | { |
||
17 | /** |
||
18 | * @var Options |
||
19 | */ |
||
20 | private $options; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $editor; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $tempFiles; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $originalContent; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $prependCommand; |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getPrependCommand() |
||
50 | |||
51 | |||
52 | /** |
||
53 | * @param string $prependCommand |
||
54 | * |
||
55 | * @return Vim |
||
56 | */ |
||
57 | public function setPrependCommand($prependCommand) : Vim |
||
63 | |||
64 | /** |
||
65 | * Vim constructor. |
||
66 | * |
||
67 | * @param Options|NULL $options |
||
68 | */ |
||
69 | public function __construct(Options $options = NULL) |
||
78 | |||
79 | /** |
||
80 | * Открывает Vim в консоли для редактирования |
||
81 | */ |
||
82 | public function execute() |
||
86 | |||
87 | /** |
||
88 | * @param string $filename |
||
89 | * @param string $content |
||
90 | * @return Vim |
||
91 | */ |
||
92 | public function addFileContent(string $filename, string $content) : Vim |
||
99 | |||
100 | /** |
||
101 | * @param string $key |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function isChanged(string $key) : bool |
||
108 | |||
109 | /** |
||
110 | * @param string $key |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getContent(string $key) : string |
||
117 | |||
118 | /** |
||
119 | * @param string $name |
||
120 | * @param string $content |
||
121 | * @return resource |
||
122 | */ |
||
123 | private function makeTemporaryFile(string $name, string $content) |
||
129 | |||
130 | |||
131 | public function __destruct() |
||
139 | |||
140 | /** |
||
141 | * @return array |
||
142 | */ |
||
143 | private function getFilesPath() : array |
||
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | private function getCommand() : string |
||
174 | } |
||
175 |