diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-02-23 19:24:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 19:24:32 +0100 |
commit | c4975b363e553be9c8c31fc787733eff7f9e7396 (patch) | |
tree | 5ea1d99822c06d2bc2043d948cb30fc1d1e4ca3d /lib | |
parent | d0f7156c96f4546929cb315ed3304c01cce1704e (diff) | |
parent | cf17db2fe620e7105575b08c69b8c09899eba049 (diff) | |
download | nextcloud-server-c4975b363e553be9c8c31fc787733eff7f9e7396.tar.gz nextcloud-server-c4975b363e553be9c8c31fc787733eff7f9e7396.zip |
Merge pull request #39299 from shdehnavi/refactor_lib_private_app
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/AppManager.php | 31 | ||||
-rw-r--r-- | lib/private/App/AppStore/Bundles/Bundle.php | 8 | ||||
-rw-r--r-- | lib/private/App/AppStore/Bundles/BundleFetcher.php | 7 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppFetcher.php | 14 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/CategoryFetcher.php | 6 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 29 | ||||
-rw-r--r-- | lib/private/App/AppStore/Version/Version.php | 12 | ||||
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 11 | ||||
-rw-r--r-- | lib/private/App/InfoParser.php | 8 | ||||
-rw-r--r-- | lib/private/App/Platform.php | 7 |
10 files changed, 44 insertions, 89 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 60e55a314d6..5eeb7ef1fbd 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -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, + ) { } /** diff --git a/lib/private/App/AppStore/Bundles/Bundle.php b/lib/private/App/AppStore/Bundles/Bundle.php index dfc93fdfaa2..fb86edff559 100644 --- a/lib/private/App/AppStore/Bundles/Bundle.php +++ b/lib/private/App/AppStore/Bundles/Bundle.php @@ -26,14 +26,12 @@ 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, + ) { } /** diff --git a/lib/private/App/AppStore/Bundles/BundleFetcher.php b/lib/private/App/AppStore/Bundles/BundleFetcher.php index 0d2bb61495f..7ac70591e8a 100644 --- a/lib/private/App/AppStore/Bundles/BundleFetcher.php +++ b/lib/private/App/AppStore/Bundles/BundleFetcher.php @@ -27,10 +27,9 @@ 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, + ) { } /** diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index f9fbd05855b..bb1a0e89484 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -39,12 +39,6 @@ use OCP\Support\Subscription\IRegistry; use Psr\Log\LoggerInterface; class AppFetcher extends Fetcher { - /** @var CompareVersion */ - private $compareVersion; - - /** @var IRegistry */ - protected $registry; - /** @var bool */ private $ignoreMaxVersion; @@ -52,9 +46,10 @@ class AppFetcher extends Fetcher { IClientService $clientService, ITimeFactory $timeFactory, IConfig $config, - CompareVersion $compareVersion, + private CompareVersion $compareVersion, LoggerInterface $logger, - IRegistry $registry) { + protected IRegistry $registry, + ) { parent::__construct( $appDataFactory, $clientService, @@ -64,9 +59,6 @@ class AppFetcher extends Fetcher { $registry ); - $this->compareVersion = $compareVersion; - $this->registry = $registry; - $this->fileName = 'apps.json'; $this->endpointName = 'apps.json'; $this->ignoreMaxVersion = true; diff --git a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php index d1bbe4f7b04..9b84d2a6196 100644 --- a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php +++ b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php @@ -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, diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index a693804f50f..3fc5fd07573 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -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; } /** diff --git a/lib/private/App/AppStore/Version/Version.php b/lib/private/App/AppStore/Version/Version.php index d41ca1770f0..5bd0226528f 100644 --- a/lib/private/App/AppStore/Version/Version.php +++ b/lib/private/App/AppStore/Version/Version.php @@ -23,18 +23,14 @@ 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, + ) { } /** diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 3bdc551ea5a..2974e31dc5d 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -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, + ) { } /** diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index 79d051fd2a1..2461d587bbd 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -34,14 +34,12 @@ 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, + ) { } /** diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php index daff247d1bd..c5565e9e0c2 100644 --- a/lib/private/App/Platform.php +++ b/lib/private/App/Platform.php @@ -36,10 +36,9 @@ 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 { |