Exemplo n.º 1
0
 /**
  * @param DistributorItem $distributorItem
  * @throws PartnerException
  */
 public function __construct(DistributorItem $distributorItem)
 {
     switch ($distributorItem->getPartnerId()) {
         case OTACrawler::OTA_BOOKING_COM:
             $this->parser = new Parser\Booking($distributorItem);
             break;
         case OTACrawler::OTA_EXPEDIA:
             $this->parser = new Parser\Expedia($distributorItem);
             break;
         case OTACrawler::OTA_VENERE:
             $this->parser = new Parser\Venere($distributorItem);
             break;
         case OTACrawler::OTA_AGODA:
             $this->parser = new Parser\Agoda($distributorItem);
             break;
         case OTACrawler::OTA_EASY_TO_BOOK:
             $this->parser = new Parser\EasyToBook($distributorItem);
             break;
         case OTACrawler::OTA_LATEROOMS:
             $this->parser = new Parser\Laterooms($distributorItem);
             break;
         case OTACrawler::OTA_HOTELS_NL:
             $this->parser = new Parser\HotelsNL($distributorItem);
             break;
         case OTACrawler::OTA_ORBITZ:
             $this->parser = new Parser\Orbitz($distributorItem);
             break;
         default:
             throw new PartnerException("Respective Parser not defined for partner {$distributorItem->getPartnerName()} (id: " . $distributorItem->getPartnerId() . ').', Parser::PARSER_MISSING);
     }
 }
Exemplo n.º 2
0
 /**
  * @param DistributorItem $distributorItem
  * @throws ReaderException
  */
 public function __construct(DistributorItem $distributorItem)
 {
     $this->distributorItem = $distributorItem;
     $this->transport = new Reader($distributorItem->getUrl());
     if (empty($this->transport->getUrl())) {
         throw new ReaderException('Url Cannot be empty.', self::PARSER_EMPTY_URL);
     }
 }