Skip to content

Commit

Permalink
rent system fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed May 24, 2024
1 parent 8ff894a commit 1938f90
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Rent/AbstractRentSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractRentSystem implements RentSystemInterface
*/
protected $creditSystem;
/**
* @var User
* @var User
*/
protected $user;
/**
Expand Down Expand Up @@ -296,7 +296,7 @@ private function changecreditendrental($bike, $userid)

//ak vrati a znova pozica bike do 10 min tak free time nebude mať.
$oldRetrun = $this->db->query("SELECT time FROM history WHERE bikeNum=$bike AND userId=$userid AND (action='RETURN' OR action='FORCERETURN') ORDER BY time DESC LIMIT 1");
if ($oldRetrun->rowCount()==1) {
if ($oldRetrun->rowCount() == 1) {
$oldRow = $oldRetrun->fetchAssoc();
$returntime = strtotime($oldRow["time"]);
if (($starttime - $returntime) < 10 * 60 && $timediff > 5 * 60) {
Expand Down Expand Up @@ -355,4 +355,4 @@ private function logResult($number, $message)
{
logresult($number, $message);
}
}
}
2 changes: 1 addition & 1 deletion src/Rent/RentSystemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public static function create($type)
throw new \InvalidArgumentException('Invalid rent system type');
}
}
}
}
2 changes: 1 addition & 1 deletion src/Rent/RentSystemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ interface RentSystemInterface
public function rentBike($userId, $bikeId, $force = false);

public function returnBike($userId, $bikeId, $standName, $note = '', $force = false);
}
}
8 changes: 5 additions & 3 deletions src/Rent/RentSystemQR.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public function returnBike($userId, $bikeId, $standName, $note = '', $force = fa
$bikeNumber = $result->rowCount();

if ($bikeNumber > 1) {
$message = _('You have') . ' ' . $bikeNumber . ' ' . _('rented bikes currently. QR code return can be used only when 1 bike is rented. Please, use web');
$message = _('You have') . ' ' . $bikeNumber . ' '
. _('rented bikes currently. QR code return can be used only when 1 bike is rented. Please, use web');
if ($this->connectorsConfig["sms"]) {
$message .= _(' or SMS');
}
Expand All @@ -37,7 +38,8 @@ public function returnBike($userId, $bikeId, $standName, $note = '', $force = fa
return parent::returnBike($userId, $bikeId, $standName, $note, $force);
}

protected function getRentSystemType() {
protected function getRentSystemType()
{
return 'qr';
}
}
}
5 changes: 3 additions & 2 deletions src/Rent/RentSystemSms.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ public function returnBike($number, $bikeId, $standName, $note = '', $force = fa
return parent::returnBike($userId, $bikeId, $standName, $note, $force);
}

protected function getRentSystemType() {
protected function getRentSystemType()
{
return 'sms';
}

protected function response($message, $error = 0)
{
$this->smsSender->send($this->number, strip_tags($message));
}
}
}
5 changes: 3 additions & 2 deletions src/Rent/RentSystemWeb.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

class RentSystemWeb extends AbstractRentSystem implements RentSystemInterface
{
protected function getRentSystemType() {
protected function getRentSystemType()
{
return 'web';
}

Expand All @@ -17,4 +18,4 @@ protected function response($message, $error = 0)
echo $json;
exit;
}
}
}

0 comments on commit 1938f90

Please sign in to comment.