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 | * Vim constructor. |
||
39 | * |
||
40 | * @param Options|NULL $options |
||
41 | */ |
||
42 | public function __construct(Options $options = NULL) |
||
51 | |||
52 | /** |
||
53 | * Открывает Vim в консоли для редактирования |
||
54 | */ |
||
55 | public function execute() |
||
59 | |||
60 | /** |
||
61 | * @param string $filename |
||
62 | * @param string $content |
||
63 | * @return Vim |
||
64 | */ |
||
65 | public function addFileContent(string $filename, string $content) : Vim |
||
72 | |||
73 | /** |
||
74 | * @param string $key |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function isChanged(string $key) : bool |
||
81 | |||
82 | /** |
||
83 | * @param string $key |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getContent(string $key) : string |
||
90 | |||
91 | /** |
||
92 | * @param string $name |
||
93 | * @param string $content |
||
94 | * @return resource |
||
95 | */ |
||
96 | private function makeTemporaryFile(string $name, string $content) |
||
102 | |||
103 | |||
104 | public function __destruct() |
||
112 | |||
113 | /** |
||
114 | * @return array |
||
115 | */ |
||
116 | private function getFilesPath() : array |
||
124 | |||
125 | /** |
||
126 | * @return string |
||
127 | */ |
||
128 | private function getCommand() : string |
||
138 | } |