Completed
Pull Request — master (#28)
by Andreas
01:52
created
src/Writer/ApiCfpWriter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Parser/PapercallIo/OpeningDate.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -38,6 +38,10 @@
 block discarded – undo
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
         $openingDate = $xpath->query("//span[text()='Openend on:']/following-sibling::strong");
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function parse($dom, $xpath)
42 42
     {
43 43
         $openingDate = $xpath->query("//span[text()='Openend on:']/following-sibling::strong");
44
-        if (! $openingDate || $openingDate->length == 0) {
44
+        if (!$openingDate || $openingDate->length == 0) {
45 45
             throw new \UnexpectedValueException('No CfP-Open Date found');
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/Parser/PapercallIo/ClosingDate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     {
51 51
         $xpath = new DOMXPath($node->ownerDocument);
52 52
         $closingDate = $xpath->query(".//time/@datetime", $node);
53
-        if (! $closingDate || $closingDate->length == 0) {
53
+        if (!$closingDate || $closingDate->length == 0) {
54 54
             throw new InvalidArgumentException('The CfP does not seem to have a closing date');
55 55
         }
56 56
 
Please login to merge, or discard this patch.
src/Parser/PapercallIoParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         do {
67 67
             $dom = new DOMDocument('1.0', 'UTF-8');
68 68
             libxml_use_internal_errors(true);
69
-            $uri = sprintf($this->uri, $i+1);
69
+            $uri = sprintf($this->uri, $i + 1);
70 70
             $dom->loadHTMLFile($uri);
71 71
             libxml_use_internal_errors(false);
72 72
             $dom->preserveWhiteSpace = false;
Please login to merge, or discard this patch.
src/Parser/PapercallIo/EventEndDate.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
 use Callingallpapers\Entity\Cfp;
33 33
 use Callingallpapers\Parser\EventDetailParserInterface;
34 34
 use DateTimeImmutable;
35
-use DateTimeZone;
36 35
 use DOMDocument;
37 36
 use DOMNode;
38 37
 use DOMXPath;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,30 +51,30 @@
 block discarded – undo
51 51
         $xpath = new DOMXPath($dom);
52 52
         $titlePath = $xpath->query("//h1[contains(@class, 'subheader__subtitle')]");
53 53
 
54
-        if (! $titlePath || $titlePath->length == 0) {
54
+        if (!$titlePath || $titlePath->length == 0) {
55 55
             return $cfp;
56 56
         }
57 57
 
58 58
         $locationTimeString = trim($titlePath->item(0)->textContent);
59 59
         $locationTime = explode(' - ', $locationTimeString);
60 60
 
61
-        if (! isset($locationTime[1])) {
61
+        if (!isset($locationTime[1])) {
62 62
             return $cfp;
63 63
         }
64 64
 
65 65
         $dates = explode(',', $locationTime[1]);
66
-        if (count($dates) % 2  !== 0) {
66
+        if (count($dates) % 2 !== 0) {
67 67
         var_Dump($dates);
68 68
             return $cfp;
69 69
         }
70 70
 
71
-        $datestring = $dates[0] . ', ' . $dates[1];
71
+        $datestring = $dates[0].', '.$dates[1];
72 72
 
73 73
         if (count($dates) >= 4) {
74
-            $datestring = $dates[2] . ', ' . $dates[3];
74
+            $datestring = $dates[2].', '.$dates[3];
75 75
         }
76 76
 
77
-        $endDate = new DateTimeImmutable($datestring . ' 00:00:00', $this->timezone );
77
+        $endDate = new DateTimeImmutable($datestring.' 00:00:00', $this->timezone);
78 78
         $cfp->eventEndDate = $endDate;
79 79
 
80 80
         return $cfp;
Please login to merge, or discard this patch.
src/Parser/PapercallIo/Location.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Parser/PapercallIo/Tags.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
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
             throw new \InvalidArgumentException('The CfP does not seem to have tags');
48 48
         }
49 49
 
Please login to merge, or discard this patch.
src/Parser/PapercallIo/EventName.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Parser/PapercallIo/EventStartDate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
         $xpath = new DOMXPath($dom);
52 52
         $titlePath = $xpath->query("//h1[contains(@class, 'subheader__subtitle')]");
53 53
 
54
-        if (! $titlePath || $titlePath->length == 0) {
54
+        if (!$titlePath || $titlePath->length == 0) {
55 55
             return $cfp;
56 56
         }
57 57
 
58 58
         $location = trim($titlePath->item(0)->textContent);
59 59
         $location = explode(' - ', $location);
60 60
 
61
-        if (! isset($location[1])) {
61
+        if (!isset($location[1])) {
62 62
             return $cfp;
63 63
         }
64 64
 
65 65
         $dates = explode(',', $location[1]);
66
-        if (count($dates) % 2  !== 0) {
66
+        if (count($dates) % 2 !== 0) {
67 67
             return $cfp;
68 68
         }
69 69
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             return $cfp;
72 72
         }
73 73
 
74
-        $startDate = new DateTimeImmutable($dates[0] . ', ' . $dates[1] . ' 00:00:00', $this->timezone );
74
+        $startDate = new DateTimeImmutable($dates[0].', '.$dates[1].' 00:00:00', $this->timezone);
75 75
         $cfp->eventStartDate = $startDate;
76 76
 
77 77
         return $cfp;
Please login to merge, or discard this patch.