summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-25 23:16:13 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-29 12:03:47 +0100
commiteb51f06a3b9e42686f462b9f7a56411d3fe6cb27 (patch)
tree0d96c86c4489b4e3fe60bcceaeb6759d856a36e9 /apps/files_external/lib
parent1d8b90b8d3c8a85104d223b7f1d5693280370774 (diff)
downloadnextcloud-server-eb51f06a3b9e42686f462b9f7a56411d3fe6cb27.tar.gz
nextcloud-server-eb51f06a3b9e42686f462b9f7a56411d3fe6cb27.zip
Use ::class statement instead of string
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/AppInfo/Application.php74
-rw-r--r--apps/files_external/lib/config.php20
2 files changed, 62 insertions, 32 deletions
diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php
index 266665a58aa..e32828fbf4e 100644
--- a/apps/files_external/lib/AppInfo/Application.php
+++ b/apps/files_external/lib/AppInfo/Application.php
@@ -35,6 +35,30 @@ use \OCP\IContainer;
use \OCA\Files_External\Service\BackendService;
use \OCA\Files_External\Lib\Config\IBackendProvider;
use \OCA\Files_External\Lib\Config\IAuthMechanismProvider;
+use OCA\Files_External\Lib\Auth\AmazonS3\AccessKey;
+use OCA\Files_External\Lib\Auth\OpenStack\Rackspace;
+use OCA\Files_External\Lib\Auth\OpenStack\OpenStack;
+use OCA\Files_External\Lib\Auth\PublicKey\RSA;
+use OCA\Files_External\Lib\Auth\OAuth2\OAuth2;
+use OCA\Files_External\Lib\Auth\OAuth1\OAuth1;
+use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
+use OCA\Files_External\Lib\Auth\Password\UserProvided;
+use OCA\Files_External\Lib\Auth\Password\LoginCredentials;
+use OCA\Files_External\Lib\Auth\Password\SessionCredentials;
+use OCA\Files_External\Lib\Auth\Password\Password;
+use OCA\Files_External\Lib\Auth\Builtin;
+use OCA\Files_External\Lib\Auth\NullMechanism;
+use OCA\Files_External\Lib\Backend\SMB_OC;
+use OCA\Files_External\Lib\Backend\SMB;
+use OCA\Files_External\Lib\Backend\SFTP_Key;
+use OCA\Files_External\Lib\Backend\Swift;
+use OCA\Files_External\Lib\Backend\AmazonS3;
+use OCA\Files_External\Lib\Backend\SFTP;
+use OCA\Files_External\Lib\Backend\OwnCloud;
+use OCA\Files_External\Lib\Backend\DAV;
+use OCA\Files_External\Lib\Backend\FTP;
+use OCA\Files_External\Lib\Backend\Local;
+use OCP\Files\Config\IUserMountCache;
/**
* @package OCA\Files_External\AppInfo
@@ -46,11 +70,11 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
$container = $this->getContainer();
- $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) {
+ $container->registerService(IUserMountCache::class, function (IAppContainer $c) {
return $c->getServer()->query('UserMountCache');
});
- $backendService = $container->query('OCA\\Files_External\\Service\\BackendService');
+ $backendService = $container->query(BackendService::class);
$backendService->registerBackendProvider($this);
$backendService->registerAuthMechanismProvider($this);
@@ -71,16 +95,16 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
$container = $this->getContainer();
$backends = [
- $container->query('OCA\Files_External\Lib\Backend\Local'),
- $container->query('OCA\Files_External\Lib\Backend\FTP'),
- $container->query('OCA\Files_External\Lib\Backend\DAV'),
- $container->query('OCA\Files_External\Lib\Backend\OwnCloud'),
- $container->query('OCA\Files_External\Lib\Backend\SFTP'),
- $container->query('OCA\Files_External\Lib\Backend\AmazonS3'),
- $container->query('OCA\Files_External\Lib\Backend\Swift'),
- $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'),
- $container->query('OCA\Files_External\Lib\Backend\SMB'),
- $container->query('OCA\Files_External\Lib\Backend\SMB_OC'),
+ $container->query(Local::class),
+ $container->query(FTP::class),
+ $container->query(DAV::class),
+ $container->query(OwnCloud::class),
+ $container->query(SFTP::class),
+ $container->query(AmazonS3::class),
+ $container->query(Swift::class),
+ $container->query(SFTP_Key::class),
+ $container->query(SMB::class),
+ $container->query(SMB_OC::class),
];
return $backends;
@@ -94,33 +118,33 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
return [
// AuthMechanism::SCHEME_NULL mechanism
- $container->query('OCA\Files_External\Lib\Auth\NullMechanism'),
+ $container->query(NullMechanism::class),
// AuthMechanism::SCHEME_BUILTIN mechanism
- $container->query('OCA\Files_External\Lib\Auth\Builtin'),
+ $container->query(Builtin::class),
// AuthMechanism::SCHEME_PASSWORD mechanisms
- $container->query('OCA\Files_External\Lib\Auth\Password\Password'),
- $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'),
- $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'),
- $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'),
- $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'),
+ $container->query(Password::class),
+ $container->query(SessionCredentials::class),
+ $container->query(LoginCredentials::class),
+ $container->query(UserProvided::class),
+ $container->query(GlobalAuth::class),
// AuthMechanism::SCHEME_OAUTH1 mechanisms
- $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'),
+ $container->query(OAuth1::class),
// AuthMechanism::SCHEME_OAUTH2 mechanisms
- $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'),
+ $container->query(OAuth2::class),
// AuthMechanism::SCHEME_PUBLICKEY mechanisms
- $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'),
+ $container->query(RSA::class),
// AuthMechanism::SCHEME_OPENSTACK mechanisms
- $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'),
- $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'),
+ $container->query(OpenStack::class),
+ $container->query(Rackspace::class),
// Specialized mechanisms
- $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'),
+ $container->query(AccessKey::class),
];
}
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index ae04daf4f31..5238eaa42b2 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -41,6 +41,12 @@ use \OCA\Files_External\Lib\Backend\LegacyBackend;
use \OCA\Files_External\Lib\StorageConfig;
use \OCA\Files_External\Lib\Backend\Backend;
use \OCP\Files\StorageNotAvailableException;
+use OCA\Files_External\Service\BackendService;
+use OCA\Files_External\Lib\Auth\Builtin;
+use OCA\Files_External\Service\UserGlobalStoragesService;
+use OCP\IUserManager;
+use OCA\Files_External\Service\GlobalStoragesService;
+use OCA\Files_External\Service\UserStoragesService;
/**
* Class to configure mount.json globally and for users
@@ -66,8 +72,8 @@ class OC_Mount_Config {
* @deprecated 8.2.0 use \OCA\Files_External\Service\BackendService::registerBackend()
*/
public static function registerBackend($class, $definition) {
- $backendService = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService');
- $auth = self::$app->getContainer()->query('OCA\Files_External\Lib\Auth\Builtin');
+ $backendService = self::$app->getContainer()->query(BackendService::class);
+ $auth = self::$app->getContainer()->query(Builtin::class);
$backendService->registerBackend(new LegacyBackend($class, $definition, $auth));
@@ -86,9 +92,9 @@ class OC_Mount_Config {
public static function getAbsoluteMountPoints($uid) {
$mountPoints = array();
- $userGlobalStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserGlobalStoragesService');
- $userStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService');
- $user = self::$app->getContainer()->query('OCP\IUserManager')->get($uid);
+ $userGlobalStoragesService = self::$app->getContainer()->query(UserGlobalStoragesService::class);
+ $userStoragesService = self::$app->getContainer()->query(UserStoragesService::class);
+ $user = self::$app->getContainer()->query(IUserManager::class)->get($uid);
$userGlobalStoragesService->setUser($user);
$userStoragesService->setUser($user);
@@ -127,7 +133,7 @@ class OC_Mount_Config {
*/
public static function getSystemMountPoints() {
$mountPoints = [];
- $service = self::$app->getContainer()->query('OCA\Files_External\Service\GlobalStoragesService');
+ $service = self::$app->getContainer()->query(GlobalStoragesService::class);
foreach ($service->getStorages() as $storage) {
$mountPoints[] = self::prepareMountPointEntry($storage, false);
@@ -145,7 +151,7 @@ class OC_Mount_Config {
*/
public static function getPersonalMountPoints() {
$mountPoints = [];
- $service = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService');
+ $service = self::$app->getContainer()->query(UserStoragesService::class);
foreach ($service->getStorages() as $storage) {
$mountPoints[] = self::prepareMountPointEntry($storage, true);