• 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/NotifyClosingCfps.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\Notification\MastodonNotifier;
33
use Callingallpapers\Notification\NotificationList;
34
use Callingallpapers\Notification\TwitterNotifier;
35
use Callingallpapers\Reader\ApiCfpReader;
36
use Callingallpapers\Service\MastodonNotifierClientFactory;
37
use Callingallpapers\Service\TwitterNotifierClientFactory;
38
use GuzzleHttp\Client;
39
use Symfony\Component\Console\Command\Command;
40
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
41
use Symfony\Component\Console\Input\InputInterface;
42
use Symfony\Component\Console\Input\InputOption;
43
use Symfony\Component\Console\Output\OutputInterface;
44

45
class NotifyClosingCfps extends Command
46
{
47
    protected function configure()
×
48
    {
49
        $this->setName("notifyClosingCfps")
×
50
             ->setDescription("Notify about CfPs that close within 24 hours")
×
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
Notify about CfPs that are closing within 24 hours
56

57
Usage:
58

59
<info>callingallpapers notifyClosingCfp</info>
60
EOT
×
61
             );
×
62
    }
63

64
    protected function execute(InputInterface $input, OutputInterface $output): int
×
65
    {
66
        $header_style = new OutputFormatterStyle('white', 'green', array('bold'));
×
67
        $output->getFormatter()->setStyle('header', $header_style);
×
68

69
        $start = new \DateTime($input->getOption('start'));
×
70

71
        if (! $start instanceof \DateTime) {
×
72
            throw new \InvalidArgumentException('The given date could not be parsed');
×
73
        }
74

75
        $config = parse_ini_file(__DIR__ . '/../../config/callingallpapers.ini');
×
76
        $reader = new ApiCfpReader($config['event_api_url'], $config['event_api_token']);
×
77
        $cfps = $reader->getCfpsEndingWithinInterval(
×
78
            new \DateInterval('PT1H'),
×
79
            (new \DateTimeImmutable())->add(new \DateInterval('PT23H'))
×
80
        );
×
81

82
        $notifications = new NotificationList();
×
83
        $notifications->add(new TwitterNotifier(
×
84
            TwitterNotifierClientFactory::getClient($config)
×
85
        ));
×
86
        $notifications->add(new MastodonNotifier(
×
87
            MastodonNotifierClientFactory::getClient($config)
×
88
        ));
×
89

90
        $notifications->notify($cfps);
×
91

92
        return Command::SUCCESS;
×
93
    }
94
}
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