diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-23 15:10:27 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-25 19:34:58 +0200 |
commit | af6de04e9e141466dc229e444ff3f146f4a34765 (patch) | |
tree | 7b93f521865cdecdadb33637dea33bea242e7969 /lib/private/legacy | |
parent | 1cc6b3577fdbeadece7e4e6478e7f7755555b41a (diff) | |
download | nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.tar.gz nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.zip |
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/OC_App.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/OC_Files.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/OC_Helper.php | 20 | ||||
-rw-r--r-- | lib/private/legacy/OC_Hook.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/OC_Image.php | 20 | ||||
-rw-r--r-- | lib/private/legacy/OC_Template.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/OC_User.php | 8 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 20 | ||||
-rw-r--r-- | lib/private/legacy/template/functions.php | 12 |
9 files changed, 51 insertions, 51 deletions
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 3347e4a6ec2..f48f4fd0b98 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -171,7 +171,7 @@ class OC_App { * * @param bool $forceRefresh whether to refresh the cache * @param bool $all whether to return apps for all users, not only the - * currently logged in one + * currently logged in one * @return string[] */ public static function getEnabledApps(bool $forceRefresh = false, bool $all = false): array { @@ -886,7 +886,7 @@ class OC_App { } elseif ($englishFallback !== false) { return $englishFallback; } - return (string) $fallback; + return (string)$fallback; } /** diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 76d61a98558..07caba42ff2 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -43,7 +43,7 @@ class OC_Files { OC_Response::setContentDispositionHeader($name, 'attachment'); header('Content-Transfer-Encoding: binary', true); header('Expires: 0'); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); $fileSize = \OC\Files\Filesystem::filesize($filename); $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); if ($fileSize > -1) { @@ -334,8 +334,8 @@ class OC_Files { foreach ($rangeArray as $range) { echo "\r\n--".self::getBoundary()."\r\n". - "Content-type: ".$type."\r\n". - "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n"; + 'Content-type: '.$type."\r\n". + 'Content-range: bytes '.$range['from'].'-'.$range['to'].'/'.$range['size']."\r\n\r\n"; $view->readfilePart($filename, $range['from'], $range['to']); } echo "\r\n--".self::getBoundary()."--\r\n"; diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 7db60363ff3..33cc966da2a 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -44,7 +44,7 @@ class OC_Helper { */ public static function humanFileSize(int|float $bytes): string { if ($bytes < 0) { - return "?"; + return '?'; } if ($bytes < 1024) { return "$bytes B"; @@ -127,7 +127,7 @@ class OC_Helper { } $files = scandir($src); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file != '.' && $file != '..') { self::copyr("$src/$file", "$dest/$file"); } } @@ -195,21 +195,21 @@ class OC_Helper { * @param bool $path * @internal param string $program name * @internal param string $optional search path, defaults to $PATH - * @return bool true if executable program found in path + * @return bool true if executable program found in path */ public static function canExecute($name, $path = false) { // path defaults to PATH from environment if not set if ($path === false) { - $path = getenv("PATH"); + $path = getenv('PATH'); } // we look for an executable file of that name - $exts = [""]; - $check_fn = "is_executable"; + $exts = ['']; + $check_fn = 'is_executable'; // Default check will be done with $path directories : $dirs = explode(PATH_SEPARATOR, $path); // WARNING : We have to check if open_basedir is enabled : $obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir'); - if ($obd != "none") { + if ($obd != 'none') { $obd_values = explode(PATH_SEPARATOR, $obd); if (count($obd_values) > 0 and $obd_values[0]) { // open_basedir is in effect ! @@ -516,13 +516,13 @@ class OC_Helper { $free = 0.0; } } catch (\Exception $e) { - if ($path === "") { + if ($path === '') { throw $e; } /** @var LoggerInterface $logger */ $logger = \OC::$server->get(LoggerInterface::class); - $logger->warning("Error while getting quota info, using root quota", ['exception' => $e]); - $rootInfo = self::getStorageInfo(""); + $logger->warning('Error while getting quota info, using root quota', ['exception' => $e]); + $rootInfo = self::getStorageInfo(''); $memcache->set($cacheKey, $rootInfo, 5 * 60); return $rootInfo; } diff --git a/lib/private/legacy/OC_Hook.php b/lib/private/legacy/OC_Hook.php index 2f6686f9126..5c36a253895 100644 --- a/lib/private/legacy/OC_Hook.php +++ b/lib/private/legacy/OC_Hook.php @@ -43,8 +43,8 @@ class OC_Hook { } // Connect the hook handler to the requested emitter self::$registered[$signalClass][$signalName][] = [ - "class" => $slotClass, - "name" => $slotName + 'class' => $slotClass, + 'name' => $slotName ]; // No chance for failure ;-) @@ -79,7 +79,7 @@ class OC_Hook { // Call all slots foreach (self::$registered[$signalClass][$signalName] as $i) { try { - call_user_func([ $i["class"], $i["name"] ], $params); + call_user_func([ $i['class'], $i['name'] ], $params); } catch (Exception $e) { self::$thrownExceptions[] = $e; \OC::$server->getLogger()->logException($e); diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 1d2326dcce9..56fe96cda60 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -334,18 +334,18 @@ class OC_Image implements \OCP\IImage { } ob_start(); switch ($this->mimeType) { - case "image/png": + case 'image/png': $res = imagepng($this->resource); break; - case "image/jpeg": + case 'image/jpeg': imageinterlace($this->resource, true); $quality = $this->getJpegQuality(); $res = imagejpeg($this->resource, null, $quality); break; - case "image/gif": + case 'image/gif': $res = imagegif($this->resource); break; - case "image/webp": + case 'image/webp': $res = imagewebp($this->resource, null, $this->getWebpQuality()); break; default: @@ -370,24 +370,24 @@ class OC_Image implements \OCP\IImage { * @return int */ protected function getJpegQuality(): int { - $quality = $this->config->getAppValue('preview', 'jpeg_quality', (string) self::DEFAULT_JPEG_QUALITY); + $quality = $this->config->getAppValue('preview', 'jpeg_quality', (string)self::DEFAULT_JPEG_QUALITY); // TODO: remove when getAppValue is type safe if ($quality === null) { $quality = self::DEFAULT_JPEG_QUALITY; } - return min(100, max(10, (int) $quality)); + return min(100, max(10, (int)$quality)); } /** * @return int */ protected function getWebpQuality(): int { - $quality = $this->config->getAppValue('preview', 'webp_quality', (string) self::DEFAULT_WEBP_QUALITY); + $quality = $this->config->getAppValue('preview', 'webp_quality', (string)self::DEFAULT_WEBP_QUALITY); // TODO: remove when getAppValue is type safe if ($quality === null) { $quality = self::DEFAULT_WEBP_QUALITY; } - return min(100, max(10, (int) $quality)); + return min(100, max(10, (int)$quality)); } /** @@ -954,10 +954,10 @@ class OC_Image implements \OCP\IImage { $width = $height = min($widthOrig, $heightOrig); if ($ratioOrig > 1) { - $x = (int) (($widthOrig / 2) - ($width / 2)); + $x = (int)(($widthOrig / 2) - ($width / 2)); $y = 0; } else { - $y = (int) (($heightOrig / 2) - ($height / 2)); + $y = (int)(($heightOrig / 2) - ($height / 2)); $x = 0; } if ($size > 0) { diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index e3e9a7abc5f..422709cec7d 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -95,7 +95,7 @@ class OC_Template extends \OC\Template\Base { * @param string $tag tag name of the element * @param array $attributes array of attributes for the element * @param string $text the text content for the element. If $text is null then the - * element will be written as empty element. So use "" to get a closing tag. + * element will be written as empty element. So use "" to get a closing tag. */ public function addHeader($tag, $attributes, $text = null) { $this->headers[] = [ @@ -172,7 +172,7 @@ class OC_Template extends \OC\Template\Base { * @return boolean|null */ public static function printUserPage($application, $name, $parameters = []) { - $content = new OC_Template($application, $name, "user"); + $content = new OC_Template($application, $name, 'user'); foreach ($parameters as $key => $value) { $content->assign($key, $value); } @@ -187,7 +187,7 @@ class OC_Template extends \OC\Template\Base { * @return bool */ public static function printAdminPage($application, $name, $parameters = []) { - $content = new OC_Template($application, $name, "admin"); + $content = new OC_Template($application, $name, 'admin'); foreach ($parameters as $key => $value) { $content->assign($key, $value); } diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index d2978f6ad21..b8a00de84cc 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -142,7 +142,7 @@ class OC_User { public static function loginWithApache(\OCP\Authentication\IApacheBackend $backend) { $uid = $backend->getCurrentUserId(); $run = true; - OC_Hook::emit("OC_User", "pre_login", ["run" => &$run, "uid" => $uid, 'backend' => $backend]); + OC_Hook::emit('OC_User', 'pre_login', ['run' => &$run, 'uid' => $uid, 'backend' => $backend]); if ($uid) { if (self::getUser() !== $uid) { @@ -213,9 +213,9 @@ class OC_User { * Verify with Apache whether user is authenticated. * * @return boolean|null - * true: authenticated - * false: not authenticated - * null: not handled / no backend available + * true: authenticated + * false: not authenticated + * null: not handled / no backend available */ public static function handleApacheAuth() { $backend = self::findFirstActiveUsedBackend(); diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 3b5222fee64..84bb0b645d5 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -296,7 +296,7 @@ class OC_Util { private static function generatePath($application, $directory, $file) { if (is_null($file)) { $file = $application; - $application = ""; + $application = ''; } if (!empty($application)) { return "$application/$directory/$file"; @@ -322,7 +322,7 @@ class OC_Util { if ($application !== 'core' && $file !== null) { self::addTranslations($application); } - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -335,7 +335,7 @@ class OC_Util { */ public static function addVendorScript($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'vendor', $file); - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -356,7 +356,7 @@ class OC_Util { } else { $path = "l10n/$languageCode"; } - self::addExternalResource($application, $prepend, $path, "script"); + self::addExternalResource($application, $prepend, $path, 'script'); } /** @@ -369,7 +369,7 @@ class OC_Util { */ public static function addStyle($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'css', $file); - self::addExternalResource($application, $prepend, $path, "style"); + self::addExternalResource($application, $prepend, $path, 'style'); } /** @@ -382,7 +382,7 @@ class OC_Util { */ public static function addVendorStyle($application, $file = null, $prepend = false) { $path = OC_Util::generatePath($application, 'vendor', $file); - self::addExternalResource($application, $prepend, $path, "style"); + self::addExternalResource($application, $prepend, $path, 'style'); } /** @@ -394,8 +394,8 @@ class OC_Util { * @param string $type (script or style) * @return void */ - private static function addExternalResource($application, $prepend, $path, $type = "script") { - if ($type === "style") { + private static function addExternalResource($application, $prepend, $path, $type = 'script') { + if ($type === 'style') { if (!in_array($path, self::$styles)) { if ($prepend === true) { array_unshift(self::$styles, $path); @@ -403,7 +403,7 @@ class OC_Util { self::$styles[] = $path; } } - } elseif ($type === "script") { + } elseif ($type === 'script') { if (!in_array($path, self::$scripts)) { if ($prepend === true) { array_unshift(self::$scripts, $path); @@ -991,7 +991,7 @@ class OC_Util { * @return string the theme */ public static function getTheme() { - $theme = \OC::$server->getSystemConfig()->getValue("theme", ''); + $theme = \OC::$server->getSystemConfig()->getValue('theme', ''); if ($theme === '') { if (is_dir(OC::$SERVERROOT . '/themes/default')) { diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 84ada2aa6d8..87b91639fd3 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -102,7 +102,7 @@ function print_unescaped($string) { * * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all scripts + * if an array is given it will add all scripts */ function script($app, $file = null) { if (is_array($file)) { @@ -118,7 +118,7 @@ function script($app, $file = null) { * Shortcut for adding vendor scripts to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all scripts + * if an array is given it will add all scripts */ function vendor_script($app, $file = null) { if (is_array($file)) { @@ -134,7 +134,7 @@ function vendor_script($app, $file = null) { * Shortcut for adding styles to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all styles + * if an array is given it will add all styles */ function style($app, $file = null) { if (is_array($file)) { @@ -150,7 +150,7 @@ function style($app, $file = null) { * Shortcut for adding vendor styles to a page * @param string $app the appname * @param string|string[] $file the filename, - * if an array is given it will add all styles + * if an array is given it will add all styles */ function vendor_style($app, $file = null) { if (is_array($file)) { @@ -165,7 +165,7 @@ function vendor_style($app, $file = null) { /** * Shortcut for adding translations to a page * @param string $app the appname - * if an array is given it will add all styles + * if an array is given it will add all styles */ function translation($app) { OC_Util::addTranslations($app); @@ -175,7 +175,7 @@ function translation($app) { * Shortcut for HTML imports * @param string $app the appname * @param string|string[] $file the path relative to the app's component folder, - * if an array is given it will add all components + * if an array is given it will add all components */ function component($app, $file) { if (is_array($file)) { |