-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.php
More file actions
81 lines (75 loc) · 1.84 KB
/
execute.php
File metadata and controls
81 lines (75 loc) · 1.84 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
require_once __DIR__ . '/vendor/autoload.php';
use LuisMateos92\Loteria\Config;
use LuisMateos92\Loteria\Execute;
use LuisMateos92\Loteria\DownloadDatas\DownloadDatas;
use LuisMateos92\Loteria\InsertDatasToDatabase\InsertDatasToDatabase;
use LuisMateos92\Loteria\StatsEuromillon\StatsEuromillon;
use LuisMateos92\Loteria\StatsPrimitiva\StatsPrimitiva;
// use League\Flysystem\Filesystem;
// use League\Flysystem\Adapter\Local;
use GuzzleHttp\Client;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
// use Carbon\Carbon;
$logger = new Logger('test');
$logger->pushHandler(
new StreamHandler(__DIR__ . '/log/loterias.log', Logger::DEBUG)
);
$config = new Config();
$guzzle = new Client();
// $carbon = new Carbon();
// $filesystem = new Filesystem(new Local(__DIR__ . '/output/');
$execute = new Execute(
$logger,
new DownloadDatas(
$logger,
$config,
$guzzle
),
new InsertDatasToDatabase(
$logger,
$config
),
new StatsEuromillon(
$logger,
$config
),
new StatsPrimitiva(
$logger,
$config
)
);
$option = -1;
echo "======[GENERATE LOTERIAS DATAS]======\n";
echo "0.- Download and Insert Euromillones\n";
echo "1.- Download and Insert Primitiva\n";
echo "2.- Download and Insert All\n";
echo "3.- Generate Stats to Euromillones\n";
echo "4.- Generate Stats to Primitiva\n";
echo "5.- Generate All Stats\n";
while ($option < 0 || $option > 5) {
$option = readline('Select an option: ');
switch ($option) {
case 0:
$execute->execute('euromillones');
break;
case 1:
$execute->execute('primitiva');
break;
case 2:
$execute->execute('euromillones');
$execute->execute('primitiva');
break;
case 3:
$execute->generateStats('euromillones');
break;
case 4:
$execute->generateStats('primitiva');
break;
case 5:
$execute->generateStats('euromillones');
$execute->generateStats('primitiva');
break;
}
}