@@ -31,7 +31,6 @@ |
||
| 31 | 31 | |
| 32 | 32 | use Callingallpapers\Parser\JoindinCfpParser; |
| 33 | 33 | use Callingallpapers\Parser\Lanyrd\LanyrdCfpParser; |
| 34 | -use Callingallpapers\Parser\PapercallIoParser; |
|
| 35 | 34 | use Callingallpapers\Parser\PapercallIoParserFactory; |
| 36 | 35 | use Callingallpapers\Service\TimezoneService; |
| 37 | 36 | use Callingallpapers\Writer\ApiCfpWriter; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | protected function configure() |
| 48 | 48 | { |
| 49 | 49 | $this->setName("parseCfPs") |
| 50 | - ->setDescription("Retrieve CfPs and parse them") |
|
| 51 | - ->setDefinition(array( |
|
| 52 | - new InputOption('start', 's', InputOption::VALUE_OPTIONAL, 'What should be the first date to be taken into account?', ''), |
|
| 53 | - )) |
|
| 54 | - ->setHelp(<<<EOT |
|
| 50 | + ->setDescription("Retrieve CfPs and parse them") |
|
| 51 | + ->setDefinition(array( |
|
| 52 | + new InputOption('start', 's', InputOption::VALUE_OPTIONAL, 'What should be the first date to be taken into account?', ''), |
|
| 53 | + )) |
|
| 54 | + ->setHelp(<<<EOT |
|
| 55 | 55 | Get details about CfPs from different sources |
| 56 | 56 | |
| 57 | 57 | Usage: |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | If you ommit the date the current date will be used instead |
| 62 | 62 | <info>callingallpapers parseCfPs<env></info> |
| 63 | 63 | EOT |
| 64 | - ); |
|
| 64 | + ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $timezoneService = new TimezoneService(new Client(), $config['timezonedb_token']); |
| 83 | 83 | $parser = new LanyrdCfpParser($timezoneService); |
| 84 | - // $parser->parse($writer); |
|
| 84 | + // $parser->parse($writer); |
|
| 85 | 85 | $parser = new JoindinCfpParser(); |
| 86 | - // $parser->parse($writer); |
|
| 86 | + // $parser->parse($writer); |
|
| 87 | 87 | $factory = new PapercallIoParserFactory($timezoneService); |
| 88 | 88 | $parser = $factory(); |
| 89 | 89 | $parser->parse($writer); |
@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class Description |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param \DOMDocument $dom |
|
| 37 | + * @param \DOMXPath $xpath |
|
| 38 | + */ |
|
| 35 | 39 | public function parse($dom, $xpath) |
| 36 | 40 | { |
| 37 | 41 | $result = $xpath->query('//div[contains(@class, "description")]'); |
@@ -150,6 +150,9 @@ |
||
| 150 | 150 | return [$location->lat, $location->lon]; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param \DOMXPath $xpath |
|
| 155 | + */ |
|
| 153 | 156 | public function getEventPage($xpath) |
| 154 | 157 | { |
| 155 | 158 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $content = file_Get_contents($uri); |
| 58 | 58 | $content = mb_convert_encoding($content, 'UTF-8'); |
| 59 | - $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>' . $content); |
|
| 59 | + $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>'.$content); |
|
| 60 | 60 | $dom->preserveWhiteSpace = false; |
| 61 | 61 | |
| 62 | 62 | $timezone = 'UTC'; |
@@ -154,15 +154,15 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
| 156 | 156 | |
| 157 | - if (! $confPath || $confPath->length == 0) { |
|
| 157 | + if (!$confPath || $confPath->length == 0) { |
|
| 158 | 158 | throw new \InvalidArgumentException('We can\'t find an EventPage'); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
| 162 | 162 | |
| 163 | - $content = file_get_contents('https://lanyrd.com' . $confPath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 163 | + $content = file_get_contents('https://lanyrd.com'.$confPath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 164 | 164 | $content = mb_convert_encoding($content, 'UTF-8'); |
| 165 | - $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>' . $content); |
|
| 165 | + $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>'.$content); |
|
| 166 | 166 | $dom->preserveWhiteSpace = false; |
| 167 | 167 | |
| 168 | 168 | return $dom; |
@@ -38,6 +38,10 @@ |
||
| 38 | 38 | $this->timezone = new \DateTimezone($timezone); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param \DOMDocument $dom |
|
| 43 | + * @param \DOMXPath $xpath |
|
| 44 | + */ |
|
| 41 | 45 | public function parse($dom, $xpath) |
| 42 | 46 | { |
| 43 | 47 | $endDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtend')]"); ///a/abbr[class='dtstart'] |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function parse($dom, $xpath) |
| 36 | 36 | { |
| 37 | 37 | $endDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtend')]"); ///a/abbr[class='dtstart'] |
| 38 | - if (! $endDate || $endDate->length == 0) { |
|
| 38 | + if (!$endDate || $endDate->length == 0) { |
|
| 39 | 39 | throw new \InvalidArgumentException('The Event does not seem to have an end date'); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class EventName |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param \DOMDocument $dom |
|
| 37 | + * @param \DOMXPath $xpath |
|
| 38 | + */ |
|
| 35 | 39 | public function parse($dom, $xpath) |
| 36 | 40 | { |
| 37 | 41 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
| 38 | 38 | |
| 39 | - if (! $confPath || $confPath->length == 0) { |
|
| 39 | + if (!$confPath || $confPath->length == 0) { |
|
| 40 | 40 | throw new \InvalidArgumentException('The CfP does not seem to have an eventname'); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -38,6 +38,10 @@ |
||
| 38 | 38 | $this->timezone = new \DateTimezone($timezone); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param \DOMDocument $dom |
|
| 43 | + * @param \DOMXPath $xpath |
|
| 44 | + */ |
|
| 41 | 45 | public function parse($dom, $xpath) |
| 42 | 46 | { |
| 43 | 47 | $startDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtstart')]"); ///a/abbr[class='dtstart'] |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function parse($dom, $xpath) |
| 36 | 36 | { |
| 37 | 37 | $startDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtstart')]"); ///a/abbr[class='dtstart'] |
| 38 | - if (! $startDate || $startDate->length == 0) { |
|
| 38 | + if (!$startDate || $startDate->length == 0) { |
|
| 39 | 39 | throw new \InvalidArgumentException('The Event does not seem to have a start date'); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class EventUri |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param \DOMDocument $dom |
|
| 37 | + * @param \DOMXPath $xpath |
|
| 38 | + */ |
|
| 35 | 39 | public function parse($dom, $xpath) |
| 36 | 40 | { |
| 37 | 41 | $uriPath = $xpath->query("//a[contains(@title, 'visit their website')]"); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $uriPath = $xpath->query("//a[contains(@title, 'visit their website')]"); |
| 38 | 38 | |
| 39 | - if (! $uriPath || $uriPath->length == 0) { |
|
| 39 | + if (!$uriPath || $uriPath->length == 0) { |
|
| 40 | 40 | throw new \InvalidArgumentException('The CfP does not seem to have an EventUri'); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | namespace Callingallpapers\Parser\Lanyrd; |
| 31 | 31 | |
| 32 | 32 | use Callingallpapers\Entity\Cfp; |
| 33 | -use Callingallpapers\Parser\Lanyrd\LanyrdEntryParser; |
|
| 34 | 33 | use Callingallpapers\Parser\ParserInterface; |
| 35 | 34 | use Callingallpapers\Service\TimezoneService; |
| 36 | 35 | use Callingallpapers\Writer\WriterInterface; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | do { |
| 48 | 48 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
| 49 | - $dom->loadHTMLFile($uri . '?page=' . ($i+1)); |
|
| 49 | + $dom->loadHTMLFile($uri.'?page='.($i + 1)); |
|
| 50 | 50 | $dom->preserveWhiteSpace = false; |
| 51 | 51 | |
| 52 | 52 | $xpath = new \DOMXPath($dom); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $eventPageUrl = $links->item(0)->attributes->getNamedItem('href')->textContent; |
| 79 | 79 | error_log($eventPageUrl); |
| 80 | - if (! $eventPageUrl) { |
|
| 80 | + if (!$eventPageUrl) { |
|
| 81 | 81 | continue; |
| 82 | 82 | } |
| 83 | 83 | $writer->write($lanyrdEntryParser->parse($eventPageUrl), 'lanyrd.com'); |
@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class Location |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param \DOMDocument $dom |
|
| 37 | + * @param \DOMXPath $xpath |
|
| 38 | + */ |
|
| 35 | 39 | public function parse($dom, $xpath) |
| 36 | 40 | { |
| 37 | 41 | $locations = $xpath->query("//div[contains(@class, 'vevent')]/p[contains(@class, 'location')]/a"); ///a/abbr[class='dtstart'] |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function parse($dom, $xpath) |
| 36 | 36 | { |
| 37 | 37 | $locations = $xpath->query("//div[contains(@class, 'vevent')]/p[contains(@class, 'location')]/a"); ///a/abbr[class='dtstart'] |
| 38 | - if (! $locations || $locations->length == 0) { |
|
| 38 | + if (!$locations || $locations->length == 0) { |
|
| 39 | 39 | throw new \InvalidArgumentException('The Event does not seem to have an end date'); |
| 40 | 40 | } |
| 41 | 41 | $location = []; |