public function __invoke($services)
 {
     $http = $services->get('http');
     FeedReader::setHttpClient($http);
     FeedReader::setExtensionManager($this->createExtensionManager());
     $config = $services->get('Config');
     $config = $config['github'];
     $reader = new AtomReader($config['user']);
     $reader->setLimit($config['limit']);
     return $reader;
 }
 public function __invoke(ContainerInterface $container) : AtomReader
 {
     $http = $container->get(FeedReaderHttpClientInterface::class);
     FeedReader::setHttpClient($http);
     FeedReader::setExtensionManager(new StandaloneExtensionManager());
     $config = $container->get('config');
     $config = $config['github'];
     $reader = new AtomReader($config['user']);
     $reader->setLimit($config['limit']);
     $reader->addFilter(function ($entry) {
         if (false !== strpos($entry->getLink(), 'weierophinney/mwop.net')) {
             return false;
         }
         return true;
     });
     return $reader;
 }
Exemple #3
0
 /**
  * Handle the incoming console request
  */
 public function __invoke(Route $route, Console $console) : int
 {
     if (!$route->matchedParam('output')) {
         return $this->reportError($console, $width, $length, 'Missing output file');
     }
     $message = 'Retrieving Github activity links';
     $length = strlen($message);
     $width = $console->getWidth();
     $console->write($message, Color::BLUE);
     try {
         $data = $this->reader->read();
     } catch (Throwable $e) {
         return $this->reportError($console, $width, $length, $e);
     }
     file_put_contents($route->getMatchedParam('output'), $this->createContentFromData($data, $route->getMatchedParam('template', $this->outputTemplateString)));
     return $this->reportSuccess($console, $width, $length);
 }