Browse Source

refactor: Repalce array_search with in_array in lib/

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v28.0.0rc1
Christoph Wurst 9 months ago
parent
commit
ea8f9a7e84

+ 2
- 2
lib/private/Archive/TAR.php View File

@@ -197,7 +197,7 @@ class TAR extends Archive {
if ($pos = strpos($result, '/')) {
$result = substr($result, 0, $pos + 1);
}
if (array_search($result, $folderContent) === false) {
if (!in_array($result, $folderContent)) {
$folderContent[] = $result;
}
}
@@ -269,7 +269,7 @@ class TAR extends Archive {
*/
public function fileExists(string $path): bool {
$files = $this->getFiles();
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
if ((in_array($path, $files)) or (in_array($path . '/', $files))) {
return true;
} else {
$folderPath = rtrim($path, '/') . '/';

+ 1
- 1
lib/private/Command/AsyncBus.php View File

@@ -82,7 +82,7 @@ abstract class AsyncBus implements IBus {
private function canRunAsync($command) {
$traits = $this->getTraits($command);
foreach ($traits as $trait) {
if (array_search($trait, $this->syncTraits) !== false) {
if (in_array($trait, $this->syncTraits)) {
return false;
}
}

+ 2
- 2
lib/private/Files/Cache/Cache.php View File

@@ -454,7 +454,7 @@ class Cache implements ICache {
$params = [];
$extensionParams = [];
foreach ($data as $name => $value) {
if (array_search($name, $fields) !== false) {
if (in_array($name, $fields)) {
if ($name === 'path') {
$params['path_hash'] = md5($value);
} elseif ($name === 'mimetype') {
@@ -474,7 +474,7 @@ class Cache implements ICache {
}
$params[$name] = $value;
}
if (array_search($name, $extensionFields) !== false) {
if (in_array($name, $extensionFields)) {
$extensionParams[$name] = $value;
}
}

+ 1
- 1
lib/private/Files/Cache/Watcher.php View File

@@ -129,7 +129,7 @@ class Watcher implements IWatcher {
* @return bool
*/
public function needsUpdate($path, $cachedData) {
if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and array_search($path, $this->checkedPaths) === false)) {
if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and !in_array($path, $this->checkedPaths))) {
$this->checkedPaths[] = $path;
return $this->storage->hasUpdated($path, $cachedData['storage_mtime']);
}

+ 1
- 1
lib/private/Group/Manager.php View File

@@ -371,7 +371,7 @@ class Manager extends PublicEmitter implements IGroupManager {
* @return bool if in group
*/
public function isInGroup($userId, $group) {
return array_search($group, $this->getUserIdGroupIds($userId)) !== false;
return in_array($group, $this->getUserIdGroupIds($userId));
}

/**

+ 1
- 1
lib/private/Hooks/EmitterTrait.php View File

@@ -43,7 +43,7 @@ trait EmitterTrait {
if (!isset($this->listeners[$eventName])) {
$this->listeners[$eventName] = [];
}
if (array_search($callback, $this->listeners[$eventName], true) === false) {
if (!in_array($callback, $this->listeners[$eventName], true)) {
$this->listeners[$eventName][] = $callback;
}
}

+ 1
- 1
lib/private/legacy/OC_App.php View File

@@ -564,7 +564,7 @@ class OC_App {
$supportedApps = $this->getSupportedApps();

foreach ($installedApps as $app) {
if (array_search($app, $blacklist) === false) {
if (!in_array($app, $blacklist)) {
$info = $appManager->getAppInfo($app, false, $langCode);
if (!is_array($info)) {
\OCP\Server::get(LoggerInterface::class)->error('Could not read app info file for app "' . $app . '"', ['app' => 'core']);

+ 1
- 1
lib/private/legacy/OC_User.php View File

@@ -138,7 +138,7 @@ class OC_User {
$class = $config['class'];
$arguments = $config['arguments'];
if (class_exists($class)) {
if (array_search($i, self::$_setupedBackends) === false) {
if (!in_array($i, self::$_setupedBackends)) {
// make a reflection object
$reflectionObj = new ReflectionClass($class);


Loading…
Cancel
Save