Completed
Pull Request — master (#37)
by Andreas
01:31
created
src/Subcommands/Sessionize/Parser/ClosingDate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $closingDateHolder = $xpath->query('//div[./div/span[contains(text(), "CfS closes at")]]');
32 32
 
33
-        if (! $closingDateHolder || $closingDateHolder->length == 0) {
33
+        if (!$closingDateHolder || $closingDateHolder->length == 0) {
34 34
             throw new InvalidArgumentException('The CfP does not seem to have a closing date');
35 35
         }
36 36
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $closingHour = $this->clearClosingHour($closingHour);
41 41
 
42
-        return new DateTimeImmutable($closingDay . ' ' . $closingHour, $this->timezone);
42
+        return new DateTimeImmutable($closingDay.' '.$closingHour, $this->timezone);
43 43
     }
44 44
 
45 45
     private function clearClosingHour(string $closingHour) : string
Please login to merge, or discard this patch.
src/Subcommands/Sessionize/Parser/EventUri.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
         //$uriPath = $xpath->query('//div[contains(text()[2], "website")]/following-sibling::h2/a');
22 22
         $uriPath = $xpath->query('//div[contains(., "website")]');
23 23
 
24
-        if (! $uriPath || $uriPath->length == 0) {
24
+        if (!$uriPath || $uriPath->length == 0) {
25 25
             throw new \InvalidArgumentException('The CfP does not seem to have an EventUri');
26 26
         }
27 27
 
28 28
         $uriPath = $xpath->query('//h2/a', $uriPath->item(0)->parentNode);
29 29
 
30
-        if (! $uriPath || $uriPath->length == 0) {
30
+        if (!$uriPath || $uriPath->length == 0) {
31 31
             throw new \InvalidArgumentException('The Event does not seem to have a location');
32 32
         }
33 33
 
Please login to merge, or discard this patch.
src/Subcommands/Sessionize/Parser/Location.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
         // This expression does not work. It looks like the reason is the array-notation...
20 20
         //$locations = $xpath->query('//div[contains(text()[2], "location")]/following-sibling::h2/span');
21 21
         $locationMarker = $xpath->query("//div[contains(., 'location')]");
22
-        if (! $locationMarker || $locationMarker->length == 0) {
22
+        if (!$locationMarker || $locationMarker->length == 0) {
23 23
             throw new \InvalidArgumentException('The Event does not seem to have a locationMarker');
24 24
         }
25 25
 
26 26
         $locations = $xpath->query('//h2/span', $locationMarker->item(0)->parentNode);
27 27
 
28
-        if (! $locations || $locations->length == 0) {
28
+        if (!$locations || $locations->length == 0) {
29 29
             throw new \InvalidArgumentException('The Event does not seem to have a location');
30 30
         }
31 31
         $location = [];
Please login to merge, or discard this patch.
src/Subcommands/Sessionize/Command.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 /**
6 6
  * Copyright (c) 2015-2016 Andreas Heigl<[email protected]>
Please login to merge, or discard this patch.
src/Subcommands/Sessionize/Parser/Description.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<?php

declare(strict_types=1);
/**
 * Copyright Andrea Heigl <[email protected]>
 *
 * Licenses under the MIT-license. For details see the included file LICENSE.md
 */

namespace Callingallpapers\Subcommands\Sessionize\Parser;

use DOMDocument;
use DOMXPath;
use function preg_replace;
use function strip_tags;
use function strpos;
use function var_dump;

class Description
{
    public function parse(DOMDocument $dom, DOMXPath $xpath)
    {
        $result = $xpath->query('//hr[contains(@class, "m-t-none")]');
        if ($result->length < 1) {
            return '';
        }

        $text = [];
        for ($i = 0; $i < $result->length; $i++) {
            $resultI = $result->item($i)->parentNode->childNodes;

            if ($resultI->length <= 0) {
                continue;
            }

            foreach ($resultI as $node) {
                $nodeText = trim($dom->saveXML($node));

                if (0 !== strpos($nodeText,'<hr class="m-t-none">')) {
                    continue;
                }

                $text[] = str_replace('<hr class="m-t-none">', '', $nodeText);
            }
        }
        $description = trim(implode('', $text));
        $description = preg_replace(['/\<\!\-\-.*?\-\-\>/si', '/\<script.*?\<\/script\>/si'], '', $description);

        return $description;
    }
}
2 1
\ No newline at end of file
2
+<?php

declare(strict_types=1); /**
 * Copyright Andrea Heigl <[email protected]>
 *
 * Licenses under the MIT-license. For details see the included file LICENSE.md
 */

namespace Callingallpapers\Subcommands\Sessionize\Parser; use DOMDocument; use DOMXPath; use function preg_replace; use function strip_tags; use function strpos; use function var_dump; class Description {
    public function parse(DOMDocument $dom, DOMXPath $xpath) {
        $result = $xpath->query('//hr[contains(@class, "m-t-none")]'); if ($result->length < 1) {
            return ''; }

        $text = []; for ($i = 0; $i < $result->length; $i++) {
            $resultI = $result->item($i)->parentNode->childNodes; if ($resultI->length <= 0) {
                continue; }

            foreach ($resultI as $node) {
                $nodeText = trim($dom->saveXML($node)); if (0 !== strpos($nodeText, '<hr class="m-t-none">')) {
                    continue; }

                $text[] = str_replace('<hr class="m-t-none">', '', $nodeText); }
        }
        $description = trim(implode('', $text)); $description = preg_replace(['/\<\!\-\-.*?\-\-\>/si', '/\<script.*?\<\/script\>/si'], '', $description); return $description; }
}
3 3
\ No newline at end of file
Please login to merge, or discard this patch.