• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

joindin / callingallpapers-cli / 19017699028

02 Nov 2025 08:25PM UTC coverage: 26.857% (-12.5%) from 39.394%
19017699028

push

github

heiglandreas
Move to coveralls action

405 of 1508 relevant lines covered (26.86%)

0.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Parser/PapercallIo/PapercallIoParser.php
1
<?php
2

3
/**
4
 * Copyright (c) Andreas Heigl<andreas@heigl.org>
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
 * THE SOFTWARE.
23
 *
24
 * @author    Andreas Heigl<andreas@heigl.org>
25
 * @copyright Andreas Heigl
26
 * @license   http://www.opensource.org/licenses/mit-license.php MIT-License
27
 * @since     29.07.2016
28
 * @link      http://github.com/heiglandreas/callingallpapers
29
 */
30

31
namespace Callingallpapers\Parser\PapercallIo;
32

33
use Callingallpapers\Parser\ParserInterface;
34
use Callingallpapers\Writer\WriterInterface;
35
use IvoPetkov\HTML5DOMDocument as DOMDocument;
36
use DOMXPath;
37

38
class PapercallIoParser implements ParserInterface
39
{
40
    const SOURCE = 'papercallio';
41

42
    private $uri = 'https://www.papercall.io/events?open-cfps=true&page=%1$s';
43

44
    private $parser;
45

46
    public function __construct(EventParser $parser)
×
47
    {
48
        $this->parser = $parser;
×
49
    }
50

51
    public function setStartUrl(string $uri)
×
52
    {
53
        $this->uri = $uri;
×
54
    }
55

56
    public function parse(WriterInterface $writer)
×
57
    {
58
        $i = 0;
×
59

60
        $pages = null;
×
61

62
        do {
63
            $dom = new DOMDocument('1.0', 'UTF-8');
×
64
            libxml_use_internal_errors(true);
×
65
            $uri = sprintf($this->uri, $i+1);
×
66
            $dom->loadHTMLFile($uri);
×
67
            libxml_use_internal_errors(false);
×
68
            $dom->preserveWhiteSpace = false;
×
69
            $xpath = new DOMXPath($dom);
×
70

71
            if (null === $pages) {
×
72
                $p = $xpath->query("//ul[contains(@class,'pagination')]/li");
×
73
                $pages = $p->length - 2;
×
74
            }
75

76
            $nodes = $xpath->query("//div[contains(@class,'main')]/div[@class='container'][last()]//div[contains(@class,'event-list-detail')]");
×
77
            if ($nodes->length < 1) {
×
78
                continue;
×
79
            }
80

81
            /** @var DOMNode $node */
82
            foreach ($nodes as $node) {
×
83
                try {
84
                    $writer->write($this->parser->parseEvent($node), self::SOURCE);
×
85
                } catch (\Exception $e) {
×
86
                    // Do nothing
87
                }
88
            }
89
        } while (++$i < $pages);
×
90

91
        return true;
×
92
    }
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc