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 $cmd->description = 'Create a reservation';
13 static::addOptHtml($cmd);
14 static::optsGeneric($cmd);
19 'description' => 'URL that is replied to',
27 'description' => 'Answer: yes, no, maybe',
35 'description' => 'Answer text',
40 public function run(\Console_CommandLine_Result $cmdRes)
42 $url = Validator::url($cmdRes->args['url'], 'url');
46 $rsvp = Validator::rsvp($cmdRes->args['rsvp']);
47 if ($rsvp === false) {
51 $req = new Request($this->cfg->host, $this->cfg);
52 $req->setType('h', 'entry');
53 $req->addProperty('in-reply-to', $url);
54 $req->addProperty('rsvp', $rsvp);
55 if ($cmdRes->args['text']) {
56 $req->addContent($cmdRes->args['text'], $cmdRes->options['html']);
58 $this->handleGenericOptions($cmdRes, $req);
61 $postUrl = $res->getHeader('Location');
62 Log::info('RSVP created at server');