Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Dec 18, 2023
1 parent 3549113 commit 91d0d2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lam/lib/baseModule.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2243,11 +2243,11 @@ abstract class baseModule {
/**
* Returns the {@link accountContainer} object.
*
* @return accountContainer accountContainer object
* @return ?accountContainer accountContainer object
*
* @see accountContainer
*/
protected function getAccountContainer() {
protected function getAccountContainer(): ?accountContainer {
if (isset($this->base) && isset($_SESSION[$this->base])) {
return $_SESSION[$this->base];
}
Expand Down
14 changes: 7 additions & 7 deletions lam/lib/modules/fixed_ip.inc
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ class fixed_ip extends baseModule {
/**
*
* Check, if a mac address is invalid
* @param mac address
* @param string mac address
*
* @return true, if mac is invalid
* @return bool true, if mac is invalid
**/
public function check_mac($mac) {
public function check_mac($mac): bool {
$ex = explode(":", $mac);
$invalid = false;
if (count($ex)!=6) {
if (count($ex) != 6) {
$invalid = true;
}

foreach($ex AS $value) {
if (!preg_match("/[0-9a-fA-F][0-9a-fA-F]/", $value) || strlen($value)!="2") {
if (!preg_match("/[0-9a-fA-F][0-9a-fA-F]/", $value) || strlen($value) != "2") {
$invalid = true;
}
}
Expand Down Expand Up @@ -308,9 +308,9 @@ class fixed_ip extends baseModule {
}

// MAC address
$_POST['mac_'.$id] = strtolower(trim($_POST['mac_'.$id]));
$_POST['mac_' . $id] = strtolower(trim($_POST['mac_' . $id]));

$invalid = $this->check_mac($_POST['mac_'.$id]);
$invalid = $this->check_mac($_POST['mac_' . $id]);
if ($invalid) {
$error = true;
}
Expand Down

0 comments on commit 91d0d2e

Please sign in to comment.