1 |
a257bb07
|
horkym
|
<?php
|
2 |
|
|
|
3 |
|
|
class Traffic {
|
4 |
|
|
|
5 |
|
|
// Pouzivane atributy.
|
6 |
|
|
public $device;
|
7 |
|
|
public $direction;
|
8 |
|
|
public $dateTime;
|
9 |
|
|
public $speed;
|
10 |
|
|
public $type10;
|
11 |
|
|
|
12 |
|
|
// TODO pouziti.
|
13 |
|
|
public $state;
|
14 |
|
|
|
15 |
|
|
// Nepouzivane.
|
16 |
|
|
// public $intensity;
|
17 |
|
|
// public $intensityN;
|
18 |
|
|
// public $occupancy;
|
19 |
|
|
// public $type;
|
20 |
|
|
// public $duration;
|
21 |
|
|
// public $history;
|
22 |
|
|
|
23 |
|
|
public function __construct($data) {
|
24 |
|
|
$this->device = substr($data[0], 2, 3);
|
25 |
|
|
$this->direction = substr($data[0], 7) - 1; // Misto hodnot 1, 2 - hodnoty 0, 1 (kvuli poli).
|
26 |
|
|
$this->dateTime = new DateTime($data[1]);
|
27 |
|
|
// $this->intensity = $data[2];
|
28 |
|
|
// $this->intensityN = $data[3];
|
29 |
|
|
// $this->occupancy = $data[4];
|
30 |
41dd5f26
|
horkym
|
$this->speed = (double) $data[5];
|
31 |
|
|
$this->state = (int) $data[6];
|
32 |
a257bb07
|
horkym
|
// $this->type = $data[7];
|
33 |
|
|
// $this->duration = $data[8];
|
34 |
|
|
// $this->history = $data[9];
|
35 |
41dd5f26
|
horkym
|
$this->type10 = (int) $data[10];
|
36 |
a257bb07
|
horkym
|
}
|
37 |
|
|
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
?>
|