]> source.dussan.org Git - nextcloud-server.git/commitdiff
Refactor lib/private/App
authorHamid Dehnavi <hamid.dev.pro@gmail.com>
Tue, 11 Jul 2023 07:18:17 +0000 (10:48 +0330)
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>
Fri, 23 Feb 2024 14:53:41 +0000 (15:53 +0100)
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
lib/private/App/AppManager.php
lib/private/App/AppStore/Bundles/Bundle.php
lib/private/App/AppStore/Bundles/BundleFetcher.php
lib/private/App/AppStore/Fetcher/AppFetcher.php
lib/private/App/AppStore/Fetcher/CategoryFetcher.php
lib/private/App/AppStore/Fetcher/Fetcher.php
lib/private/App/AppStore/Version/Version.php
lib/private/App/DependencyAnalyzer.php
lib/private/App/InfoParser.php
lib/private/App/Platform.php

index 60e55a314d6cf8c8fa1a8108066eeda9d62c2b4b..5eeb7ef1fbd3152f4d3fa7f4a6cd49695554d34c 100644 (file)
@@ -74,14 +74,6 @@ class AppManager implements IAppManager {
                'prevent_group_restriction',
        ];
 
-       private IUserSession $userSession;
-       private IConfig $config;
-       private AppConfig $appConfig;
-       private IGroupManager $groupManager;
-       private ICacheFactory $memCacheFactory;
-       private IEventDispatcher $dispatcher;
-       private LoggerInterface $logger;
-
        /** @var string[] $appId => $enabled */
        private array $installedAppsCache = [];
 
