diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 093080698..8349cce24 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -283,8 +283,8 @@ App::get('/v1/avatars/favicon') case 'jpeg': $size = \explode('x', \strtolower($sizes)); - $sizeWidth = (isset($size[0])) ? (int) $size[0] : 0; - $sizeHeight = (isset($size[1])) ? (int) $size[1] : 0; + $sizeWidth = (int) $size[0] ?? 0; + $sizeHeight = (int) $size[1] ?? 0; if (($sizeWidth * $sizeHeight) >= $space) { $space = $sizeWidth * $sizeHeight; @@ -423,7 +423,7 @@ App::get('/v1/avatars/initials') $code = 0; foreach ($words as $key => $w) { - $initials .= (isset($w[0])) ? $w[0] : ''; + $initials .= $w[0] ?? ''; $code += (isset($w[0])) ? \ord($w[0]) : 0; if ($key == 1) { diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 70fdfac4f..bd1993575 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -418,8 +418,8 @@ App::post('/v1/database/collections/:collectionId/documents') * Set default collection values */ foreach ($collection->getAttribute('rules') as $key => $rule) { - $key = (isset($rule['key'])) ? $rule['key'] : ''; - $default = (isset($rule['default'])) ? $rule['default'] : null; + $key = $rule['key'] ?? ''; + $default = $rule['default'] ?? null; if (!isset($data[$key])) { $data[$key] = $default; diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index b8955a198..5ef4f2b9c 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -278,14 +278,14 @@ App::get('/v1/health/stats') // Currently only used internally 'partitionFree' => Storage::human($device->getPartitionFreeSpace()), ], 'cache' => [ - 'uptime' => (isset($cacheStats['uptime_in_seconds'])) ? $cacheStats['uptime_in_seconds'] : 0, - 'clients' => (isset($cacheStats['connected_clients'])) ? $cacheStats['connected_clients'] : 0, - 'hits' => (isset($cacheStats['keyspace_hits'])) ? $cacheStats['keyspace_hits'] : 0, - 'misses' => (isset($cacheStats['keyspace_misses'])) ? $cacheStats['keyspace_misses'] : 0, - 'memory_used' => (isset($cacheStats['used_memory'])) ? $cacheStats['used_memory'] : 0, - 'memory_used_human' => (isset($cacheStats['used_memory_human'])) ? $cacheStats['used_memory_human'] : 0, - 'memory_used_peak' => (isset($cacheStats['used_memory_peak'])) ? $cacheStats['used_memory_peak'] : 0, - 'memory_used_peak_human' => (isset($cacheStats['used_memory_peak_human'])) ? $cacheStats['used_memory_peak_human'] : 0, + 'uptime' => $cacheStats['uptime_in_seconds'] ?? 0, + 'clients' => $cacheStats['connected_clients'] ?? 0, + 'hits' => $cacheStats['keyspace_hits'] ?? 0, + 'misses' => $cacheStats['keyspace_misses'] ?? 0, + 'memory_used' => $cacheStats['used_memory'] ?? 0, + 'memory_used_human' => $cacheStats['used_memory_human'] ?? 0, + 'memory_used_peak' => $cacheStats['used_memory_peak'] ?? 0, + 'memory_used_peak_human' => $cacheStats['used_memory_peak_human'] ?? 0, ], ]); }, ['response', 'register']); diff --git a/app/tasks/migrate.php b/app/tasks/migrate.php index efa06e1fe..8f7fc9c7e 100644 --- a/app/tasks/migrate.php +++ b/app/tasks/migrate.php @@ -59,7 +59,7 @@ $callbacks = [ $offset = $offset + $limit; } - $schema = (isset($_SERVER['_APP_DB_SCHEMA'])) ? $_SERVER['_APP_DB_SCHEMA'] : ''; + $schema = $_SERVER['_APP_DB_SCHEMA'] ?? ''; try { $statement = $db->prepare(" diff --git a/app/views/console/database/collection.phtml b/app/views/console/database/collection.phtml index ea864120e..fc9f99351 100644 --- a/app/views/console/database/collection.phtml +++ b/app/views/console/database/collection.phtml @@ -104,10 +104,10 @@ $maxCells = 10; if($i > $maxCells) { break; } - $label = (isset($rule['label'])) ? $rule['label'] : ''; - $key = (isset($rule['key'])) ? $rule['key'] : ''; - $type = (isset($rule['type'])) ? $rule['type'] : ''; - $array = (isset($rule['array'])) ? $rule['array'] : ''; + $label = $rule['label'] ?? ''; + $key = $rule['key'] ?? ''; + $type = $rule['type'] ?? ''; + $array = $rule['array'] ?? ''; ?> diff --git a/app/views/console/database/document.phtml b/app/views/console/database/document.phtml index e8f760f68..5ac9e841e 100644 --- a/app/views/console/database/document.phtml +++ b/app/views/console/database/document.phtml @@ -17,10 +17,10 @@ $collections = []; render(); ?> getId()) { @@ -48,11 +48,11 @@ $collections = []; @@ -126,11 +126,11 @@ $collections = [];