FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Handler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Rsi\Fred\Stream;
4 
5 /**
6  * Stream handler.
7  * In this default implementation all requests are forwarded to the next handler in the chain.
8  */
9 class Handler extends \Rsi\Thing{
10 
11  protected $_stream;
12  protected $_config = null;
13 
14  public function __construct($stream,$config){
15  $this->_stream = $stream;
16  $this->configure($this->_config = $config);
17  }
18  /**
19  * Search for files.
20  * @param array $handlers Downstream handlers.
21  * @param string $mask Filter mask.
22  * @return array Filenames found.
23  */
24  public function search($handlers,$mask = '*'){
25  return $this->_stream->search($handlers,$mask);
26  }
27  /**
28  * Check if a file exists.
29  * @param array $handlers Downstream handlers.
30  * @param string $filename Filename.
31  * @param array $params Parameters.
32  * @return bool
33  */
34  public function exists($handlers,$filename,$params = null){
35  return $this->_stream->exists($handlers,$filename,$params);
36  }
37  /**
38  * Modification time of a file.
39  * @param array $handlers Downstream handlers.
40  * @param string $filename Filename.
41  * @param array $params Parameters.
42  * @return int Unix timestamp.
43  */
44  public function time($handlers,$filename,$params = null){
45  return $this->_stream->time($handlers,$filename,$params);
46  }
47  /**
48  * Read a file.
49  * @param array $handlers Downstream handlers.
50  * @param string $filename Filename.
51  * @param array $params Parameters.
52  * @return string Binary data.
53  */
54  public function read($handlers,$filename,$params = null){
55  return $this->_stream->read($handlers,$filename,$params);
56  }
57  /**
58  * Save a file.
59  * @param array $handlers Downstream handlers.
60  * @param string $filename Filename.
61  * @param array $params Parameters.
62  * @param string $data Binary data.
63  * @return bool True when succesful.
64  */
65  public function save($handlers,$filename,$params,$data){
66  return $this->_stream->save($handlers,$filename,$params,$data);
67  }
68  /**
69  * Save a file.
70  * @param array $handlers Downstream handlers.
71  * @param string $filename Filename.
72  * @param array $params Parameters.
73  * @return bool True when succesful.
74  */
75  public function delete($handlers,$filename,$params = null){
76  return $this->_stream->delete($handlers,$filename,$params);
77  }
78 
79 }
exists($handlers, $filename, $params=null)
Check if a file exists.
Definition: Handler.php:34
Basic object.
Definition: Thing.php:13
Stream handler.
Definition: Handler.php:9
configure($config)
Configure the object.
Definition: Thing.php:45
time($handlers, $filename, $params=null)
Modification time of a file.
Definition: Handler.php:44
search($handlers, $mask=' *')
Search for files.
Definition: Handler.php:24
__construct($stream, $config)
Definition: Handler.php:14
save($handlers, $filename, $params, $data)
Save a file.
Definition: Handler.php:65
read($handlers, $filename, $params=null)
Read a file.
Definition: Handler.php:54