refactoring

This commit is contained in:
Roland Gruber 2025-07-28 20:26:41 +02:00
parent a9b964078a
commit 26098b27ce
3 changed files with 24 additions and 23 deletions

View file

@ -103,7 +103,7 @@ abstract class baseModule {
/** /**
* Creates a new base module class * Creates a new base module class
* *
* @param string $scope the account type (user, group, host) * @param string|null $scope the account type (user, group, host)
*/ */
public function __construct($scope) { public function __construct($scope) {
$this->scope = $scope; $this->scope = $scope;
@ -848,7 +848,6 @@ abstract class baseModule {
* Runs any global cron actions. * Runs any global cron actions.
* *
* @param bool $isDryRun dry-run active * @param bool $isDryRun dry-run active
* @throws LAMException error during execution
*/ */
public function runGlobalCronActions(bool $isDryRun): void { public function runGlobalCronActions(bool $isDryRun): void {
// needs to be implemented by submodule if needed // needs to be implemented by submodule if needed
@ -937,8 +936,7 @@ abstract class baseModule {
* Adds an image to the PDF. * Adds an image to the PDF.
* *
* @param array $result result array (entry will be added here) * @param array $result result array (entry will be added here)
* @param String $attrName attribute name * @param string $attrName attribute name
* @param PDFTable $table table
*/ */
public function addPDFImage(&$result, $attrName) { public function addPDFImage(&$result, $attrName) {
if (isset($this->attributes[$attrName]) && (count($this->attributes[$attrName]) > 0)) { if (isset($this->attributes[$attrName]) && (count($this->attributes[$attrName]) > 0)) {
@ -1059,7 +1057,7 @@ abstract class baseModule {
* @param array $message error message array if not matching * @param array $message error message array if not matching
* @param int $position upload position * @param int $position upload position
* @param array $errors error messages * @param array $errors error messages
* @return value is ok * @return bool value is ok
* @see get_preg() * @see get_preg()
*/ */
private function checkUploadRegex($regexIDs, $value, $message, $position, &$errors) { private function checkUploadRegex($regexIDs, $value, $message, $position, &$errors) {
@ -1100,7 +1098,7 @@ abstract class baseModule {
* array('Headline' => 'This is the head line', 'Text' => 'Help content', 'SeeAlso' => array('text' => 'LAM homepage', 'link' => 'http://www.ldap-account-manager.org/')) * array('Headline' => 'This is the head line', 'Text' => 'Help content', 'SeeAlso' => array('text' => 'LAM homepage', 'link' => 'http://www.ldap-account-manager.org/'))
* *
* @param string $id The id string for the help entry needed. * @param string $id The id string for the help entry needed.
* @return array The desired help entry. * @return array|null The desired help entry.
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
@ -1112,7 +1110,7 @@ abstract class baseModule {
return $this->meta['help'][$this->scope][$id]; return $this->meta['help'][$this->scope][$id];
} }
else { else {
return false; return null;
} }
} }
@ -1126,7 +1124,7 @@ abstract class baseModule {
* input, otherwise false.<br> * input, otherwise false.<br>
* This method's return value defaults to true. * This method's return value defaults to true.
* *
* @return boolean true, if page can be displayed * @return bool true, if page can be displayed
*/ */
public function module_ready() { public function module_ready() {
return true; return true;
@ -1305,7 +1303,7 @@ abstract class baseModule {
* This can be used to interact with the user, e.g. should the home directory be deleted? The output * This can be used to interact with the user, e.g. should the home directory be deleted? The output
* of all modules is displayed on a single page. * of all modules is displayed on a single page.
* *
* @return htmlElement meta HTML object * @return htmlElement|null meta HTML object
* @see htmlElement * @see htmlElement
*/ */
public function display_html_delete() { public function display_html_delete() {
@ -1443,8 +1441,8 @@ abstract class baseModule {
* A new line will also be added after this entry so multiple calls will show the fields one below the other. * A new line will also be added after this entry so multiple calls will show the fields one below the other.
* *
* @param htmlResponsiveRow $container parent container * @param htmlResponsiveRow $container parent container
* @param String $attrName attribute name * @param string $attrName attribute name
* @param String $label label name * @param string|null $label label name
* @param boolean $required this is a required field (default false) * @param boolean $required this is a required field (default false)
* @param integer $length field length * @param integer $length field length
* @param boolean $isTextArea show as text area (default false) * @param boolean $isTextArea show as text area (default false)
@ -1544,7 +1542,7 @@ abstract class baseModule {
* *
* @param String $attrName attribute name * @param String $attrName attribute name
* @param array $errors errors array where to put validation errors * @param array $errors errors array where to put validation errors
* @param String $validationID validation ID for function get_preg() (default: null, null means no validation) * @param string|null $validationID validation ID for function get_preg() (default: null, null means no validation)
* @param bool $required the field is required (default: false) * @param bool $required the field is required (default: false)
*/ */
protected function processMultiValueInputTextField($attrName, &$errors, $validationID = null, $required = false) { protected function processMultiValueInputTextField($attrName, &$errors, $validationID = null, $required = false) {
@ -1554,7 +1552,7 @@ abstract class baseModule {
if (($this->attributes[$attrName][$counter] === '') || isset($_POST['del_' . $attrName . '_' . $counter])) { if (($this->attributes[$attrName][$counter] === '') || isset($_POST['del_' . $attrName . '_' . $counter])) {
unset($this->attributes[$attrName][$counter]); unset($this->attributes[$attrName][$counter]);
} }
elseif (($validationID != null) && ($this->attributes[$attrName][$counter] !== '') && !get_preg($this->attributes[$attrName][$counter], $validationID)) { elseif (($validationID !== null) && !get_preg($this->attributes[$attrName][$counter], $validationID)) {
$msg = $this->messages[$attrName][0]; $msg = $this->messages[$attrName][0];
if (count($msg) < 3) { if (count($msg) < 3) {
$msg[] = htmlspecialchars($this->attributes[$attrName][$counter]); $msg[] = htmlspecialchars($this->attributes[$attrName][$counter]);
@ -1585,8 +1583,8 @@ abstract class baseModule {
* A new line will also be added after this entry so multiple calls will show the fields one below the other. * A new line will also be added after this entry so multiple calls will show the fields one below the other.
* *
* @param htmlResponsiveRow $container parent container * @param htmlResponsiveRow $container parent container
* @param String $attrName attribute name * @param string $attrName attribute name
* @param String $label label name * @param string|null $label label name
* @param array $options options for the selects * @param array $options options for the selects
* @param boolean $hasDescriptiveOptions has descriptive options * @param boolean $hasDescriptiveOptions has descriptive options
* @param boolean $required this is a required field (default false) * @param boolean $required this is a required field (default false)
@ -2239,10 +2237,10 @@ abstract class baseModule {
/** /**
* This function creates meta HTML code to display the module specific page * This function creates meta HTML code to display the module specific page
* for the self service. * for the self-service.
* *
* @param selfServiceProfile $profile self service settings * @param selfServiceProfile $profile self-service settings
* @return htmlElement meta HTML object * @return htmlElement|null meta HTML object
* *
* @see htmlElement * @see htmlElement
*/ */

View file

@ -978,10 +978,10 @@ class LAMConfig {
private $name; private $name;
/** access level */ /** access level */
private $accessLevel = LAMconfig::ACCESS_ALL; private $accessLevel = LAMConfig::ACCESS_ALL;
/** login method */ /** login method */
private $loginMethod = LAMconfig::LOGIN_LIST; private $loginMethod = LAMConfig::LOGIN_LIST;
/** search suffix for login */ /** search suffix for login */
private $loginSearchSuffix = 'dc=yourdomain,dc=org'; private $loginSearchSuffix = 'dc=yourdomain,dc=org';
@ -1019,7 +1019,7 @@ class LAMConfig {
private $pwdResetForcePasswordChange = 'true'; private $pwdResetForcePasswordChange = 'true';
/** password reset page: default selection for password output /** password reset page: default selection for password output
* PWDRESET_DEFAULT_SCREEN, PWDRESET_DEFAULT_MAIL, PWDRESET_DEFAULT_BOTH */ * PWDRESET_DEFAULT_SCREEN, PWDRESET_DEFAULT_MAIL, PWDRESET_DEFAULT_BOTH */
private $pwdResetDefaultPasswordOutput = LAMconfig::PWDRESET_DEFAULT_MAIL; private $pwdResetDefaultPasswordOutput = LAMConfig::PWDRESET_DEFAULT_MAIL;
/** LDAP user for jobs */ /** LDAP user for jobs */
private $jobsBindUser; private $jobsBindUser;
@ -1219,7 +1219,7 @@ class LAMConfig {
/** /**
* Sets the server address * Sets the server address
* *
* @param string $value new server address * @param string|null $value new server address
* @return boolean true if $value has correct format * @return boolean true if $value has correct format
*/ */
public function set_ServerURL($value) { public function set_ServerURL($value) {
@ -1254,7 +1254,7 @@ class LAMConfig {
/** /**
* Sets the server display name * Sets the server display name
* *
* @param string $value new server display name * @param string|null $value new server display name
* @return boolean true if $value has correct format * @return boolean true if $value has correct format
*/ */
public function setServerDisplayName($value) { public function setServerDisplayName($value) {

View file

@ -22,3 +22,6 @@ parameters:
- '#Variable \$helpArray might not be defined.#' - '#Variable \$helpArray might not be defined.#'
- '#Binary operation .* between .* and .* results in an error.#' - '#Binary operation .* between .* and .* results in an error.#'
- '#Offset .SID. on array.*in isset\(\) always exists.*#' - '#Offset .SID. on array.*in isset\(\) always exists.*#'
- '#Offset .preferred_username. does not exist on.*#'
- '#Strict comparison using !== between non-empty-list.*will always evaluate to true.*#'
- '#Strict comparison using !== between non-empty-array.*will always evaluate to true.*#'