-
Notifications
You must be signed in to change notification settings - Fork 3
/
makeBooks.php
52 lines (43 loc) · 1.37 KB
/
makeBooks.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once "src/utils.php";
class Books {
private $earliest = 9999999999;
private $latest = 0;
private $seriesLiquid = [];
private $seriesLiquidCredit = [];
private $seriesLiquidCreditAssets = [];
private $step = 5;
private function moveIntoView($timestamp) {
if ($this->earliest > $timestamp) {
$this->earliest = $timestamp;
}
if ($this->latest < $timestamp) {
$this->latest = $timestamp;
}
}
public function getSourceDoc() {
$this->seriesLiquid = [1,2,3];
$this->seriesLiquidCredit = [4,5,6];
$this->seriesLiquidCreditAssets = [7,8,9];
// var_dump($_SERVER['argv']);
$fileName = $_SERVER['argv'][1];
$pj2JSON = file_get_contents($fileName);
$entries = json_decode($pj2JSON, true);
$this->moveIntoView(dateTimeToTimestamp($entries[0]["from"]));
$this->moveIntoView(dateTimeToTimestamp($entries[0]["to"]));
}
public function printBooks() {
echo 'Books = ' . json_encode([
"seriesLiquid" => $this->seriesLiquid,
"seriesLiquidCredit" => $this->seriesLiquidCredit,
"seriesLiquidCreditAssets" => $this->seriesLiquidCreditAssets,
"step" => $this->step,
"startDate" => timestampToDateTime($this->earliest),
"endDate" => timestampToDateTime($this->latest),
]) . "\n";
}
}
// ...
$data = new Books();
$data->getSourceDoc();
$data->printBooks();