mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-03 09:49:16 +02:00
refactoring
This commit is contained in:
parent
cfc8be9f7f
commit
9f4a89ba2d
3 changed files with 12 additions and 10 deletions
|
@ -39,7 +39,7 @@ function getTools(): array {
|
||||||
$entry = $toolsDir->read();
|
$entry = $toolsDir->read();
|
||||||
// include all files in the tools directory
|
// include all files in the tools directory
|
||||||
while ($entry) {
|
while ($entry) {
|
||||||
if ((substr($entry, strlen($entry) - 4, 4) == '.inc') && is_file($toolsDirName . '/' . $entry)) {
|
if ((substr($entry, strlen($entry) - 4, 4) === '.inc') && is_file($toolsDirName . '/' . $entry)) {
|
||||||
include_once($toolsDirName . '/' . $entry);
|
include_once($toolsDirName . '/' . $entry);
|
||||||
}
|
}
|
||||||
$entry = $toolsDir->read();
|
$entry = $toolsDir->read();
|
||||||
|
|
|
@ -256,21 +256,21 @@ class ConfiguredType {
|
||||||
$units = ldap_get_entries($connection, $sr);
|
$units = ldap_get_entries($connection, $sr);
|
||||||
cleanLDAPResult($units);
|
cleanLDAPResult($units);
|
||||||
// extract Dns
|
// extract Dns
|
||||||
$count = sizeof($units);
|
$count = count($units);
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
if (in_array('container', $units[$i]['objectclass'])) {
|
// Active Directory fix, hide system containers
|
||||||
// Active Directory fix, hide system containers
|
if (in_array('container', $units[$i]['objectclass'])
|
||||||
if (preg_match('/.*cn=system,dc=.+/i', $units[$i]['dn']) || preg_match('/.*CN=program data,dc=.+/i', $units[$i]['dn'])) {
|
&& (preg_match('/.*cn=system,dc=.+/i', $units[$i]['dn'])
|
||||||
continue;
|
|| preg_match('/.*CN=program data,dc=.+/i', $units[$i]['dn']))) {
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
$ret[] = $units[$i]['dn'];
|
$ret[] = $units[$i]['dn'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add root suffix if needed
|
// add root suffix if needed
|
||||||
$found = false;
|
$found = false;
|
||||||
for ($i = 0; $i < sizeof($ret); $i++) { // search suffix case-insensitive
|
for ($i = 0; $i < count($ret); $i++) { // search suffix case-insensitive
|
||||||
if (strtolower($this->getSuffix()) == strtolower($ret[$i])) {
|
if (strtolower($this->getSuffix()) === strtolower($ret[$i])) {
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
|
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
|
||||||
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
|
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
|
||||||
|
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
|
||||||
use Rector\Config\RectorConfig;
|
use Rector\Config\RectorConfig;
|
||||||
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
|
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
|
||||||
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
|
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
|
||||||
|
@ -36,7 +37,8 @@ return RectorConfig::configure()
|
||||||
RestoreDefaultNullToNullableTypePropertyRector::class,
|
RestoreDefaultNullToNullableTypePropertyRector::class,
|
||||||
ForRepeatedCountToOwnVariableRector::class,
|
ForRepeatedCountToOwnVariableRector::class,
|
||||||
SimplifyEmptyCheckOnEmptyArrayRector::class,
|
SimplifyEmptyCheckOnEmptyArrayRector::class,
|
||||||
DisallowedEmptyRuleFixerRector::class
|
DisallowedEmptyRuleFixerRector::class,
|
||||||
|
FlipTypeControlToUseExclusiveTypeRector::class
|
||||||
])
|
])
|
||||||
->withFileExtensions([
|
->withFileExtensions([
|
||||||
'php',
|
'php',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue