-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.php
34 lines (26 loc) · 1.05 KB
/
app.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require 'vendor/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpClient;
$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/.env');
$httpClient = new HttpClient\NativeHttpClient();
$slackTransport = new Xylis\JCDecaux\Transport\SlackTransport($httpClient);
$slackTransport->setWebhookUrl($_ENV['SLACK_WEBHOOK']);
$slackTransport->configure([]);
$discordTransport = new Xylis\JCDecaux\Transport\DiscordTransport($httpClient);
$discordTransport->setWebhookUrl($_ENV['DISCORD_WEBHOOK']);
$discordTransport->configure([
'username' => 'Combienkicon les vélov ?'
]);
$application = new Application();
$application->add(
(new Xylis\JCDecaux\Command\NotifyAvailabilityCommand(
$httpClient, $_ENV['JCDECAUX_API'])
)->addTransport($slackTransport, 'slack')
->addTransport($discordTransport, 'discord')
->setDefaultTransport($_ENV['DEFAULT_TRANSPORT'])
);
$application->add(new Xylis\JCDecaux\Command\ListStations($httpClient, $_ENV['JCDECAUX_API']));
$application->run();