@@ 147-161 (lines=15) @@ | ||
144 | /** |
|
145 | * {@inheritDoc} |
|
146 | */ |
|
147 | protected function writeStream( |
|
148 | /*# string */ $realPath, |
|
149 | $resource |
|
150 | )/*# : bool */ { |
|
151 | $tmpfname = tempnam(dirname($realPath), 'FOO'); |
|
152 | if (false !== $tmpfname) { |
|
153 | $stream = fopen($tmpfname, 'w+b'); |
|
154 | if (is_resource($stream)) { |
|
155 | stream_copy_to_stream($resource, $stream); |
|
156 | fclose($stream); |
|
157 | return $this->renameTempFile($tmpfname, $realPath); |
|
158 | } |
|
159 | } |
|
160 | return false; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * {@inheritDoc} |
|
@@ 166-180 (lines=15) @@ | ||
163 | /** |
|
164 | * {@inheritDoc} |
|
165 | */ |
|
166 | protected function writeFile( |
|
167 | /*# string */ $realPath, |
|
168 | /*# string */ $content |
|
169 | )/*# : bool */ { |
|
170 | // write to a temp file |
|
171 | $tmpfname = tempnam(dirname($realPath), 'FOO'); |
|
172 | if (false !== $tmpfname) { |
|
173 | $handle = fopen($tmpfname, 'w'); |
|
174 | fwrite($handle, $content); |
|
175 | fclose($handle); |
|
176 | ||
177 | return $this->renameTempFile($tmpfname, $realPath); |
|
178 | } |
|
179 | return false; |
|
180 | } |
|
181 | ||
182 | /** |
|
183 | * {@inheritDoc} |