@@ -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) |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $xpath = new DOMXPath($dom); |
| 44 | 44 | $titlePath = $xpath->query("//h1[contains(@class, 'subheader__subtitle')]"); |
| 45 | 45 | |
| 46 | - if (! $titlePath || $titlePath->length == 0) { |
|
| 46 | + if (!$titlePath || $titlePath->length == 0) { |
|
| 47 | 47 | return $cfp; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $xpath = new DOMXPath($dom); |
| 45 | 45 | $titlePath = $xpath->query("//h1[contains(@class, 'subheader__title')]"); |
| 46 | 46 | |
| 47 | - if (! $titlePath || $titlePath->length == 0) { |
|
| 47 | + if (!$titlePath || $titlePath->length == 0) { |
|
| 48 | 48 | throw new \InvalidArgumentException('The CfP does not seem to have an eventname'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $xpath = new DOMXPath($dom); |
| 44 | 44 | $uriPath = $xpath->query("//h1/following-sibling::a"); |
| 45 | 45 | |
| 46 | - if (! $uriPath || $uriPath->length == 0) { |
|
| 46 | + if (!$uriPath || $uriPath->length == 0) { |
|
| 47 | 47 | throw new \InvalidArgumentException('The CfP does not seem to have an EventUri'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -43,11 +43,11 @@ |
||
| 43 | 43 | $xpath = new DOMXPath($dom); |
| 44 | 44 | $titlePath = $xpath->query("//a[starts-with(@href, '/cfps/')]"); |
| 45 | 45 | |
| 46 | - if (! $titlePath || $titlePath->length == 0) { |
|
| 46 | + if (!$titlePath || $titlePath->length == 0) { |
|
| 47 | 47 | throw new \InvalidArgumentException('The CfP does not seem to have a CfP-Uri'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $cfp->uri = 'https://papercall.io' . trim($titlePath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 50 | + $cfp->uri = 'https://papercall.io'.trim($titlePath->item(0)->attributes->getNamedItem('href')->textContent); |
|
| 51 | 51 | |
| 52 | 52 | return $cfp; |
| 53 | 53 | } |
@@ -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 | $timezone = $this->timezone; |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $openingDate = $xpath->query("//span[text()='Openend on:']/following-sibling::strong"); |
| 49 | - if (! $openingDate || $openingDate->length == 0) { |
|
| 49 | + if (!$openingDate || $openingDate->length == 0) { |
|
| 50 | 50 | throw new \UnexpectedValueException('No CfP-Open Date found'); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,11 +59,11 @@ |
||
| 59 | 59 | |
| 60 | 60 | $values = json_decode($result->getBody()->getContents(), true); |
| 61 | 61 | |
| 62 | - if (! isset($values[0])) { |
|
| 62 | + if (!isset($values[0])) { |
|
| 63 | 63 | return new Geolocation(0, 0); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (! isset($values[0]['lat']) || ! isset($values[0]['lon'])) { |
|
| 66 | + if (!isset($values[0]['lat']) || !isset($values[0]['lon'])) { |
|
| 67 | 67 | return new Geolocation(0, 0); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $xpath = new DOMXPath($dom); |
| 44 | 44 | |
| 45 | 45 | $tagsPath = $xpath->query("//h1/following-sibling::a/following-sibling::span"); |
| 46 | - if (! $tagsPath || $tagsPath->length == 0) { |
|
| 46 | + if (!$tagsPath || $tagsPath->length == 0) { |
|
| 47 | 47 | return $cfp; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | } |
| 55 | 55 | $xpath = new DOMXPath($node->ownerDocument); |
| 56 | 56 | $closingDate = $xpath->query(".//time/@datetime", $node); |
| 57 | - if (! $closingDate || $closingDate->length == 0) { |
|
| 57 | + if (!$closingDate || $closingDate->length == 0) { |
|
| 58 | 58 | throw new InvalidArgumentException('The CfP does not seem to have a closing date'); |
| 59 | 59 | } |
| 60 | 60 | |