public function feed_add($options)
 {
     $this->cli->header('adding new feed');
     if (count($options) != 1) {
         $this->cli->error('exactly one parameter (url) should be given');
         return;
     }
     if (!is_null(Kingboard_EdkFeed::findByUrl($options[0]))) {
         $this->cli->error('a feed by this url allready exists!');
         return;
     }
     $feed = new Kingboard_EdkFeed();
     $feed->url = $options[0];
     $feed->save();
     $this->cli->positive('done');
 }
 public function feed_pull($options)
 {
     $this->cli->header('pulling all feeds');
     $feeds = Kingboard_EdkFeed::find();
     foreach ($feeds as $feed) {
         $url = $feed->url;
         $this->cli->message('pulling ' . $url);
         $sxo = simplexml_load_file($url);
         $processed = 0;
         $killcount = count($sxo->channel->item);
         $this->cli->message("processing {$killcount} kills.");
         foreach ($sxo->channel->item as $item) {
             $this->cli->message('processing ' . ++$processed . ' out of ' . $killcount);
             $mailtext = trim((string) $item->description);
             if (isset($item->apiID)) {
                 $apiId = (string) $item->apiID;
             } else {
                 $apiId = null;
             }
             try {
                 $mail = Kingboard_KillmailParser_Factory::parseTextMail($mailtext);
                 $mail->killID = $apiId;
                 $mail->save();
             } catch (Kingboard_KillmailParser_KillmailErrorException $e) {
                 $this->cli->error("Exception caught, mail was not processed");
                 $this->cli->error($e->getMessage());
                 $this->cli->error($e->getFile() . '::' . $e->getLine());
             }
         }
         $this->cli->positive('done');
     }
 }