{
$opts = stream_context_get_options($this->context);
if (empty($opts['horde-combine']['data']) ||
- !($opts['horde-combine']['data'] instanceof Horde_Support_CombineStream)) {
- throw new Exception('A combined stream must be created using the Horde_Support_CombineStream class.');
+ !($opts['horde-combine']['data'] instanceof Horde_Stream_Wrapper_CombineStream)) {
+ throw new Exception('A combined stream must be created using the Horde_Stream_Wrapper_CombineStream interface.');
}
$data = $opts['horde-combine']['data']->getData();
--- /dev/null
+<?php
+/**
+ * Provides access to the Combine stream wrapper.
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @category Horde
+ * @package Horde_Support
+ */
+
+/**
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @category Horde
+ * @package Horde_Support
+ */
+interface Horde_Stream_Wrapper_CombineStream
+{
+ /**
+ * Return a reference to the data.
+ *
+ * @return array
+ */
+ public function getData();
+}
\ No newline at end of file
public function stream_open($path, $mode, $options, &$opened_path)
{
$options = stream_context_get_options($this->context);
- if (empty($options['horde-string']['string']) || ! $options['horde-string']['string'] instanceof Horde_Support_StringStream) {
- throw new Exception('String streams must be created using the Horde_Support_StringStream class');
+ if (empty($options['horde-string']['string']) || ! $options['horde-string']['string'] instanceof Horde_Stream_Wrapper_StringStream) {
+ throw new Exception('String streams must be created using the Horde_Stream_Wrapper_StringStream interface');
}
$this->_string =& $options['horde-string']['string']->getString();
--- /dev/null
+<?php
+/**
+ * Copyright 2007-2010 The Horde Project (http://www.horde.org/)
+ *
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @category Horde
+ * @package Horde_Support
+ */
+
+/**
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @category Horde
+ * @package Horde_Support
+ */
+interface Horde_Stream_Wrapper_StringStream
+{
+ /**
+ * Return a reference to the wrapped string.
+ *
+ * @return string
+ */
+ public function &getString();
+}
\ No newline at end of file
<dir name="Stream">
<dir name="Wrapper">
<file name="Combine.php" role="php" />
+ <file name="CombineStream.php" role="php" />
<file name="String.php" role="php" />
+ <file name="StringStream.php" role="php" />
</dir> <!-- /lib/Horde/Stream/Wrapper -->
</dir> <!-- /lib/Horde/Stream -->
</dir> <!-- /lib/Horde -->
<pearinstaller>
<min>1.7.0</min>
</pearinstaller>
- <package>
- <name>Support</name>
- <channel>pear.horde.org</channel>
- </package>
</required>
</dependencies>
<phprelease>
<filelist>
<install name="lib/Horde/Stream/Wrapper/Combine.php" as="Horde/Stream/Wrapper/Combine.php" />
+ <install name="lib/Horde/Stream/Wrapper/CombineStream.php" as="Horde/Stream/Wrapper/CombineStream.php" />
<install name="lib/Horde/Stream/Wrapper/String.php" as="Horde/Stream/Wrapper/String.php" />
+ <install name="lib/Horde/Stream/Wrapper/StringStream.php" as="Horde/Stream/Wrapper/StringStream.php" />
</filelist>
</phprelease>
</package>
* @category Horde
* @package Horde_Support
*/
-class Horde_Support_CombineStream
+class Horde_Support_CombineStream implements Horde_Stream_Wrapper_CombineStream
{
/**
* Data.
* @category Horde
* @package Horde_Support
*/
-class Horde_Support_StringStream
+class Horde_Support_StringStream implements Horde_Stream_Wrapper_StringStream
{
/**
* @var string