@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class Uri |
| 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 | $uri = $xpath->query( |
@@ -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 | |
@@ -114,6 +114,9 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $location |
|
| 119 | + */ |
|
| 117 | 120 | protected function getLatLonForLocation($location) |
| 118 | 121 | { |
| 119 | 122 | $result = $this->client->get(sprintf( |
@@ -131,6 +134,9 @@ discard block |
||
| 131 | 134 | return [$location->lat, $location->lon]; |
| 132 | 135 | } |
| 133 | 136 | |
| 137 | + /** |
|
| 138 | + * @param \DOMXPath $xpath |
|
| 139 | + */ |
|
| 134 | 140 | public function getEventPage($xpath) |
| 135 | 141 | { |
| 136 | 142 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $content = file_Get_contents($uri); |
| 56 | 56 | $content = mb_convert_encoding($content, 'UTF-8'); |
| 57 | - $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>' . $content); |
|
| 57 | + $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>'.$content); |
|
| 58 | 58 | $dom->preserveWhiteSpace = false; |
| 59 | 59 | |
| 60 | 60 | $xpath = new \DOMXPath($dom); |
@@ -135,15 +135,15 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $confPath = $xpath->query("//h3/a[contains(@class, 'summary')]"); |
| 137 | 137 | |
| 138 | - if (! $confPath || $confPath->length == 0) { |
|
| 138 | + if (!$confPath || $confPath->length == 0) { |
|
| 139 | 139 | throw new \InvalidArgumentException('We can\'t find an EventPage'); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
| 143 | 143 | |
| 144 | - $content = file_get_contents('https://lanyrd.com' . $confPath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 144 | + $content = file_get_contents('https://lanyrd.com'.$confPath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 145 | 145 | $content = mb_convert_encoding($content, 'UTF-8'); |
| 146 | - $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>' . $content); |
|
| 146 | + $dom->loadHTML('<?xml version="1.0" charset="UTF-8" ?>'.$content); |
|
| 147 | 147 | $dom->preserveWhiteSpace = false; |
| 148 | 148 | |
| 149 | 149 | return $dom; |
@@ -32,6 +32,10 @@ |
||
| 32 | 32 | class Uri |
| 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 | $uri = $xpath->query( |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function parse($dom, $xpath) |
| 36 | 36 | { |
| 37 | 37 | $openingDate = $xpath->query("//span[text()='Openend on:']/following-sibling::strong"); |
| 38 | - if (! $openingDate || $openingDate->length == 0) { |
|
| 38 | + if (!$openingDate || $openingDate->length == 0) { |
|
| 39 | 39 | return new \DateTime(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | try { |
| 83 | 83 | $this->client->request('GET', sprintf( |
| 84 | - $this->baseUri . '/%1$s', |
|
| 84 | + $this->baseUri.'/%1$s', |
|
| 85 | 85 | sha1($cfp->conferenceUri) |
| 86 | 86 | ), []); |
| 87 | 87 | $exists = true; |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | $this->baseUri |
| 97 | 97 | ), [ |
| 98 | 98 | 'headers' => [ |
| 99 | - 'Authenticate' => 'Bearer ' . $this->bearerToken, |
|
| 99 | + 'Authenticate' => 'Bearer '.$this->bearerToken, |
|
| 100 | 100 | ], |
| 101 | 101 | 'form_params' => $body |
| 102 | 102 | ]); |
| 103 | 103 | } else { |
| 104 | 104 | // Exists, so update it |
| 105 | 105 | $response = $this->client->request('PUT', sprintf( |
| 106 | - $this->baseUri . '/%1$s', |
|
| 106 | + $this->baseUri.'/%1$s', |
|
| 107 | 107 | sha1($cfp->conferenceUri) |
| 108 | 108 | ), [ |
| 109 | 109 | 'headers' => [ |
| 110 | - 'Authenticate' => 'Bearer ' . $this->bearerToken, |
|
| 110 | + 'Authenticate' => 'Bearer '.$this->bearerToken, |
|
| 111 | 111 | ], |
| 112 | 112 | 'form_params' => $body |
| 113 | 113 | ]); |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | $this->output->writeln(sprintf( |
| 124 | 124 | 'Conference "%1$s" succcessfully %2$s.', |
| 125 | 125 | $cfp->conferenceName, |
| 126 | - ($exists)?'updated':'created' |
|
| 126 | + ($exists) ? 'updated' : 'created' |
|
| 127 | 127 | )); |
| 128 | 128 | |
| 129 | - return (isset($response) && ($response->getStatusCode() === 200 || $response->getStatusCode() === 201))?'Success':'Failure'; |
|
| 129 | + return (isset($response) && ($response->getStatusCode() === 200 || $response->getStatusCode() === 201)) ? 'Success' : 'Failure'; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function setOutput(OutputInterface $output) |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | $content = json_decode($content, true); |
| 48 | 48 | |
| 49 | 49 | foreach ($content['events'] as $event) { |
| 50 | - if (! $event['cfp_url']) { |
|
| 50 | + if (!$event['cfp_url']) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | $info = new Cfp(); |
| 54 | 54 | $info->conferenceName = $event['name']; |
| 55 | 55 | $info->conferenceUri = $event['href']; |
| 56 | 56 | if ($event['icon']) { |
| 57 | - $info->iconUri = 'https://joind.in/inc/img/event_icons/' . $event['icon']; |
|
| 57 | + $info->iconUri = 'https://joind.in/inc/img/event_icons/'.$event['icon']; |
|
| 58 | 58 | } |
| 59 | 59 | $info->eventEndDate = new \DateTimeImmutable($event['end_date']); |
| 60 | 60 | $info->eventStartDate = new \DateTimeImmutable($event['start_date']); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $info->longitude = $event['longitude']; |
| 67 | 67 | $info->tags = $event['tags']; |
| 68 | 68 | $info->uri = $event['cfp_url']; |
| 69 | - $info->timezone = $event['tz_continent'] . '/' . $event['tz_place']; |
|
| 69 | + $info->timezone = $event['tz_continent'].'/'.$event['tz_place']; |
|
| 70 | 70 | |
| 71 | 71 | $writer->write($info, 'joind.in'); |
| 72 | 72 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | class WriterFactory |
| 31 | 31 | { |
| 32 | - public $configFile = __DIR__ . '/../../config/callingallpapers.ini'; |
|
| 32 | + public $configFile = __DIR__.'/../../config/callingallpapers.ini'; |
|
| 33 | 33 | |
| 34 | 34 | public function getWriter() |
| 35 | 35 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | throw new UnknownWriterException('The requested writer could not be created'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (! $writer instanceof WriterInterface) { |
|
| 45 | + if (!$writer instanceof WriterInterface) { |
|
| 46 | 46 | throw new InvalidWriterException('The requested writer is not of the expected type'); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | $values = json_decode($result->getBody()->getContents(), true); |
| 65 | 65 | |
| 66 | - if (! isset($values['status']) || $values['status'] !== 'OK') { |
|
| 66 | + if (!isset($values['status']) || $values['status'] !== 'OK') { |
|
| 67 | 67 | return 'UTC'; |
| 68 | 68 | } |
| 69 | 69 | |