1 | <?php |
||
16 | class Writer extends AbstractBase implements WriterInterface |
||
17 | { |
||
18 | const OPEN_MODE_APPEND = 'a'; |
||
19 | const OPEN_MODE_TRUNCATE = 'w'; |
||
20 | |||
21 | /** @var boolean */ |
||
22 | private $useTruncateAsOpenMode = false; |
||
23 | |||
24 | /** |
||
25 | * @param mixed|array $data |
||
26 | * @return false|int |
||
27 | */ |
||
28 | public function __invoke($data) |
||
32 | |||
33 | |||
34 | //begin of general |
||
35 | /** |
||
36 | * @param string $path |
||
37 | * @param bool $setPathAsCurrentPath |
||
38 | * @return bool |
||
39 | * @throws InvalidArgumentException |
||
40 | * @todo implement path validation |
||
41 | */ |
||
42 | public function copy($path, $setPathAsCurrentPath = false) |
||
55 | |||
56 | /** |
||
57 | * @param string $path |
||
58 | * @return bool |
||
59 | * @todo implement path validation |
||
60 | */ |
||
61 | public function move($path) |
||
72 | |||
73 | /** |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function delete() |
||
82 | |||
83 | public function truncate() |
||
90 | |||
91 | /** |
||
92 | * truncates file and writes content |
||
93 | * |
||
94 | * @param array $collection |
||
95 | * @return false|int |
||
96 | */ |
||
97 | public function writeAll(array $collection) |
||
103 | |||
104 | /** |
||
105 | * @param array $headlines |
||
106 | * @return false|int |
||
107 | */ |
||
108 | public function writeHeadlines(array $headlines) |
||
114 | |||
115 | /** |
||
116 | * @param array $collection |
||
117 | * @return false|int |
||
118 | */ |
||
119 | public function writeMany(array $collection) |
||
136 | |||
137 | /** |
||
138 | * @param string|array $data |
||
139 | * @return false|int |
||
140 | */ |
||
141 | public function writeOne($data) |
||
147 | //end of general |
||
148 | |||
149 | /** |
||
150 | * @param string|array $data |
||
151 | * @return array |
||
152 | */ |
||
153 | protected function convertToArrayIfNeeded($data) |
||
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | protected function getFileHandlerOpenMode() |
||
172 | } |