@@ -104,20 +96,15 @@ class AppManager implements IAppManager {
        /** @var array<string, true> */
        private array $loadedApps = [];
 
-       public function __construct(IUserSession $userSession,
-               IConfig $config,
-               AppConfig $appConfig,
-               IGroupManager $groupManager,
-               ICacheFactory $memCacheFactory,
-               IEventDispatcher $dispatcher,
-               LoggerInterface $logger) {
-               $this->userSession = $userSession;
-               $this->config = $config;
-               $this->appConfig = $appConfig;
-               $this->groupManager = $groupManager;
-               $this->memCacheFactory = $memCacheFactory;
-               $this->dispatcher = $dispatcher;
-               $this->logger = $logger;
+       public function __construct(
+               private IUserSession $userSession,
+               private IConfig $config,
+               private AppConfig $appConfig,
+               private IGroupManager $groupManager,
+               private ICacheFactory $memCacheFactory,
+               private IEventDispatcher $dispatcher,
+               private LoggerInterface $logger,
+       ) {
        }
 
        /**
index dfc93fdfaa2e4ee8582d0c24d80d9fdbd137f7dd..750ea5a41e3ef0cd9e10b31e9bcfcde44b5de466 100644 (file)
@@ -26,14 +26,13 @@ namespace OC\App\AppStore\Bundles;
 use OCP\IL10N;
 
 abstract class Bundle {
-       /** @var IL10N */
-       protected $l10n;
 
        /**
         * @param IL10N $l10n
         */
-       public function __construct(IL10N $l10n) {
-               $this->l10n = $l10n;
+       public function __construct(
+               protected IL10N $l10n,
+       ) {
        }
 
        /**
index 0d2bb61495ff85fcffa957d223eb0022becbd2f9..a2ce89f28af0fb0257538f51973dd004f284ba22 100644 (file)
@@ -27,10 +27,11 @@ namespace OC\App\AppStore\Bundles;
 use OCP\IL10N;
 
 class BundleFetcher {
-       private IL10N $l10n;
 
-       public function __construct(IL10N $l10n) {
-               $this->l10n = $l10n;
+       public function __construct
+       (
+               private IL10N $l10n,
+       ) {
        }
 
        /**
index f9fbd05855b8db5efb48e7d8d68ac8e691c6a254..7a7d2f2906d2b139b0b24eba5524b6c4031510e5 100644 (file)
@@ -39,11 +39,9 @@ use OCP\Support\Subscription\IRegistry;
 use Psr\Log\LoggerInterface;
 
 class AppFetcher extends Fetcher {
-       /** @var CompareVersion */
-       private $compareVersion;
 
        /** @var IRegistry */
-       protected $registry;
+       protected IRegistry $registry;
 
        /** @var bool */
        private $ignoreMaxVersion;
@@ -64,7 +62,6 @@ class AppFetcher extends Fetcher {
                        $registry
                );
 
-               $this->compareVersion = $compareVersion;
                $this->registry = $registry;
 
                $this->fileName = 'apps.json';
index d1bbe4f7b043420ba0d50c59bb0fa4004b67d61f..9b84d2a61966731532a40c98d6cb4fb8e8572ee0 100644 (file)
@@ -34,12 +34,14 @@ use OCP\Support\Subscription\IRegistry;
 use Psr\Log\LoggerInterface;
 
 class CategoryFetcher extends Fetcher {
-       public function __construct(Factory $appDataFactory,
+       public function __construct(
+               Factory $appDataFactory,
                IClientService $clientService,
                ITimeFactory $timeFactory,
                IConfig $config,
                LoggerInterface $logger,
-               IRegistry $registry) {
+               IRegistry $registry,
+       ) {
                parent::__construct(
                        $appDataFactory,
                        $clientService,
index a693804f50fbb2ec8c3b5cc0c72158edd44a1406..3fc5fd07573ba51e80de0657c27cf44f5a0c525d 100644 (file)
@@ -47,16 +47,6 @@ abstract class Fetcher {
 
        /** @var IAppData */
        protected $appData;
-       /** @var IClientService */
-       protected $clientService;
-       /** @var ITimeFactory */
-       protected $timeFactory;
-       /** @var IConfig */
-       protected $config;
-       /** @var LoggerInterface */
-       protected $logger;
-       /** @var IRegistry */
-       protected $registry;
 
        /** @var string */
        protected $fileName;
@@ -67,18 +57,15 @@ abstract class Fetcher {
        /** @var ?string */
        protected $channel = null;
 
-       public function __construct(Factory $appDataFactory,
-               IClientService $clientService,
-               ITimeFactory $timeFactory,
-               IConfig $config,
-               LoggerInterface $logger,
-               IRegistry $registry) {
+       public function __construct(
+               Factory $appDataFactory,
+               protected IClientService $clientService,
+               protected ITimeFactory $timeFactory,
+               protected IConfig $config,
+               protected LoggerInterface $logger,
+               protected IRegistry $registry,
+       ) {
                $this->appData = $appDataFactory->get('appstore');
-               $this->clientService = $clientService;
-               $this->timeFactory = $timeFactory;
-               $this->config = $config;
-               $this->logger = $logger;
-               $this->registry = $registry;
        }
 
        /**
index d41ca1770f056373185f9f4031acf0e559cd174b..bcdae1984cf00ce01e2cba43471f5285bbdf15ca 100644 (file)
 namespace OC\App\AppStore\Version;
 
 class Version {
-       /** @var string */
-       private $minVersion;
-       /** @var string */
-       private $maxVersion;
 
        /**
         * @param string $minVersion
         * @param string $maxVersion
         */
-       public function __construct($minVersion, $maxVersion) {
-               $this->minVersion = $minVersion;
-               $this->maxVersion = $maxVersion;
+       public function __construct(
+               private string $minVersion,
+               private string $maxVersion,
+       ) {
        }
 
        /**
index 3bdc551ea5afa9d2386afe5092ce43601f454e4b..2974e31dc5d0dec18b8aa3a7999189f95578f88f 100644 (file)
@@ -33,10 +33,6 @@ namespace OC\App;
 use OCP\IL10N;
 
 class DependencyAnalyzer {
-       /** @var Platform */
-       private $platform;
-       /** @var \OCP\IL10N */
-       private $l;
        /** @var array */
        private $appInfo;
 
@@ -44,9 +40,10 @@ class DependencyAnalyzer {
         * @param Platform $platform
         * @param \OCP\IL10N $l
         */
-       public function __construct(Platform $platform, IL10N $l) {
-               $this->platform = $platform;
-               $this->l = $l;
+       public function __construct(
+               private Platform $platform,
+               private IL10N $l,
+       ) {
        }
 
        /**
index 79d051fd2a1f615235e55a714cdccac1bc9c9abf..1efb0071bd30ec80c6507d68b2fe29431cfc985c 100644 (file)
@@ -34,14 +34,13 @@ use function libxml_disable_entity_loader;
 use function simplexml_load_string;
 
 class InfoParser {
-       /** @var \OCP\ICache|null */
-       private $cache;
 
        /**
         * @param ICache|null $cache
         */
-       public function __construct(ICache $cache = null) {
-               $this->cache = $cache;
+       public function __construct(
+               private ?ICache $cache = null,
+       ) {
        }
 
        /**
index daff247d1bd7d101cf8a8bb07422b579b59a3729..3631a3d1cb93dd674d2f9874028c9fb9db39751f 100644 (file)
@@ -36,10 +36,10 @@ use OCP\IConfig;
  * @package OC\App
  */
 class Platform {
-       private IConfig $config;
 
-       public function __construct(IConfig $config) {
-               $this->config = $config;
+       public function __construct(
+               private IConfig $config,
+       ) {
        }
 
        public function getPhpVersion(): string {