-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.php
37 lines (30 loc) · 1.23 KB
/
sample.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
35
36
37
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use FFC\Calculator\Calculator;
use FFC\Calculator\Configuration\Configuration;
use FFC\Calculator\Configuration\Rule\RuleFactory;
use FFC\Formation\Formation;
use FFQP\Parser\QuotationsParserFactory;
require_once __DIR__ . '/Footballer.php';
// Parse quotations
$quotationParser = QuotationsParserFactory::create(QuotationsParserFactory::FORMAT_GAZZETTA_SINCE_2017);
$quotations = $quotationParser->getQuotations(__DIR__ . '/files/quotazioni_gazzetta_30.xls');
// Configure calculator
$configuration = new Configuration();
$configuration
->addRule(RuleFactory::create(RuleFactory::BEST_DEFENDERS_RULE))
;
$calculator = new Calculator($quotations, $configuration);
// Prepare formation
$formation = new Formation();
$firstStrings = [102, 298, 416, 349, 377, 534, 580, 676, 732, 805, 900];
foreach ($firstStrings as $firstString) {
$formation->addFirstString(new Footballer($firstString));
}
$reserves = [118, 354, 241, 632, 626, 922, 827];
foreach ($reserves as $reserve) {
$formation->addReserve(new Footballer($reserve));
}
// Show single result...
$singleResult = $calculator->getSingleResult($formation);
echo $singleResult->getMagicPoints() . ' ' . $singleResult->getBonus() . PHP_EOL;