5 * Repondez s'il vous plait - an answer to an invitation
7 class Command_Rsvp extends Command_AbstractProps
9 public static function opts(\Console_CommandLine $optParser)
11 $cmd = $optParser->addCommand('rsvp');
12 static::addOptHtml($cmd);
13 static::optsGeneric($cmd);
18 'description' => 'URL that is replied to',
26 'description' => 'Answer: yes, no, maybe',
34 'description' => 'Answer text',
39 public function run(\Console_CommandLine_Result $cmdRes)
41 $url = Validator::url($cmdRes->args['url'], 'url');
45 $rsvp = Validator::rsvp($cmdRes->args['rsvp']);
46 if ($rsvp === false) {
50 $req = new Request($this->cfg->host, $this->cfg);
51 $req->setType('h', 'entry');
52 $req->addProperty('in-reply-to', $url);
53 $req->addProperty('rsvp', $rsvp);
54 if ($cmdRes->args['text']) {
55 $req->addContent($cmdRes->args['text'], $cmdRes->options['html']);
57 $this->handleGenericOptions($cmdRes, $req);
60 $postUrl = $res->getHeader('Location');
61 Log::info('RSVP created at server');