aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/bin
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
committerredmatrix <git@macgirvin.com>2016-05-10 17:26:44 -0700
commit0b02a6d123b2014705998c94ddf3d460948d3eac (patch)
tree78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /vendor/sabre/vobject/bin
parent40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff)
downloadvolse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2
volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'vendor/sabre/vobject/bin')
-rwxr-xr-xvendor/sabre/vobject/bin/bench.php4
-rw-r--r--vendor/sabre/vobject/bin/bench_freebusygenerator.php62
-rw-r--r--vendor/sabre/vobject/bin/bench_manipulatevcard.php69
-rwxr-xr-xvendor/sabre/vobject/bin/fetch_windows_zones.php51
-rwxr-xr-xvendor/sabre/vobject/bin/generate_vcards241
-rwxr-xr-xvendor/sabre/vobject/bin/generateicalendardata.php41
-rwxr-xr-xvendor/sabre/vobject/bin/mergeduplicates.php184
-rw-r--r--vendor/sabre/vobject/bin/rrulebench.php32
-rwxr-xr-xvendor/sabre/vobject/bin/vobject27
-rwxr-xr-xvendor/sabre/vobject/bin/vobjectvalidate.php139
10 files changed, 687 insertions, 163 deletions
diff --git a/vendor/sabre/vobject/bin/bench.php b/vendor/sabre/vobject/bin/bench.php
index b949c8ea4..807b40777 100755
--- a/vendor/sabre/vobject/bin/bench.php
+++ b/vendor/sabre/vobject/bin/bench.php
@@ -5,8 +5,8 @@ include __DIR__ . '/../vendor/autoload.php';
$data = stream_get_contents(STDIN);
-$start = microtime(true);
+$start = microtime(true);
$lol = Sabre\VObject\Reader::read($data);
-echo "time: " . (microtime(true)-$start) . "\n";
+echo "time: " . (microtime(true) - $start) . "\n";
diff --git a/vendor/sabre/vobject/bin/bench_freebusygenerator.php b/vendor/sabre/vobject/bin/bench_freebusygenerator.php
new file mode 100644
index 000000000..2c51b2a32
--- /dev/null
+++ b/vendor/sabre/vobject/bin/bench_freebusygenerator.php
@@ -0,0 +1,62 @@
+<?php
+
+include __DIR__ . '/../vendor/autoload.php';
+
+if ($argc < 2) {
+ echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " freebusy benchmark\n";
+ echo "\n";
+ echo "This script can be used to measure the speed of generating a\n";
+ echo "free-busy report based on a calendar.\n";
+ echo "\n";
+ echo "The process will be repeated 100 times to get accurate stats\n";
+ echo "\n";
+ echo "Usage: " . $argv[0] . " inputfile.ics\n";
+ die();
+}
+
+list(, $inputFile) = $argv;
+
+$bench = new Hoa\Bench\Bench();
+$bench->parse->start();
+
+$vcal = Sabre\VObject\Reader::read(fopen($inputFile, 'r'));
+
+$bench->parse->stop();
+
+$repeat = 100;
+$start = new \DateTime('2000-01-01');
+$end = new \DateTime('2020-01-01');
+$timeZone = new \DateTimeZone('America/Toronto');
+
+$bench->fb->start();
+
+for ($i = 0; $i < $repeat; $i++) {
+
+ $fb = new Sabre\VObject\FreeBusyGenerator($start, $end, $vcal, $timeZone);
+ $results = $fb->getResult();
+
+}
+$bench->fb->stop();
+
+
+
+echo $bench,"\n";
+
+function formatMemory($input) {
+
+ if (strlen($input) > 6) {
+
+ return round($input / (1024 * 1024)) . 'M';
+
+ } elseif (strlen($input) > 3) {
+
+ return round($input / 1024) . 'K';
+
+ }
+
+}
+
+unset($input, $splitter);
+
+echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n";
+echo "current memory usage: " . formatMemory(memory_get_usage()), "\n";
diff --git a/vendor/sabre/vobject/bin/bench_manipulatevcard.php b/vendor/sabre/vobject/bin/bench_manipulatevcard.php
new file mode 100644
index 000000000..adc198e9b
--- /dev/null
+++ b/vendor/sabre/vobject/bin/bench_manipulatevcard.php
@@ -0,0 +1,69 @@
+<?php
+
+include __DIR__ . '/../vendor/autoload.php';
+
+if ($argc < 2) {
+ echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " manipulation benchmark\n";
+ echo "\n";
+ echo "This script can be used to measure the speed of opening a large amount of\n";
+ echo "vcards, making a few alterations and serializing them again.\n";
+ echo "system.";
+ echo "\n";
+ echo "Usage: " . $argv[0] . " inputfile.vcf\n";
+ die();
+}
+
+list(, $inputFile) = $argv;
+
+$input = file_get_contents($inputFile);
+
+$splitter = new Sabre\VObject\Splitter\VCard($input);
+
+$bench = new Hoa\Bench\Bench();
+
+while (true) {
+
+ $bench->parse->start();
+ $vcard = $splitter->getNext();
+ $bench->parse->pause();
+
+ if (!$vcard) break;
+
+ $bench->manipulate->start();
+ $vcard->{'X-FOO'} = 'Random new value!';
+ $emails = [];
+ if (isset($vcard->EMAIL)) foreach ($vcard->EMAIL as $email) {
+ $emails[] = (string)$email;
+ }
+ $bench->manipulate->pause();
+
+ $bench->serialize->start();
+ $vcard2 = $vcard->serialize();
+ $bench->serialize->pause();
+
+ $vcard->destroy();
+
+}
+
+
+
+echo $bench,"\n";
+
+function formatMemory($input) {
+
+ if (strlen($input) > 6) {
+
+ return round($input / (1024 * 1024)) . 'M';
+
+ } elseif (strlen($input) > 3) {
+
+ return round($input / 1024) . 'K';
+
+ }
+
+}
+
+unset($input, $splitter);
+
+echo "peak memory usage: " . formatMemory(memory_get_peak_usage()), "\n";
+echo "current memory usage: " . formatMemory(memory_get_usage()), "\n";
diff --git a/vendor/sabre/vobject/bin/fetch_windows_zones.php b/vendor/sabre/vobject/bin/fetch_windows_zones.php
new file mode 100755
index 000000000..1b1fdc37c
--- /dev/null
+++ b/vendor/sabre/vobject/bin/fetch_windows_zones.php
@@ -0,0 +1,51 @@
+#!/usr/bin/env php
+<?php
+
+$windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml';
+$outputFile = __DIR__ . '/../lib/timezonedata/windowszones.php';
+
+echo "Fetching timezone map from: " . $windowsZonesUrl, "\n";
+
+$data = file_get_contents($windowsZonesUrl);
+
+$xml = simplexml_load_string($data);
+
+$map = [];
+
+foreach ($xml->xpath('//mapZone') as $mapZone) {
+
+ $from = (string)$mapZone['other'];
+ $to = (string)$mapZone['type'];
+
+ list($to) = explode(' ', $to, 2);
+
+ if (!isset($map[$from])) {
+ $map[$from] = $to;
+ }
+
+}
+
+ksort($map);
+echo "Writing to: $outputFile\n";
+
+$f = fopen($outputFile, 'w');
+fwrite($f, "<?php\n\n");
+fwrite($f, "/**\n");
+fwrite($f, " * Automatically generated timezone file\n");
+fwrite($f, " *\n");
+fwrite($f, " * Last update: " . date(DATE_W3C) . "\n");
+fwrite($f, " * Source: " . $windowsZonesUrl . "\n");
+fwrite($f, " *\n");
+fwrite($f, " * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).\n");
+fwrite($f, " * @license http://sabre.io/license/ Modified BSD License\n");
+fwrite($f, " */\n");
+fwrite($f, "\n");
+fwrite($f, "return ");
+fwrite($f, var_export($map, true) . ';');
+fclose($f);
+
+echo "Formatting\n";
+
+exec(__DIR__ . '/sabre-cs-fixer fix ' . escapeshellarg($outputFile));
+
+echo "Done\n";
diff --git a/vendor/sabre/vobject/bin/generate_vcards b/vendor/sabre/vobject/bin/generate_vcards
new file mode 100755
index 000000000..4663c3c16
--- /dev/null
+++ b/vendor/sabre/vobject/bin/generate_vcards
@@ -0,0 +1,241 @@
+#!/usr/bin/env php
+<?php
+
+namespace Sabre\VObject;
+
+// This sucks.. we have to try to find the composer autoloader. But chances
+// are, we can't find it this way. So we'll do our bestest
+$paths = [
+ __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
+ __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
+];
+
+foreach($paths as $path) {
+ if (file_exists($path)) {
+ include $path;
+ break;
+ }
+}
+
+if (!class_exists('Sabre\\VObject\\Version')) {
+ fwrite(STDERR, "Composer autoloader could not be properly loaded.\n");
+ die(1);
+}
+
+if ($argc < 2) {
+
+ $version = Version::VERSION;
+
+ $help = <<<HI
+sabre/vobject $version
+Usage:
+ generate_vcards [count]
+
+Options:
+ count The number of random vcards to generate
+
+Examples:
+ generate_vcards 1000 > testdata.vcf
+
+HI;
+
+ fwrite(STDERR, $help);
+ exit(2);
+}
+
+$count = (int)$argv[1];
+if ($count < 1) {
+ fwrite(STDERR, "Count must be at least 1\n");
+ exit(2);
+}
+
+fwrite(STDERR, "sabre/vobject " . Version::VERSION . "\n");
+fwrite(STDERR, "Generating " . $count . " vcards in vCard 4.0 format\n");
+
+/**
+ * The following list is just some random data we compiled from various
+ * sources online.
+ *
+ * Very little thought went into compiling this list, and certainly nothing
+ * political or ethical.
+ *
+ * We would _love_ more additions to this to add more variation to this list.
+ *
+ * Send us PR's and don't be shy adding your own first and last name for fun.
+ */
+
+$sets = array(
+ "nl" => array(
+ "country" => "Netherlands",
+ "boys" => array(
+ "Anno",
+ "Bram",
+ "Daan",
+ "Evert",
+ "Finn",
+ "Jayden",
+ "Jens",
+ "Jesse",
+ "Levi",
+ "Lucas",
+ "Luuk",
+ "Milan",
+ "René",
+ "Sem",
+ "Sibrand",
+ "Willem",
+ ),
+ "girls" => array(
+ "Celia",
+ "Emma",
+ "Fenna",
+ "Geke",
+ "Inge",
+ "Julia",
+ "Lisa",
+ "Lotte",
+ "Mila",
+ "Sara",
+ "Sophie",
+ "Tess",
+ "Zoë",
+ ),
+ "last" => array(
+ "Bakker",
+ "Bos",
+ "De Boer",
+ "De Groot",
+ "De Jong",
+ "De Vries",
+ "Jansen",
+ "Janssen",
+ "Meyer",
+ "Mulder",
+ "Peters",
+ "Smit",
+ "Van Dijk",
+ "Van den Berg",
+ "Visser",
+ "Vos",
+ ),
+ ),
+ "us" => array(
+ "country" => "United States",
+ "boys" => array(
+ "Aiden",
+ "Alexander",
+ "Charles",
+ "David",
+ "Ethan",
+ "Jacob",
+ "James",
+ "Jayden",
+ "John",
+ "Joseph",
+ "Liam",
+ "Mason",
+ "Michael",
+ "Noah",
+ "Richard",
+ "Robert",
+ "Thomas",
+ "William",
+ ),
+ "girls" => array(
+ "Ava",
+ "Barbara",
+ "Chloe",
+ "Dorothy",
+ "Elizabeth",
+ "Emily",
+ "Emma",
+ "Isabella",
+ "Jennifer",
+ "Lily",
+ "Linda",
+ "Margaret",
+ "Maria",
+ "Mary",
+ "Mia",
+ "Olivia",
+ "Patricia",
+ "Roxy",
+ "Sophia",
+ "Susan",
+ "Zoe",
+ ),
+ "last" => array(
+ "Smith",
+ "Johnson",
+ "Williams",
+ "Jones",
+ "Brown",
+ "Davis",
+ "Miller",
+ "Wilson",
+ "Moore",
+ "Taylor",
+ "Anderson",
+ "Thomas",
+ "Jackson",
+ "White",
+ "Harris",
+ "Martin",
+ "Thompson",
+ "Garcia",
+ "Martinez",
+ "Robinson",
+ ),
+ ),
+);
+
+$current = 0;
+
+$r = function($arr) {
+
+ return $arr[mt_rand(0,count($arr)-1)];
+
+};
+
+$bdayStart = strtotime('-85 years');
+$bdayEnd = strtotime('-20 years');
+
+while($current < $count) {
+
+ $current++;
+ fwrite(STDERR, "\033[100D$current/$count");
+
+ $country = array_rand($sets);
+ $gender = mt_rand(0,1)?'girls':'boys';
+
+ $vcard = new Component\VCard(array(
+ 'VERSION' => '4.0',
+ 'FN' => $r($sets[$country][$gender]) . ' ' . $r($sets[$country]['last']),
+ 'UID' => UUIDUtil::getUUID(),
+ ));
+
+ $bdayRatio = mt_rand(0,9);
+
+ if($bdayRatio < 2) {
+ // 20% has a birthday property with a full date
+ $dt = new \DateTime('@' . mt_rand($bdayStart, $bdayEnd));
+ $vcard->add('BDAY', $dt->format('Ymd'));
+
+ } elseif ($bdayRatio < 3) {
+ // 10% we only know the month and date of
+ $dt = new \DateTime('@' . mt_rand($bdayStart, $bdayEnd));
+ $vcard->add('BDAY', '--' . $dt->format('md'));
+ }
+ if ($result = $vcard->validate()) {
+ ob_start();
+ echo "\nWe produced an invalid vcard somehow!\n";
+ foreach($result as $message) {
+ echo " " . $message['message'] . "\n";
+ }
+ fwrite(STDERR, ob_get_clean());
+ }
+ echo $vcard->serialize();
+
+}
+
+fwrite(STDERR,"\nDone.\n");
diff --git a/vendor/sabre/vobject/bin/generateicalendardata.php b/vendor/sabre/vobject/bin/generateicalendardata.php
index 92c8c106d..dfcf18780 100755
--- a/vendor/sabre/vobject/bin/generateicalendardata.php
+++ b/vendor/sabre/vobject/bin/generateicalendardata.php
@@ -3,7 +3,7 @@
use Sabre\VObject;
-if ($argc<2) {
+if ($argc < 2) {
$cmd = $argv[0];
fwrite(STDERR, <<<HI
Fruux test data generator
@@ -29,49 +29,47 @@ include __DIR__ . '/../vendor/autoload.php';
fwrite(STDERR, "Generating " . $events . " events\n");
-$currentDate = new DateTime('-' . round($events/2) . ' days');
+$currentDate = new DateTime('-' . round($events / 2) . ' days');
-$calendar = VObject\Component::create('VCALENDAR');
-$calendar->version = '2.0';
-$calendar->calscale = 'GREGORIAN';
+$calendar = new VObject\Component\VCalendar();
-$ii=0;
+$ii = 0;
-while($ii < $events) {
+while ($ii < $events) {
$ii++;
- $event = VObject\Component::create('VEVENT');
+ $event = $calendar->add('VEVENT');
$event->DTSTART = 'bla';
$event->SUMMARY = 'Event #' . $ii;
$event->UID = md5(microtime(true));
- $doctorRandom = mt_rand(1,1000);
+ $doctorRandom = mt_rand(1, 1000);
- switch($doctorRandom) {
+ switch ($doctorRandom) {
// All-day event
- case 1 :
+ case 1 :
$event->DTEND = 'bla';
$dtStart = clone $currentDate;
$dtEnd = clone $currentDate;
- $dtEnd->modify('+' . mt_rand(1,3) . ' days');
- $event->DTSTART->setDateTime($dtStart, VObject\Property\DateTime::DATE);
- $event->DTEND->setDateTime($dtEnd, VObject\Property\DateTime::DATE);
+ $dtEnd->modify('+' . mt_rand(1, 3) . ' days');
+ $event->DTSTART->setDateTime($dtStart);
+ $event->DTSTART['VALUE'] = 'DATE';
+ $event->DTEND->setDateTime($dtEnd);
break;
case 2 :
- $event->RRULE = 'FREQ=DAILY;COUNT=' . mt_rand(1,10);
+ $event->RRULE = 'FREQ=DAILY;COUNT=' . mt_rand(1, 10);
// No break intentional
default :
$dtStart = clone $currentDate;
- $dtStart->setTime(mt_rand(1,23), mt_rand(0,59), mt_rand(0,59));
- $event->DTSTART->setDateTime($dtStart, VObject\Property\DateTime::UTC);
- $event->DURATION = 'PT'.mt_rand(1,3).'H';
+ $dtStart->setTime(mt_rand(1, 23), mt_rand(0, 59), mt_rand(0, 59));
+ $event->DTSTART->setDateTime($dtStart);
+ $event->DURATION = 'PT' . mt_rand(1, 3) . 'H';
break;
}
- $calendar->add($event);
- $currentDate->modify('+ ' . mt_rand(0,3) . ' days');
+ $currentDate->modify('+ ' . mt_rand(0, 3) . ' days');
}
fwrite(STDERR, "Validating\n");
@@ -79,7 +77,7 @@ fwrite(STDERR, "Validating\n");
$result = $calendar->validate();
if ($result) {
fwrite(STDERR, "Errors!\n");
- fwrite(STDERR, print_r($result,true));
+ fwrite(STDERR, print_r($result, true));
die(-1);
}
@@ -88,4 +86,3 @@ fwrite(STDERR, "Serializing this beast\n");
echo $calendar->serialize();
fwrite(STDERR, "done.\n");
-
diff --git a/vendor/sabre/vobject/bin/mergeduplicates.php b/vendor/sabre/vobject/bin/mergeduplicates.php
new file mode 100755
index 000000000..1662e7bf3
--- /dev/null
+++ b/vendor/sabre/vobject/bin/mergeduplicates.php
@@ -0,0 +1,184 @@
+#!/usr/bin/env php
+<?php
+
+namespace Sabre\VObject;
+
+// This sucks.. we have to try to find the composer autoloader. But chances
+// are, we can't find it this way. So we'll do our bestest
+$paths = [
+ __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
+ __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
+];
+
+foreach ($paths as $path) {
+ if (file_exists($path)) {
+ include $path;
+ break;
+ }
+}
+
+if (!class_exists('Sabre\\VObject\\Version')) {
+ fwrite(STDERR, "Composer autoloader could not be loaded.\n");
+ die(1);
+}
+
+echo "sabre/vobject ", Version::VERSION, " duplicate contact merge tool\n";
+
+if ($argc < 3) {
+
+ echo "\n";
+ echo "Usage: ", $argv[0], " input.vcf output.vcf [debug.log]\n";
+ die(1);
+
+}
+
+$input = fopen($argv[1], 'r');
+$output = fopen($argv[2], 'w');
+$debug = isset($argv[3]) ? fopen($argv[3], 'w') : null;
+
+$splitter = new Splitter\VCard($input);
+
+// The following properties are ignored. If they appear in some vcards
+// but not in others, we don't consider them for the sake of finding
+// differences.
+$ignoredProperties = [
+ "PRODID",
+ "VERSION",
+ "REV",
+ "UID",
+ "X-ABLABEL",
+];
+
+
+$collectedNames = [];
+
+$stats = [
+ "Total vcards" => 0,
+ "No FN property" => 0,
+ "Ignored duplicates" => 0,
+ "Merged values" => 0,
+ "Error" => 0,
+ "Unique cards" => 0,
+ "Total written" => 0,
+];
+
+function writeStats() {
+
+ global $stats;
+ foreach ($stats as $name => $value) {
+ echo str_pad($name, 23, " ", STR_PAD_RIGHT), str_pad($value, 6, " ", STR_PAD_LEFT), "\n";
+ }
+ // Moving cursor back a few lines.
+ echo "\033[" . count($stats) . "A";
+
+}
+
+function write($vcard) {
+
+ global $stats, $output;
+
+ $stats["Total written"]++;
+ fwrite($output, $vcard->serialize() . "\n");
+
+}
+
+while ($vcard = $splitter->getNext()) {
+
+ $stats["Total vcards"]++;
+ writeStats();
+
+ $fn = isset($vcard->FN) ? (string)$vcard->FN : null;
+
+ if (empty($fn)) {
+
+ // Immediately write this vcard, we don't compare it.
+ $stats["No FN property"]++;
+ $stats['Unique cards']++;
+ write($vcard);
+ $vcard->destroy();
+ continue;
+
+ }
+
+ if (!isset($collectedNames[$fn])) {
+
+ $collectedNames[$fn] = $vcard;
+ $stats['Unique cards']++;
+ continue;
+
+ } else {
+
+ // Starting comparison for all properties. We only check if properties
+ // in the current vcard exactly appear in the earlier vcard as well.
+ foreach ($vcard->children() as $newProp) {
+
+ if (in_array($newProp->name, $ignoredProperties)) {
+ // We don't care about properties such as UID and REV.
+ continue;
+ }
+ $ok = false;
+ foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
+
+ if ($compareProp->serialize() === $newProp->serialize()) {
+ $ok = true;
+ break;
+ }
+ }
+
+ if (!$ok) {
+
+ if ($newProp->name === 'EMAIL' || $newProp->name === 'TEL') {
+
+ // We're going to make another attempt to find this
+ // property, this time just by value. If we find it, we
+ // consider it a success.
+ foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
+
+ if ($compareProp->getValue() === $newProp->getValue()) {
+ $ok = true;
+ break;
+ }
+ }
+
+ if (!$ok) {
+
+ // Merging the new value in the old vcard.
+ $collectedNames[$fn]->add(clone $newProp);
+ $ok = true;
+ $stats['Merged values']++;
+
+ }
+
+ }
+
+ }
+
+ if (!$ok) {
+
+ // echo $newProp->serialize() . " does not appear in earlier vcard!\n";
+ $stats['Error']++;
+ if ($debug) fwrite($debug, "Missing '" . $newProp->name . "' property in duplicate. Earlier vcard:\n" . $collectedNames[$fn]->serialize() . "\n\nLater:\n" . $vcard->serialize() . "\n\n");
+
+ $vcard->destroy();
+ continue 2;
+ }
+
+ }
+
+ }
+
+ $vcard->destroy();
+ $stats['Ignored duplicates']++;
+
+}
+
+foreach ($collectedNames as $vcard) {
+
+ // Overwriting any old PRODID
+ $vcard->PRODID = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN';
+ write($vcard);
+ writeStats();
+
+}
+
+echo str_repeat("\n", count($stats)), "\nDone.\n";
diff --git a/vendor/sabre/vobject/bin/rrulebench.php b/vendor/sabre/vobject/bin/rrulebench.php
new file mode 100644
index 000000000..af26b4765
--- /dev/null
+++ b/vendor/sabre/vobject/bin/rrulebench.php
@@ -0,0 +1,32 @@
+<?php
+
+include __DIR__ . '/../vendor/autoload.php';
+
+if ($argc < 4) {
+ echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
+ echo "\n";
+ echo "This script can be used to measure the speed of the 'recurrence expansion'\n";
+ echo "system.";
+ echo "\n";
+ echo "Usage: " . $argv[0] . " inputfile.ics startdate enddate\n";
+ die();
+}
+
+list(, $inputFile, $startDate, $endDate) = $argv;
+
+$bench = new Hoa\Bench\Bench();
+$bench->parse->start();
+
+echo "Parsing.\n";
+$vobj = Sabre\VObject\Reader::read(fopen($inputFile, 'r'));
+
+$bench->parse->stop();
+
+echo "Expanding.\n";
+$bench->expand->start();
+
+$vobj->expand(new DateTime($startDate), new DateTime($endDate));
+
+$bench->expand->stop();
+
+echo $bench,"\n";
diff --git a/vendor/sabre/vobject/bin/vobject b/vendor/sabre/vobject/bin/vobject
new file mode 100755
index 000000000..2aca7e729
--- /dev/null
+++ b/vendor/sabre/vobject/bin/vobject
@@ -0,0 +1,27 @@
+#!/usr/bin/env php
+<?php
+
+namespace Sabre\VObject;
+
+// This sucks.. we have to try to find the composer autoloader. But chances
+// are, we can't find it this way. So we'll do our bestest
+$paths = [
+ __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
+ __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
+];
+
+foreach($paths as $path) {
+ if (file_exists($path)) {
+ include $path;
+ break;
+ }
+}
+
+if (!class_exists('Sabre\\VObject\\Version')) {
+ fwrite(STDERR, "Composer autoloader could not be loaded.\n");
+ die(1);
+}
+
+$cli = new Cli();
+exit($cli->main($argv));
+
diff --git a/vendor/sabre/vobject/bin/vobjectvalidate.php b/vendor/sabre/vobject/bin/vobjectvalidate.php
deleted file mode 100755
index e0b2a479f..000000000
--- a/vendor/sabre/vobject/bin/vobjectvalidate.php
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-namespace Sabre\VObject;
-
-// This sucks.. we have to try to find the composer autoloader. But chances
-// are, we can't find it this way. So we'll do our bestest
-$paths = array(
- __DIR__ . '/../vendor/autoload.php', // In case vobject is cloned directly
- __DIR__ . '/../../../autoload.php', // In case vobject is a composer dependency.
-);
-
-foreach($paths as $path) {
- if (file_exists($path)) {
- include $path;
- break;
- }
-}
-
-if (!class_exists('Sabre\\VObject\\Version')) {
- fwrite(STDERR, "Composer autoloader could not be properly loaded.\n");
- die(1);
-}
-
-fwrite(STDERR, "SabreTooth VObject validator " . Version::VERSION . "\n");
-
-
-$repair = false;
-$posArgs = array();
-
-// Argument parsing:
-foreach($argv as $k=>$v) {
-
- if ($k===0) {
- continue;
- }
- if (substr($v,0,2)==='--') {
- switch($v) {
- case '--repair' :
- $repair = true;
- break;
- default :
- throw new InvalidArgumentException('Unknown option: ' . $v);
- break;
- }
- continue;
- }
- $posArgs[] = $v;
-
-}
-
-function help() {
-
- global $argv;
-
- fwrite(STDERR, <<<HELP
-Usage instructions:
-
- {$argv[0]} [--repair] inputfile [outputfile]
-
- inputfile Input .vcf or .ics file.
- outputfile Output .vcf or .ics file. This is only used with --repair.
- --repair Attempt to automatically repair broken files.
-
-For both the output- and inputfile "-" can be specified, to use STDIN and STDOUT
-respectively.
-
-All other output from this script is sent to STDERR.
-
-https://github.com/fruux/sabre-vobject
-
-HELP
-);
-
-}
-
-if (count($posArgs) < 1) {
- help();
- die();
-}
-
-if ($posArgs[0]!=='-') {
- $input = fopen($posArgs[0],'r');
-} else {
- $input = STDIN;
-}
-
-if (isset($posArgs[1]) && $posArgs[1]!=='-') {
- $output = fopen($posArgs[1],'w');
-} else {
- $output = STDOUT;
-}
-
-// This is a bit of a hack to easily support multiple objects in a single file.
-$inputStr = "BEGIN:X-SABRE-WRAPPER\r\n" . stream_get_contents($input);
-
-$inputStr = rtrim($inputStr, "\r\n") . "\r\nEND:X-SABRE-WRAPPER\r\n";
-
-// Now the actual work.
-$vObj = Reader::read($inputStr);
-
-$objects = $vObj->children();
-
-foreach($objects as $child) {
-
- switch($child->name) {
- case 'VCALENDAR' :
- fwrite(STDERR, "iCalendar: " . (string)$child->VERSION . "\n");
- break;
- case 'VCARD' :
- fwrite(STDERR, "vCard: " . (string)$child->VERSION . "\n");
- break;
- default :
- fwrite(STDERR, "This was an unknown object, but it did parse. It's likely that validation will give you unexpected results.\n");
- break;
- }
-
- $options = 0;
- if ($repair) $options |= Node::REPAIR;
-
- $warnings = $child->validate($options);
-
- if (!count($warnings)) {
- fwrite(STDERR, "[GOOD NEWS] No warnings!\n");
- } else {
- foreach($warnings as $warn) {
-
- fwrite(STDERR, $warn['message'] . "\n");
-
- }
-
- }
-
- if ($repair) {
- fwrite($output, $child->serialize());
- }
-
-}
-