-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCarClass.php
More file actions
35 lines (21 loc) · 913 Bytes
/
CarClass.php
File metadata and controls
35 lines (21 loc) · 913 Bytes
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
<?php
class CarClass extends AbstractVehicle {
private $safetyBeltStatus = false;
public function setSafetyBeltStatus(bool $status) {
if ($this -> safetyBeltStatus == true)
throw new Exception('Emniyet kemeri zaten takılı gözüküyor. Takılı değilse kemer mekanizmasını kontrol edin');
$this -> safetyBeltStatus = true;
}
public function getSafetyBeltStatus() {
return $this -> safetyBeltStatus;
}
public function run(int $distance) {
$this -> start();
$this -> testVehicleRequirements2Run($distance);
if ($this -> getSafetyBeltStatus() == false)
throw new Exception('Yola çıkmaya hazırım ancak, lütfen önce emniyet kemerinizi bağlayın!');
echo 'Yola çıkıldı.<br>';
/// bu aşamada yolda bir takım kontroller yapılabilir, olası sorunlar (yağ sıcaklığı, arıza durumu vb.) kontrol edilebilir.
echo 'Varış noktasına ulaşıldı.<br>';
}
}