Code smell.

This commit is contained in:
Ivor Barhansky
2022-12-17 01:20:43 +02:00
parent b1f578f4b0
commit 0398425205
45 changed files with 875 additions and 851 deletions
+6 -6
View File
@@ -39,9 +39,9 @@ class Hostel
Db::getInstance()->execute('insert into hostel (uid, type, time) values (?,?,?)', [$this->uid, $type, time() + 60 * 60 * 24 * 7]);
}
private function addRentTime($hostel_id, $time)
private function addRentTime($hostelId, $time)
{
Db::getInstance()->execute('update hostel set time = ? where id = ? and uid = ?', [$time, $hostel_id, $this->uid]);
Db::getInstance()->execute('update hostel set time = ? where id = ? and uid = ?', [$time, $hostelId, $this->uid]);
}
private function removeItems()
@@ -123,7 +123,7 @@ class Hostel
$this->newRent($type);
}
public function changeTime(int $ordered_time): bool
public function changeTime(int $orderedTime): bool
{
$daysByOrder = [
1 => 7,
@@ -132,12 +132,12 @@ class Hostel
4 => 28,
];
if (
!$this->typeIsAllowed($ordered_time) ||
!$this->pay(self::PRICEPERTYPE[$this->type][$ordered_time - 1])
!$this->typeIsAllowed($orderedTime) ||
!$this->pay(self::PRICEPERTYPE[$this->type][$orderedTime - 1])
) {
return false;
}
$this->time += 60 * 60 * 24 * $daysByOrder[$ordered_time];
$this->time += 60 * 60 * 24 * $daysByOrder[$orderedTime];
$this->addRentTime($this->hid, $this->time);
$this->setSuccess('Всё прошло успешно!');
return true;