Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Jul 12, 2024
1 parent 12d2307 commit 74b760d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lam/lib/modules/asteriskAccount.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use LAM\TYPES\ConfiguredType;
*/
class asteriskAccount extends baseModule implements passwordService {

const ASTERISK_DEFAULT_REALM = "asterisk";
private const ASTERISK_DEFAULT_REALM = "asterisk";

/**
* These attributes will be ignored by default if a new account is copied from an existing one.
Expand Down Expand Up @@ -253,7 +253,7 @@ class asteriskAccount extends baseModule implements passwordService {
];
// self service options
$selfServiceContainer = new htmlResponsiveRow();
$selfServiceContainer->add(new htmlResponsiveInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, ['AsteriskRealm', get_class($this)]), 12);
$selfServiceContainer->add(new htmlResponsiveInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, ['AsteriskRealm', static::class]), 12);
$return['selfServiceSettings'] = $selfServiceContainer;
// profile options
$profileContainer = new htmlResponsiveRow();
Expand Down Expand Up @@ -1146,7 +1146,7 @@ class asteriskAccount extends baseModule implements passwordService {
* @see passwordService::passwordChangeRequested
*/
public function passwordChangeRequested($password, $modules, $forcePasswordChange) {
if (!in_array(get_class($this), $modules)) {
if (!in_array(static::class, $modules)) {
return [];
}
$this->attributes['AstAccountRealmedPassword'][0] = asteriskAccount::buildPasswordString($this->attributes, $this->moduleSettings, $password);
Expand All @@ -1162,7 +1162,7 @@ class asteriskAccount extends baseModule implements passwordService {
* @return String value for password attribute
*/
public static function buildPasswordString(&$attributes, &$moduleSettings, $password) {
$astRealm = asteriskAccount::ASTERISK_DEFAULT_REALM;
$astRealm = self::ASTERISK_DEFAULT_REALM;
if (!empty($moduleSettings['asteriskAccount_AsteriskRealm'][0])) {
$astRealm = $moduleSettings['asteriskAccount_AsteriskRealm'][0];
}
Expand Down
10 changes: 5 additions & 5 deletions lam/lib/modules/asteriskExtension.inc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class asteriskExtension extends baseModule {
}
$renderContainer->add($ownerList, 12);
$renderContainer->addVerticalSpacer('1rem');
$renderContainer->add(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Change')), 12);
$renderContainer->add(new htmlAccountPageButton(static::class, 'user', 'open', _('Change')), 12);
}

/**
Expand Down Expand Up @@ -451,14 +451,14 @@ class asteriskExtension extends baseModule {
$users_dn[getAbstractDN($dn)] = $dn;
}
}
uasort($users_dn, 'compareDN');
uasort($users_dn, compareDN(...));
if (isset($this->extensionOwners)) {
$memberList = $this->extensionOwners;
}
else {
$memberList = [];
}
usort($memberList, 'compareDN');
usort($memberList, compareDN(...));
$members = [];
for ($i = 0; $i < sizeof($memberList); $i++) {
$members[getAbstractDN($memberList[$i])] = $memberList[$i];
Expand All @@ -473,7 +473,7 @@ class asteriskExtension extends baseModule {
$return->add(new htmlSubTitle(_("Extension owners")), 12);
$this->addDoubleSelectionArea($return, _("Selected users"), _("Available users"), $members, [], $users_dn, [], 'owners', true);
// back button
$backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Ok'));
$backButton = new htmlAccountPageButton(static::class, 'attributes', 'back', _('Ok'));
$backButton->colspan = 3;
$return->add($backButton, 12);
return $return;
Expand Down Expand Up @@ -692,7 +692,7 @@ class asteriskExtension extends baseModule {
//Fill the member filed
$extRow['member'] = $this->extensionOwners;
if ((!isset($extRow['member']) || count($extRow['member']) == 0)
&& !isset($_POST['form_subpage_' . get_class($this) . '_user_open'])) {
&& !isset($_POST['form_subpage_' . static::class . '_user_open'])) {
$errors[] = $this->messages['member'][0];
}
return $errors;
Expand Down
2 changes: 1 addition & 1 deletion lam/lib/modules/asteriskVoicemail.inc
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
* @see passwordService::passwordChangeRequested
*/
public function passwordChangeRequested($password, $modules, $forcePasswordChange) {
if (!in_array(get_class($this), $modules)) {
if (!in_array(static::class, $modules)) {
return [];
}
$this->attributes['AstVoicemailPassword'][0] = $password;
Expand Down

0 comments on commit 74b760d

Please sign in to comment.