Nearest traficar inforations.

This commit is contained in:
kplaczek
2018-07-04 20:57:28 +02:00
parent db3f7772a6
commit b4aa26ee17
4 changed files with 114 additions and 11 deletions

View File

@@ -73,6 +73,27 @@ class HtmlToPos
return $posText;
}
public function traficar($posText)
{
$data = $posText;
if (strstr($posText, '[traficar]')) {
$data = [];
$traficar = new Traficar();
$nearest = $traficar->nearestCar();
$data['text'] = "Najbliższy traficar:\n" .
'Model: ' . $nearest['car']['model'] . "\n" .
'Numer boczny: ' . $nearest['car']['orderNumber'] . "\n" .
'Rejestracja: ' . $nearest['car']['regNumber'] . "\n" .
'Lokalizacja: ' . $nearest['car']['location'] . "\n" .
'Odległość: ' . $nearest['distance'] . "km\n";
// $data['image'] = $nearest['imageName'];
// $data['image'] = 'https://staticmapmaker.com/img/cartodb_placeholder.png';
}
return $data;
}
public function convert($html = '')
{
$posText = $this->handleNewLine($html);
@@ -80,7 +101,10 @@ class HtmlToPos
$posText = $this->pickRandomElement($posText);
$posText = $this->randomNumber($posText);
$posText = $this->vocabularyWord($posText);
$posText = $this->traficar($posText);
// print_r($posText);
// die();
return $posText;
}
}