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::optsGeneric($cmd);
17 'description' => 'URL that is replied to',
25 'description' => 'Answer: yes, no, maybe',
33 'description' => 'Answer text',
38 public function run(\Console_CommandLine_Result $cmdRes)
40 $url = Validator::url($cmdRes->args['url'], 'url');
44 $rsvp = Validator::rsvp($cmdRes->args['rsvp']);
45 if ($rsvp === false) {
49 $req = new Request($this->cfg->host, $this->cfg);
50 $req->req->addPostParameter('h', 'entry');
51 $req->req->addPostParameter('in-reply-to', $url);
52 $req->req->addPostParameter('rsvp', $rsvp);
53 if ($cmdRes->args['text'] != '') {
54 $req->req->addPostParameter('content', $cmdRes->args['text']);
56 $this->handleGenericOptions($cmdRes, $req);
59 $postUrl = $res->getHeader('Location');
60 Log::info('RSVP created at server');