Completed
Pull Request — master (#28)
by Andreas
01:52
created
src/Command/ParseEvents.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
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.