aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/lib/Splitter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject/lib/Splitter')
-rw-r--r--vendor/sabre/vobject/lib/Splitter/ICalendar.php35
-rw-r--r--vendor/sabre/vobject/lib/Splitter/SplitterInterface.php13
-rw-r--r--vendor/sabre/vobject/lib/Splitter/VCard.php22
3 files changed, 41 insertions, 29 deletions
diff --git a/vendor/sabre/vobject/lib/Splitter/ICalendar.php b/vendor/sabre/vobject/lib/Splitter/ICalendar.php
index d42566194..c0007ba01 100644
--- a/vendor/sabre/vobject/lib/Splitter/ICalendar.php
+++ b/vendor/sabre/vobject/lib/Splitter/ICalendar.php
@@ -19,8 +19,8 @@ use Sabre\VObject\Component\VCalendar;
* @author Armin Hackmann
* @license http://sabre.io/license/ Modified BSD License
*/
-class ICalendar implements SplitterInterface
-{
+class ICalendar implements SplitterInterface {
+
/**
* Timezones.
*
@@ -38,13 +38,13 @@ class ICalendar implements SplitterInterface
/**
* Constructor.
*
- * The splitter should receive an readable file stream as its input.
+ * The splitter should receive an readable file stream as it's input.
*
* @param resource $input
- * @param int $options parser options, see the OPTIONS constants
+ * @param int $options Parser options, see the OPTIONS constants.
*/
- public function __construct($input, $options = 0)
- {
+ function __construct($input, $options = 0) {
+
$data = VObject\Reader::read($input, $options);
if (!$data instanceof VObject\Component\VCalendar) {
@@ -57,16 +57,16 @@ class ICalendar implements SplitterInterface
}
// Get all timezones
- if ('VTIMEZONE' === $component->name) {
- $this->vtimezones[(string) $component->TZID] = $component;
+ if ($component->name === 'VTIMEZONE') {
+ $this->vtimezones[(string)$component->TZID] = $component;
continue;
}
// Get component UID for recurring Events search
if (!$component->UID) {
- $component->UID = sha1(microtime()).'-vobjectimport';
+ $component->UID = sha1(microtime()) . '-vobjectimport';
}
- $uid = (string) $component->UID;
+ $uid = (string)$component->UID;
// Take care of recurring events
if (!array_key_exists($uid, $this->objects)) {
@@ -75,6 +75,7 @@ class ICalendar implements SplitterInterface
$this->objects[$uid]->add(clone $component);
}
+
}
/**
@@ -83,14 +84,15 @@ class ICalendar implements SplitterInterface
*
* When the end is reached, null will be returned.
*
- * @return \Sabre\VObject\Component|null
+ * @return Sabre\VObject\Component|null
*/
- public function getNext()
- {
+ function getNext() {
+
if ($object = array_shift($this->objects)) {
+
// create our baseobject
$object->version = '2.0';
- $object->prodid = '-//Sabre//Sabre VObject '.VObject\Version::VERSION.'//EN';
+ $object->prodid = '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN';
$object->calscale = 'GREGORIAN';
// add vtimezone information to obj (if we have it)
@@ -99,8 +101,13 @@ class ICalendar implements SplitterInterface
}
return $object;
+
} else {
+
return;
+
}
+
}
+
}
diff --git a/vendor/sabre/vobject/lib/Splitter/SplitterInterface.php b/vendor/sabre/vobject/lib/Splitter/SplitterInterface.php
index c845ac5fc..8f827cc4b 100644
--- a/vendor/sabre/vobject/lib/Splitter/SplitterInterface.php
+++ b/vendor/sabre/vobject/lib/Splitter/SplitterInterface.php
@@ -15,16 +15,16 @@ namespace Sabre\VObject\Splitter;
* @author Dominik Tobschall (http://tobschall.de/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SplitterInterface
-{
+interface SplitterInterface {
+
/**
* Constructor.
*
- * The splitter should receive an readable file stream as its input.
+ * The splitter should receive an readable file stream as it's input.
*
* @param resource $input
*/
- public function __construct($input);
+ function __construct($input);
/**
* Every time getNext() is called, a new object will be parsed, until we
@@ -32,7 +32,8 @@ interface SplitterInterface
*
* When the end is reached, null will be returned.
*
- * @return \Sabre\VObject\Component|null
+ * @return Sabre\VObject\Component|null
*/
- public function getNext();
+ function getNext();
+
}
diff --git a/vendor/sabre/vobject/lib/Splitter/VCard.php b/vendor/sabre/vobject/lib/Splitter/VCard.php
index a20f5c2c1..0bb82abe9 100644
--- a/vendor/sabre/vobject/lib/Splitter/VCard.php
+++ b/vendor/sabre/vobject/lib/Splitter/VCard.php
@@ -19,8 +19,8 @@ use Sabre\VObject\Parser\MimeDir;
* @author Armin Hackmann
* @license http://sabre.io/license/ Modified BSD License
*/
-class VCard implements SplitterInterface
-{
+class VCard implements SplitterInterface {
+
/**
* File handle.
*
@@ -38,15 +38,16 @@ class VCard implements SplitterInterface
/**
* Constructor.
*
- * The splitter should receive an readable file stream as its input.
+ * The splitter should receive an readable file stream as it's input.
*
* @param resource $input
- * @param int $options parser options, see the OPTIONS constants
+ * @param int $options Parser options, see the OPTIONS constants.
*/
- public function __construct($input, $options = 0)
- {
+ function __construct($input, $options = 0) {
+
$this->input = $input;
$this->parser = new MimeDir($input, $options);
+
}
/**
@@ -55,20 +56,23 @@ class VCard implements SplitterInterface
*
* When the end is reached, null will be returned.
*
- * @return \Sabre\VObject\Component|null
+ * @return Sabre\VObject\Component|null
*/
- public function getNext()
- {
+ function getNext() {
+
try {
$object = $this->parser->parse();
if (!$object instanceof VObject\Component\VCard) {
throw new VObject\ParseException('The supplied input contained non-VCARD data.');
}
+
} catch (VObject\EofException $e) {
return;
}
return $object;
+
}
+
}