Skip to content

Commit

Permalink
fix(requesttypefield): warning if comparing against empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Oct 7, 2022
1 parent fa6a360 commit dca5afb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions inc/field/requesttypefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,33 @@ public function isValidValue($value): bool {

public function equals($value): bool {
$available = $this->getAvailableValues();
if (!isset($available[$this->value])) {
return false;
}
return strcasecmp($available[$this->value], $value) === 0;
}

public function notEquals($value): bool {
$available = $this->getAvailableValues();
if (!isset($available[$this->value])) {
return false;
}
return !$this->equals($value);
}

public function greaterThan($value): bool {
$available = $this->getAvailableValues();
if (!isset($available[$this->value])) {
return false;
}
return strcasecmp($available[$this->value], $value) > 0;
}

public function lessThan($value): bool {
$available = $this->getAvailableValues();
if (!isset($available[$this->value])) {
return false;
}
return !$this->greaterThan($value) && !$this->equals($value);
}

Expand Down

0 comments on commit dca5afb

Please sign in to comment.