aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/bin
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/vobject/bin')
-rw-r--r--vendor/sabre/vobject/bin/bench.php4
-rw-r--r--vendor/sabre/vobject/bin/bench_freebusygenerator.php29
-rw-r--r--vendor/sabre/vobject/bin/bench_manipulatevcard.php39
-rw-r--r--vendor/sabre/vobject/bin/fetch_windows_zones.php20
-rw-r--r--vendor/sabre/vobject/bin/generateicalendardata.php33
-rw-r--r--vendor/sabre/vobject/bin/mergeduplicates.php100
-rw-r--r--vendor/sabre/vobject/bin/rrulebench.php8
7 files changed, 96 insertions, 137 deletions
diff --git a/vendor/sabre/vobject/bin/bench.php b/vendor/sabre/vobject/bin/bench.php
index 807b40777..0a2736fa6 100644
--- a/vendor/sabre/vobject/bin/bench.php
+++ b/vendor/sabre/vobject/bin/bench.php
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
$data = stream_get_contents(STDIN);
@@ -9,4 +9,4 @@ $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
index 2c51b2a32..1299c14fb 100644
--- a/vendor/sabre/vobject/bin/bench_freebusygenerator.php
+++ b/vendor/sabre/vobject/bin/bench_freebusygenerator.php
@@ -1,16 +1,16 @@
<?php
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
if ($argc < 2) {
- echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " freebusy benchmark\n";
+ 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";
+ echo 'Usage: '.$argv[0]." inputfile.ics\n";
die();
}
@@ -30,33 +30,24 @@ $timeZone = new \DateTimeZone('America/Toronto');
$bench->fb->start();
-for ($i = 0; $i < $repeat; $i++) {
-
+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) {
-
+function formatMemory($input)
+{
if (strlen($input) > 6) {
-
- return round($input / (1024 * 1024)) . 'M';
-
+ return round($input / (1024 * 1024)).'M';
} elseif (strlen($input) > 3) {
-
- return round($input / 1024) . 'K';
-
+ 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";
+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
index adc198e9b..f229091db 100644
--- a/vendor/sabre/vobject/bin/bench_manipulatevcard.php
+++ b/vendor/sabre/vobject/bin/bench_manipulatevcard.php
@@ -1,15 +1,15 @@
<?php
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
if ($argc < 2) {
- echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " manipulation benchmark\n";
+ 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 'system.';
echo "\n";
- echo "Usage: " . $argv[0] . " inputfile.vcf\n";
+ echo 'Usage: '.$argv[0]." inputfile.vcf\n";
die();
}
@@ -22,18 +22,21 @@ $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;
+ 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;
+ if (isset($vcard->EMAIL)) {
+ foreach ($vcard->EMAIL as $email) {
+ $emails[] = (string) $email;
+ }
}
$bench->manipulate->pause();
@@ -42,28 +45,20 @@ while (true) {
$bench->serialize->pause();
$vcard->destroy();
-
}
-
-
echo $bench,"\n";
-function formatMemory($input) {
-
+function formatMemory($input)
+{
if (strlen($input) > 6) {
-
- return round($input / (1024 * 1024)) . 'M';
-
+ return round($input / (1024 * 1024)).'M';
} elseif (strlen($input) > 3) {
-
- return round($input / 1024) . 'K';
-
+ 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";
+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
index 3f2a00f7a..9c4e51abd 100644
--- a/vendor/sabre/vobject/bin/fetch_windows_zones.php
+++ b/vendor/sabre/vobject/bin/fetch_windows_zones.php
@@ -2,9 +2,9 @@
<?php
$windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml';
-$outputFile = __DIR__ . '/../lib/timezonedata/windowszones.php';
+$outputFile = __DIR__.'/../lib/timezonedata/windowszones.php';
-echo "Fetching timezone map from: " . $windowsZonesUrl, "\n";
+echo 'Fetching timezone map from: '.$windowsZonesUrl, "\n";
$data = file_get_contents($windowsZonesUrl);
@@ -13,16 +13,14 @@ $xml = simplexml_load_string($data);
$map = [];
foreach ($xml->xpath('//mapZone') as $mapZone) {
-
- $from = (string)$mapZone['other'];
- $to = (string)$mapZone['type'];
+ $from = (string) $mapZone['other'];
+ $to = (string) $mapZone['type'];
list($to) = explode(' ', $to, 2);
if (!isset($map[$from])) {
$map[$from] = $to;
}
-
}
ksort($map);
@@ -33,19 +31,19 @@ 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, ' * Last update: '.date(DATE_W3C)."\n");
+fwrite($f, ' * Source: '.$windowsZonesUrl."\n");
fwrite($f, " *\n");
fwrite($f, " * @copyright Copyright (C) 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) . ';');
+fwrite($f, 'return ');
+fwrite($f, var_export($map, true).';');
fclose($f);
echo "Formatting\n";
-exec(__DIR__ . '/sabre-cs-fixer fix ' . escapeshellarg($outputFile));
+exec(__DIR__.'/sabre-cs-fixer fix '.escapeshellarg($outputFile));
echo "Done\n";
diff --git a/vendor/sabre/vobject/bin/generateicalendardata.php b/vendor/sabre/vobject/bin/generateicalendardata.php
index a2df3c63a..62b6107c5 100644
--- a/vendor/sabre/vobject/bin/generateicalendardata.php
+++ b/vendor/sabre/vobject/bin/generateicalendardata.php
@@ -23,54 +23,53 @@ HI
$events = 100;
-if (isset($argv[1])) $events = (int)$argv[1];
+if (isset($argv[1])) {
+ $events = (int) $argv[1];
+}
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
-fwrite(STDERR, "Generating " . $events . " events\n");
+fwrite(STDERR, 'Generating '.$events." events\n");
-$currentDate = new DateTime('-' . round($events / 2) . ' days');
+$currentDate = new DateTime('-'.round($events / 2).' days');
$calendar = new VObject\Component\VCalendar();
$ii = 0;
while ($ii < $events) {
-
- $ii++;
+ ++$ii;
$event = $calendar->add('VEVENT');
$event->DTSTART = 'bla';
- $event->SUMMARY = 'Event #' . $ii;
+ $event->SUMMARY = 'Event #'.$ii;
$event->UID = md5(microtime(true));
$doctorRandom = mt_rand(1, 1000);
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');
+ $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);
- // No break intentional
- default :
+ case 2:
+ $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);
- $event->DURATION = 'PT' . mt_rand(1, 3) . 'H';
+ $event->DURATION = 'PT'.mt_rand(1, 3).'H';
break;
-
}
-
- $currentDate->modify('+ ' . mt_rand(0, 3) . ' days');
+ $currentDate->modify('+ '.mt_rand(0, 3).' days');
}
fwrite(STDERR, "Validating\n");
diff --git a/vendor/sabre/vobject/bin/mergeduplicates.php b/vendor/sabre/vobject/bin/mergeduplicates.php
index 076524d36..e6cde73dd 100644
--- a/vendor/sabre/vobject/bin/mergeduplicates.php
+++ b/vendor/sabre/vobject/bin/mergeduplicates.php
@@ -6,8 +6,8 @@ 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.
+ __DIR__.'/../vendor/autoload.php', // In case vobject is cloned directly
+ __DIR__.'/../../../autoload.php', // In case vobject is a composer dependency.
];
foreach ($paths as $path) {
@@ -22,14 +22,12 @@ if (!class_exists('Sabre\\VObject\\Version')) {
die(1);
}
-echo "sabre/vobject ", Version::VERSION, " duplicate contact merge tool\n";
+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";
+ echo 'Usage: ', $argv[0], " input.vcf output.vcf [debug.log]\n";
die(1);
-
}
$input = fopen($argv[1], 'r');
@@ -42,83 +40,72 @@ $splitter = new Splitter\VCard($input);
// but not in others, we don't consider them for the sake of finding
// differences.
$ignoredProperties = [
- "PRODID",
- "VERSION",
- "REV",
- "UID",
- "X-ABLABEL",
+ '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,
+ 'Total vcards' => 0,
+ 'No FN property' => 0,
+ 'Ignored duplicates' => 0,
+ 'Merged values' => 0,
+ 'Error' => 0,
+ 'Unique cards' => 0,
+ 'Total written' => 0,
];
-function writeStats() {
-
+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";
+ 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";
-
+ echo "\033[".count($stats).'A';
}
-function write($vcard) {
-
+function write($vcard)
+{
global $stats, $output;
- $stats["Total written"]++;
- fwrite($output, $vcard->serialize() . "\n");
-
+ ++$stats['Total written'];
+ fwrite($output, $vcard->serialize()."\n");
}
while ($vcard = $splitter->getNext()) {
-
- $stats["Total vcards"]++;
+ ++$stats['Total vcards'];
writeStats();
- $fn = isset($vcard->FN) ? (string)$vcard->FN : null;
+ $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']++;
+ ++$stats['No FN property'];
+ ++$stats['Unique cards'];
write($vcard);
$vcard->destroy();
continue;
-
}
if (!isset($collectedNames[$fn])) {
-
$collectedNames[$fn] = $vcard;
- $stats['Unique cards']++;
+ ++$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;
@@ -126,14 +113,11 @@ while ($vcard = $splitter->getNext()) {
}
if (!$ok) {
-
- if ($newProp->name === 'EMAIL' || $newProp->name === 'TEL') {
-
+ if ('EMAIL' === $newProp->name || 'TEL' === $newProp->name) {
// 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;
@@ -141,44 +125,36 @@ while ($vcard = $splitter->getNext()) {
}
if (!$ok) {
-
// Merging the new value in the old vcard.
$collectedNames[$fn]->add(clone $newProp);
$ok = true;
- $stats['Merged values']++;
-
+ ++$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");
-
+ ++$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']++;
-
+ ++$stats['Ignored duplicates'];
}
foreach ($collectedNames as $vcard) {
-
// Overwriting any old PRODID
- $vcard->PRODID = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN';
+ $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
index af26b4765..583da574c 100644
--- a/vendor/sabre/vobject/bin/rrulebench.php
+++ b/vendor/sabre/vobject/bin/rrulebench.php
@@ -1,14 +1,14 @@
<?php
-include __DIR__ . '/../vendor/autoload.php';
+include __DIR__.'/../vendor/autoload.php';
if ($argc < 4) {
- echo "sabre/vobject ", Sabre\VObject\Version::VERSION, " RRULE benchmark\n";
+ 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 'system.';
echo "\n";
- echo "Usage: " . $argv[0] . " inputfile.ics startdate enddate\n";
+ echo 'Usage: '.$argv[0]." inputfile.ics startdate enddate\n";
die();
}