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

32
use Callingallpapers\CfpFilter\FilterList;
33
use Callingallpapers\CfpFilter\FollowUriRedirect;
34
use Callingallpapers\CfpFilter\StripParamsFromUri;
35
use Callingallpapers\Exception\UnverifiedUriException;
36
use Callingallpapers\Parser\ConfsTech\ConferenceParser;
37
use Callingallpapers\Parser\ConfsTechParser;
38
use Callingallpapers\Parser\JoindinCfpParser;
39
use Callingallpapers\Parser\Lanyrd\LanyrdCfpParser;
40
use Callingallpapers\Parser\PapercallIo\PapercallIoParserFactory;
41
use Callingallpapers\Service\ConfsTechParserFactory;
42
use Callingallpapers\Service\GeolocationService;
43
use Callingallpapers\Service\TimezoneService;
44
use Callingallpapers\Writer\ApiCfpWriter;
45
use GuzzleHttp\Client;
46
use Symfony\Component\Console\Command\Command;
47
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
48
use Symfony\Component\Console\Input\InputInterface;
49
use Symfony\Component\Console\Input\InputOption;
50
use Symfony\Component\Console\Output\OutputInterface;
51

52
class ParseEvents extends Command
53
{
54
    protected function configure()
×
55
    {
56
        $this->setName("parseCfPs")
×
57
             ->setDescription("Retrieve CfPs and parse them")
×
58
             ->setDefinition(array(
×
59
                 new InputOption('start', 's', InputOption::VALUE_OPTIONAL, 'What should be the first date to be taken into account?', ''),
×
60
             ))
×
61
             ->setHelp(<<<EOT
×
62
Get details about CfPs from different sources
63

64
Usage:
65

66
<info>callingallpapers parseCfPs 2015-02-23<env></info>
67

68
If you ommit the date the current date will be used instead
69
<info>callingallpapers parseCfPs<env></info>
70
EOT
×
71
             );
×
72
    }
73

74
    protected function execute(InputInterface $input, OutputInterface $output): int
×
75
    {
76
        $header_style = new OutputFormatterStyle('white', 'green', array('bold'));
×
77
        $output->getFormatter()->setStyle('header', $header_style);
×
78

79
        $start = new \DateTime($input->getOption('start'));
×
80

81
        if (! $start instanceof \DateTime) {
×
82
            throw new \InvalidArgumentException('The given date could not be parsed');
×
83
        }
84

85
        $client = new Client([
×
86
            'headers' => [
×
87
                'Accept' => 'application/json',
×
88
            ],
×
89
        ]);
×
90

91
        $config = parse_ini_file(__DIR__ . '/../../config/callingallpapers.ini');
×
92
        $writer = new ApiCfpWriter($config['event_api_url'], $config['event_api_token'], $client);
×
93
        $writer->setOutput($output);
×
94

95
        // Set CfP-Filters
96
        $filter = new FilterList();
×
97
        $filter->add(new FollowUriRedirect(['conferenceUri'], $client));
×
98
        $filter->add(new StripParamsFromUri(['conferenceUri']));
×
99
        $writer->setFilter($filter);
×
100

101
        $timezoneService = new TimezoneService($client, $config['timezonedb_token']);
×
102

103
        $geolocationService = new GeolocationService($client);
×
104

105
        // Parse Papercall.io
106
        $parser = (new PapercallIoParserFactory($timezoneService, $geolocationService))();
×
107
        $parser->parse($writer);
×
108

109
        // Parse Lanyrd.com
110
        $parser = new LanyrdCfpParser($timezoneService);
×
111
        $parser->parse($writer);
×
112

113
        // Parse Confs.tech
114
        //$conferenceParser = new ConferenceParser($geolocationService, $timezoneService);
115
        //$factory = new ConfsTechParserFactory($conferenceParser, $client, $writer);
116
        //$parser = new ConfsTechParser($factory);
117
        //$parser->parse($writer);
118

119
        // Parse joind.in
120
        $parser = new JoindinCfpParser();
×
121
        $parser->parse($writer);
×
122

123
        return Command::SUCCESS;
×
124
    }
125
}
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

© 2025 Coveralls, Inc