#!/usr/bin/env php $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, <<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()); } }