[Pkg-owncloud-commits] [php-sabre-vobject] 185/341: Yield documents instead of returning them.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit 8de5fe694511529a75e450af87f183e1b5ff9f47
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Thu Jan 22 11:23:17 2015 +0100

    Yield documents instead of returning them.
---
 lib/Parser/XML.php | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php
index b76695b..2951de0 100644
--- a/lib/Parser/XML.php
+++ b/lib/Parser/XML.php
@@ -68,7 +68,7 @@ class XML extends Parser {
      * @param resource|string $input
      * @param int $options
      * @throws \Exception
-     * @return Sabre\VObject\Document
+     * @return Generator of Sabre\VObject\Document
      */
     public function parse($input = null, $options = 0) {
 
@@ -90,21 +90,20 @@ class XML extends Parser {
                 $this->root = new VCalendar([], false);
                 $this->pointer = &$this->input['value'][0];
                 $this->parseVCalendarComponents($this->root);
+
+                yield $this->root;
                 break;
 
             case '{' . self::XCARD_NAMESPACE . '}vcards':
-                $collection = [];
-
                 foreach ($this->input['value'] as &$vCard) {
 
                     $this->root = new VCard(['version' => '4.0'], false);
-                    $collection[]   = $this->root;
                     $this->pointer  = &$vCard;
                     $this->parseVCardComponents($this->root);
 
-                }
+                    yield $this->root;
 
-                $this->root = $collection;
+                }
                 break;
 
             default:
@@ -112,7 +111,7 @@ class XML extends Parser {
 
         }
 
-        return $this->root;
+        return;
     }
 
     /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list