ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
StreamedWritingTrait.php
Go to the documentation of this file.
1<?php
2
4
7
9{
20 protected function stream($path, $resource, Config $config, $fallback)
21 {
22 Util::rewindStream($resource);
23 $contents = stream_get_contents($resource);
24 $fallbackCall = [$this, $fallback];
25
26 return call_user_func($fallbackCall, $path, $contents, $config);
27 }
28
38 public function writeStream($path, $resource, Config $config)
39 {
40 return $this->stream($path, $resource, $config, 'write');
41 }
42
52 public function updateStream($path, $resource, Config $config)
53 {
54 return $this->stream($path, $resource, $config, 'update');
55 }
56
57 // Required abstract methods
58 abstract public function write($pash, $contents, Config $config);
59 abstract public function update($pash, $contents, Config $config);
60}
An exception for terminatinating execution or to throw for unit testing.
static rewindStream($resource)
Rewind a stream.
Definition: Util.php:248
$fallback
Definition: en-x-test.php:5
writeStream($path, $resource, Config $config)
update($pash, $contents, Config $config)