]> git.mxchange.org Git - friendica.git/commitdiff
Make PHPCS happy
authorPhilipp <admin@philipp.info>
Mon, 21 Apr 2025 18:49:41 +0000 (20:49 +0200)
committerPhilipp <admin@philipp.info>
Sun, 27 Apr 2025 19:26:44 +0000 (21:26 +0200)
src/Core/Cache/Type/APCuCache.php
src/Core/Cache/Type/ArrayCache.php
src/Core/Cache/Type/MemcacheCache.php
src/Core/Cache/Type/MemcachedCache.php
src/Core/Lock/Type/CacheLock.php
src/Module/StatsCaching.php

index 3c72e76c983304a1f402d424d1478a7b398e3a7b..b269b5aa9db50d818b7bdc5119dbfaefc86c3cb0 100644 (file)
@@ -16,10 +16,9 @@ use Friendica\Core\Cache\Exception\InvalidCacheDriverException;
  */
 class APCuCache extends AbstractCache implements ICanCacheInMemory
 {
-       const NAME = 'apcu';
-
        use CompareSetTrait;
        use CompareDeleteTrait;
+       const NAME = 'apcu';
 
        /**
         * @throws InvalidCacheDriverException
@@ -156,10 +155,10 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory
 
                return [
                        'entries'     => $apcu['num_entries'] ?? null,
-                       'used_memory'    => $apcu['mem_size'] ?? null,
-                       'hits'        => $apcu['num_hits'] ?? null,
-                       'misses'      => $apcu['num_misses'] ?? null,
-                       'avail_mem'   => $sma['avail_mem'] ?? null,
+                       'used_memory' => $apcu['mem_size']    ?? null,
+                       'hits'        => $apcu['num_hits']    ?? null,
+                       'misses'      => $apcu['num_misses']  ?? null,
+                       'avail_mem'   => $sma['avail_mem']    ?? null,
                ];
        }
 }
index c6a20d627b62745038ba52df1b84fcf1ad95ae14..148210b4e89fd18d8183b623f237aea6d0701f98 100644 (file)
@@ -15,9 +15,8 @@ use Friendica\Core\Cache\Enum;
  */
 class ArrayCache extends AbstractCache implements ICanCacheInMemory
 {
-       const NAME = 'array';
-
        use CompareDeleteTrait;
+       const NAME = 'array';
 
        /** @var array Array with the cached data */
        protected $cachedData = [];
index b2142ffd3670513b0aceba79cf7a6aeee54418c2..b3a658884167ca077455d4246d9ea5618137634d 100644 (file)
@@ -19,11 +19,10 @@ use Memcache;
  */
 class MemcacheCache extends AbstractCache implements ICanCacheInMemory
 {
-       const NAME = 'memcache';
-
        use CompareSetTrait;
        use CompareDeleteTrait;
        use MemcacheCommandTrait;
+       const NAME = 'memcache';
 
        /**
         * @var Memcache
@@ -163,14 +162,14 @@ class MemcacheCache extends AbstractCache implements ICanCacheInMemory
                $stats = $this->memcache->getStats();
 
                return [
-                       'version'           => $stats['version'] ?? null,
-                       'entries'           => $stats['curr_items'] ?? null,
-                       'used_memory'       => $stats['bytes'] ?? null,
-                       'uptime'            => $stats['uptime'] ?? null,
+                       'version'           => $stats['version']          ?? null,
+                       'entries'           => $stats['curr_items']       ?? null,
+                       'used_memory'       => $stats['bytes']            ?? null,
+                       'uptime'            => $stats['uptime']           ?? null,
                        'connected_clients' => $stats['curr_connections'] ?? null,
-                       'hits'              => $stats['get_hits'] ?? null,
-                       'misses'            => $stats['get_misses'] ?? null,
-                       'evictions'         => $stats['evictions'] ?? null,
+                       'hits'              => $stats['get_hits']         ?? null,
+                       'misses'            => $stats['get_misses']       ?? null,
+                       'evictions'         => $stats['evictions']        ?? null,
                ];
        }
 }
index 53f959fd2b035cf98b96f2c3fe6c1431d3d43345..03ad7d832235fe976563785b5d36e5d6abb3b52e 100644 (file)
@@ -20,11 +20,10 @@ use Psr\Log\LoggerInterface;
  */
 class MemcachedCache extends AbstractCache implements ICanCacheInMemory
 {
-       const NAME = 'memcached';
-
        use CompareSetTrait;
        use CompareDeleteTrait;
        use MemcacheCommandTrait;
+       const NAME = 'memcached';
 
        /**
         * @var \Memcached
@@ -185,14 +184,14 @@ class MemcachedCache extends AbstractCache implements ICanCacheInMemory
                }
 
                return [
-                       'version'           => $stats['version'] ?? null,
-                       'entries'     =>       $stats['curr_items'] ?? null,
-                       'used_memory'       => $stats['bytes'] ?? null,
-                       'uptime'            => $stats['uptime'] ?? null,
+                       'version'           => $stats['version']          ?? null,
+                       'entries'           => $stats['curr_items']       ?? null,
+                       'used_memory'       => $stats['bytes']            ?? null,
+                       'uptime'            => $stats['uptime']           ?? null,
                        'connected_clients' => $stats['curr_connections'] ?? null,
-                       'hits'              => $stats['get_hits'] ?? null,
-                       'misses'            => $stats['get_misses'] ?? null,
-                       'evictions'         => $stats['evictions'] ?? null,
+                       'hits'              => $stats['get_hits']         ?? null,
+                       'misses'            => $stats['get_misses']       ?? null,
+                       'evictions'         => $stats['evictions']        ?? null,
                ];
        }
 }
index 9fc9fad8f8462284b3742a006e40e42de5888b99..c7fa75e021e4f5dad5fab67f746d4b9ab1dce726 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Core\Lock\Type;
 
-use Friendica\Core\Cache\Capability\ICanCache;
 use Friendica\Core\Cache\Capability\ICanCacheInMemory;
 use Friendica\Core\Cache\Enum\Duration;
 use Friendica\Core\Cache\Exception\CachePersistenceException;
index 72ba61c67a0c3ba503ff1d78c3b0223fd7791d3b..b8d0cd1829fda2355d9a0432c782ecdc08103d5b 100644 (file)
@@ -59,10 +59,10 @@ class StatsCaching extends BaseModule
                if (function_exists('opcache_get_status')) {
                        $status          = opcache_get_status(false);
                        $data['opcache'] = [
-                               'enabled'            => $status['opcache_enabled'] ?? false,
-                               'hit_rate'           => $status['opcache_statistics']['opcache_hit_rate'] ?? null,
-                               'used_memory'        => $status['memory_usage']['used_memory'] ?? null,
-                               'free_memory'        => $status['memory_usage']['free_memory'] ?? null,
+                               'enabled'            => $status['opcache_enabled']                          ?? false,
+                               'hit_rate'           => $status['opcache_statistics']['opcache_hit_rate']   ?? null,
+                               'used_memory'        => $status['memory_usage']['used_memory']              ?? null,
+                               'free_memory'        => $status['memory_usage']['free_memory']              ?? null,
                                'num_cached_scripts' => $status['opcache_statistics']['num_cached_scripts'] ?? null,
                        ];
                } else {
@@ -73,7 +73,7 @@ class StatsCaching extends BaseModule
 
                if ($this->cache instanceof ICanCacheInMemory) {
                        $data['cache'] = [
-                               'type' => $this->cache->getName(),
+                               'type'  => $this->cache->getName(),
                                'stats' => $this->cache->getStats(),
                        ];
                } else {
@@ -84,7 +84,7 @@ class StatsCaching extends BaseModule
 
                if ($this->lock instanceof CacheLock) {
                        $data['lock'] = [
-                               'type' => $this->lock->getName(),
+                               'type'  => $this->lock->getName(),
                                'stats' => $this->lock->getCacheStats(),
                        ];
                } else {