9 __DIR__ .
'/../vendor/autoload.php',
10 __DIR__ .
'/../../../autoload.php',
14 if (file_exists($path)) {
20 if (!class_exists(
'Sabre\\VObject\\Version')) {
21 fwrite(STDERR,
"Composer autoloader could not be loaded.\n");
30 echo "Usage: ",
$argv[0],
" input.vcf output.vcf [debug.log]\n";
57 "No FN property" => 0,
58 "Ignored duplicates" => 0,
68 foreach ($stats as
$name => $value) {
69 echo str_pad(
$name, 23,
" ", STR_PAD_RIGHT), str_pad($value, 6,
" ", STR_PAD_LEFT),
"\n";
72 echo "\033[" . count($stats) .
"A";
80 $stats[
"Total written"]++;
81 fwrite($output, $vcard->serialize() .
"\n");
90 $fn = isset($vcard->FN) ? (string)$vcard->FN : null;
95 $stats[
"No FN property"]++;
113 foreach ($vcard->children() as $newProp) {
122 if ($compareProp->serialize() === $newProp->serialize()) {
130 if ($newProp->name ===
'EMAIL' || $newProp->name ===
'TEL') {
137 if ($compareProp->getValue() === $newProp->getValue()) {
148 $stats[
'Merged values']++;
160 if (
$debug) fwrite(
$debug,
"Missing '" . $newProp->name .
"' property in duplicate. Earlier vcard:\n" .
$collectedNames[$fn]->serialize() .
"\n\nLater:\n" . $vcard->serialize() .
"\n\n");
171 $stats[
'Ignored duplicates']++;
178 $vcard->PRODID =
'-//Sabre//Sabre VObject ' . Version::VERSION .
'//EN';
184 echo str_repeat(
"\n", count(
$stats)),
"\nDone.\n";
foreach($paths as $path) if(!class_exists( 'Sabre\\VObject\\Version'))
const VERSION
Full version number.