You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.5 KiB
60 lines
1.5 KiB
<?php
|
|
|
|
namespace Model;
|
|
|
|
class Training
|
|
{
|
|
private static $lastId = 0;
|
|
private int $idTraining;
|
|
private \DateTime $date;
|
|
private float $latitude;
|
|
private float $longitude;
|
|
private ?String $description;
|
|
private ?String $feedback;
|
|
|
|
public function __construct(
|
|
\DateTime $date,
|
|
float $latitude,
|
|
float $longitude,
|
|
?String $description = null,
|
|
?String $feedback = null
|
|
) {
|
|
$this->idTraining = self::generateId();
|
|
$this->date = $date;
|
|
$this->latitude = $latitude;
|
|
$this->longitude = $longitude;
|
|
$this->description = $description;
|
|
$this->feedback = $feedback;
|
|
}
|
|
private static function generateId(): int
|
|
{
|
|
self::$lastId++;
|
|
return self::$lastId;
|
|
}
|
|
public function getId():int {
|
|
return $this->idTraining;
|
|
}
|
|
public function getDate():\DateTime {
|
|
return $this->date;
|
|
}
|
|
public function getLocation(): String {
|
|
return $this->longitude . ", " . $this->latitude;
|
|
}
|
|
public function getLatitude(): float {
|
|
return $this->latitude;
|
|
}
|
|
public function getLongitude(): float {
|
|
return $this->longitude;
|
|
}
|
|
public function getDescription(): String
|
|
{
|
|
return $this->description;
|
|
}
|
|
public function getFeedback(): String {
|
|
return $this->feedback;
|
|
}
|
|
|
|
public function __toString(): String {
|
|
return $this->idTraining . " - " . $this->description;
|
|
}
|
|
} |