예제 #1
0
 /**
  * @return FastFeed
  */
 public static function create()
 {
     $fastFeed = new FastFeed(HttpAdapterFactory::create('guzzle'), new Logger(false));
     $fastFeed->pushParser(new RSSParser());
     $fastFeed->pushParser(new AtomParser());
     return $fastFeed;
 }
 /**
  * @param string $base_url
  * @param string|null $adaptor_name
  * @throws HttpAdapterException
  */
 public function __construct($base_url, $adaptor_name, HttpClient $httpClient = null)
 {
     if (!is_null($httpClient) && $httpClient instanceof HttpClient) {
         $this->httpClient = $httpClient;
     } else {
         if (is_string($adaptor_name) && HttpAdapterFactory::capable($adaptor_name)) {
             $this->httpClient = HttpAdapterFactory::create($adaptor_name);
         } else {
             $this->httpClient = HttpAdapterFactory::guess();
         }
         $this->httpClient->getConfiguration()->setBaseUri($base_url);
     }
 }
 /**
  * Establish an adapter connection.
  *
  * @param array $config
  *
  * @return \Ivory\HttpAdapter\HttpAdapterInterface
  */
 public function createAdapter(array $config)
 {
     return $this->adapter->create($config['adapter']);
 }