1 | <?php |
||
36 | class ConvertEncoding implements FileModifierInterface, LoggerAwareInterface, ProcessFactoryAwareInterface |
||
37 | { |
||
38 | use OptionalLoggerTrait; |
||
39 | use FileProcessTrait; |
||
40 | use GetOptionTrait; |
||
41 | |||
42 | /** |
||
43 | * @extend Graze\DataFile\Node\File\LocalFile Only apply to local files |
||
44 | * |
||
45 | * @param LocalFile $file |
||
46 | * @param string $encoding Encoding as defined by iconv |
||
47 | * @param array $options -postfix <string> (Default: toEncoding) |
||
48 | * -keepOldFile <bool> (Default: true) |
||
49 | * |
||
50 | * @return LocalFile |
||
51 | */ |
||
52 | 7 | public function toEncoding(LocalFile $file, $encoding, array $options = []) |
|
73 | |||
74 | /** |
||
75 | * Can this file be modified by this modifier |
||
76 | * |
||
77 | * @param FileNodeInterface $file |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | 3 | public function canModify(FileNodeInterface $file) |
|
88 | |||
89 | /** |
||
90 | * Modify the file |
||
91 | * |
||
92 | * @param FileNodeInterface $file |
||
93 | * @param array $options List of options: |
||
94 | * -encoding <string> |
||
95 | * -postfix <string> (Default: toEncoding) Set this to blank to replace inline |
||
96 | * -keepOldFile <bool> (Default: true) |
||
97 | * |
||
98 | * @return FileNodeInterface |
||
99 | */ |
||
100 | 2 | public function modify(FileNodeInterface $file, array $options = []) |
|
112 | } |
||
113 |