@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | try { |
66 | 66 | $uri = ''; |
67 | 67 | $this->client->get($cfp->conferenceUri, [ |
68 | - 'on_stats' => function (TransferStats $stats) use (&$uri) { |
|
68 | + 'on_stats' => function(TransferStats $stats) use (&$uri) { |
|
69 | 69 | $uri = (string) $stats->getEffectiveUri(); |
70 | 70 | } |
71 | 71 | ]); |
72 | 72 | } catch (\Exception $e) { |
73 | - throw new \InvalidArgumentException('Event-URI could not be verified: ' . $e->getMessage()); |
|
73 | + throw new \InvalidArgumentException('Event-URI could not be verified: '.$e->getMessage()); |
|
74 | 74 | } |
75 | 75 | $cfp->conferenceUri = $uri; |
76 | 76 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | try { |
99 | 99 | $this->client->request('GET', sprintf( |
100 | - $this->baseUri . '/%1$s', |
|
100 | + $this->baseUri.'/%1$s', |
|
101 | 101 | sha1($cfp->conferenceUri) |
102 | 102 | ), []); |
103 | 103 | $exists = true; |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | $this->baseUri |
113 | 113 | ), [ |
114 | 114 | 'headers' => [ |
115 | - 'Authorization' => 'Bearer ' . $this->bearerToken, |
|
115 | + 'Authorization' => 'Bearer '.$this->bearerToken, |
|
116 | 116 | ], |
117 | 117 | 'form_params' => $body |
118 | 118 | ]); |
119 | 119 | } else { |
120 | 120 | // Exists, so update it |
121 | 121 | $response = $this->client->request('PUT', sprintf( |
122 | - $this->baseUri . '/%1$s', |
|
122 | + $this->baseUri.'/%1$s', |
|
123 | 123 | sha1($cfp->conferenceUri) |
124 | 124 | ), [ |
125 | 125 | 'headers' => [ |
126 | - 'Authorization' => 'Bearer ' . $this->bearerToken, |
|
126 | + 'Authorization' => 'Bearer '.$this->bearerToken, |
|
127 | 127 | ], |
128 | 128 | 'form_params' => $body |
129 | 129 | ]); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | $this->output->writeln(sprintf( |
140 | 140 | 'Conference "%1$s" succcessfully %2$s.', |
141 | 141 | $cfp->conferenceName, |
142 | - ($exists)?'updated':'created' |
|
142 | + ($exists) ? 'updated' : 'created' |
|
143 | 143 | )); |
144 | 144 | |
145 | - return (isset($response) && ($response->getStatusCode() === 200 || $response->getStatusCode() === 201))?'Success':'Failure'; |
|
145 | + return (isset($response) && ($response->getStatusCode() === 200 || $response->getStatusCode() === 201)) ? 'Success' : 'Failure'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function setOutput(OutputInterface $output) |
@@ -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 = []; |