Resolve circular dependency between Support and Stream_Wrapper.
authorGunnar Wrobel <p@rdus.de>
Sat, 2 Oct 2010 22:29:01 +0000 (00:29 +0200)
committerGunnar Wrobel <p@rdus.de>
Sat, 2 Oct 2010 22:29:01 +0000 (00:29 +0200)
framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/Combine.php
framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/CombineStream.php [new file with mode: 0644]
framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/String.php
framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/StringStream.php [new file with mode: 0644]
framework/Stream_Wrapper/package.xml
framework/Support/lib/Horde/Support/CombineStream.php
framework/Support/lib/Horde/Support/StringStream.php

index 658ab92..edcddbc 100644 (file)
@@ -75,8 +75,8 @@ class Horde_Stream_Wrapper_Combine
     {
         $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();
diff --git a/framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/CombineStream.php b/framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/CombineStream.php
new file mode 100644 (file)
index 0000000..758ddc2
--- /dev/null
@@ -0,0 +1,27 @@
+<?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
index 12b06a9..d9f3672 100644 (file)
@@ -45,8 +45,8 @@ class Horde_Stream_Wrapper_String
     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();
diff --git a/framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/StringStream.php b/framework/Stream_Wrapper/lib/Horde/Stream/Wrapper/StringStream.php
new file mode 100644 (file)
index 0000000..db9afb2
--- /dev/null
@@ -0,0 +1,25 @@
+<?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
index 32f4325..82185dd 100644 (file)
@@ -46,7 +46,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
      <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 -->
@@ -61,16 +63,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <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>
index 0a39500..a0c095b 100644 (file)
@@ -16,7 +16,7 @@
  * @category Horde
  * @package  Horde_Support
  */
-class Horde_Support_CombineStream
+class Horde_Support_CombineStream implements Horde_Stream_Wrapper_CombineStream
 {
     /**
      * Data.
index afdd678..ea573f6 100644 (file)
@@ -14,7 +14,7 @@
  * @category Horde
  * @package  Horde_Support
  */
-class Horde_Support_StringStream
+class Horde_Support_StringStream implements Horde_Stream_Wrapper_StringStream
 {
     /**
      * @var string