Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Jan 14, 2025
1 parent 1a489d6 commit c0d027e
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions lam/lib/schema.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace LAM\SCHEMA;
/*
Copyright (C) 2004 David Smith
modified to fit for LDAP Account Manager 2005 - 2024 Roland Gruber
modified to fit for LDAP Account Manager 2005 - 2025 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -612,7 +612,7 @@ class AttributeType extends SchemaItem {
$i++;
do {
$i++;
if (strlen($this->name) == 0) {
if (empty($this->name)) {
$this->name = $strings[$i];
}
else {
Expand All @@ -632,7 +632,7 @@ class AttributeType extends SchemaItem {
case 'DESC':
do {
$i++;
if (strlen($this->description) == 0) {
if (empty($this->description)) {
$this->description .= $strings[$i];
}
else {
Expand Down Expand Up @@ -702,10 +702,14 @@ class AttributeType extends SchemaItem {
$this->description = preg_replace("/^\'/", "", $this->description);
$this->description = preg_replace("/\'$/", "", $this->description);
}
$this->syntax = preg_replace("/^\'/", "", $this->syntax);
$this->syntax = preg_replace("/\'$/", "", $this->syntax);
$this->syntax_oid = preg_replace("/^\'/", "", $this->syntax_oid);
$this->syntax_oid = preg_replace("/\'$/", "", $this->syntax_oid);
if (!empty($this->syntax)) {
$this->syntax = preg_replace("/^\'/", "", $this->syntax);
$this->syntax = preg_replace("/\'$/", "", $this->syntax);
}
if (!empty($this->syntax_oid)) {
$this->syntax_oid = preg_replace("/^\'/", "", $this->syntax_oid);
$this->syntax_oid = preg_replace("/\'$/", "", $this->syntax_oid);
}
if ($this->sup_attribute !== null) {
$this->sup_attribute = preg_replace("/^\'/", "", $this->sup_attribute);
$this->sup_attribute = preg_replace("/\'$/", "", $this->sup_attribute);
Expand Down Expand Up @@ -1016,7 +1020,7 @@ class Syntax extends SchemaItem {
case 'DESC':
do {
$i++;
if (strlen($this->description) == 0) {
if (empty($this->description)) {
$this->description .= $strings[$i];
}
else {
Expand Down Expand Up @@ -1076,7 +1080,7 @@ class MatchingRule extends SchemaItem {
if ($strings[$i + 1] !== "(") {
do {
$i++;
if (strlen($this->name) == 0) {
if (empty($this->name)) {
$this->name = $strings[$i];
}
else {
Expand Down Expand Up @@ -1129,8 +1133,10 @@ class MatchingRule extends SchemaItem {
}
}
}
$this->description = preg_replace("/^\'/", "", $this->description);
$this->description = preg_replace("/\'$/", "", $this->description);
if (!empty($this->description)) {
$this->description = preg_replace("/^\'/", "", $this->description);
$this->description = preg_replace("/\'$/", "", $this->description);
}
}

/**
Expand Down

0 comments on commit c0d027e

Please sign in to comment.