diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-17 15:22:00 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-02-17 15:27:43 +0100 |
commit | edee243b27f7d042998fd840d0b0f75548e3c489 (patch) | |
tree | 8df7b5c25badad8e00a12f8e0479c7f9d1650f30 /lib/private/legacy/app.php | |
parent | 2a2833e30fcc2b330ff603aae8cf8a8ed298a89b (diff) | |
download | nextcloud-server-edee243b27f7d042998fd840d0b0f75548e3c489.tar.gz nextcloud-server-edee243b27f7d042998fd840d0b0f75548e3c489.zip |
OC_App::loadApps now only accepts an array as type list
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/legacy/app.php')
-rw-r--r-- | lib/private/legacy/app.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index c0794cdfa8d..f04310041ac 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -93,16 +93,16 @@ class OC_App { /** * loads all apps * - * @param string[] | string | null $types + * @param string[] $types * @return bool * * This function walks through the ownCloud directory and loads all apps * it can find. A directory contains an app if the file /appinfo/info.xml * exists. * - * if $types is set, only apps of those types will be loaded + * if $types is set to non-empty array, only apps of those types will be loaded */ - public static function loadApps($types = null) { + public static function loadApps(array $types = []): bool { if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } @@ -120,7 +120,7 @@ class OC_App { // prevent app.php from printing output ob_start(); foreach ($apps as $app) { - if ((is_null($types) or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { + if (($types === [] or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { self::loadApp($app); } } @@ -268,13 +268,10 @@ class OC_App { * check if an app is of a specific type * * @param string $app - * @param string|array $types + * @param array $types * @return bool */ - public static function isType($app, $types) { - if (is_string($types)) { - $types = array($types); - } + public static function isType(string $app, array $types): bool { $appTypes = self::getAppTypes($app); foreach ($types as $type) { if (array_search($type, $appTypes) !== false) { |