diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/files_external | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_external')
85 files changed, 63 insertions, 162 deletions
diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php index cc587dcd80f..0a81f227b15 100644 --- a/apps/files_external/lib/AppInfo/Application.php +++ b/apps/files_external/lib/AppInfo/Application.php @@ -181,5 +181,4 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide $container->query(KerberosAuth::class), ]; } - } diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php index 8d5f6990318..242f408a54d 100644 --- a/apps/files_external/lib/Command/Export.php +++ b/apps/files_external/lib/Command/Export.php @@ -29,7 +29,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Export extends ListCommand { - protected function configure() { $this ->setName('files_external:export') diff --git a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php index b736216842b..cd57f973a21 100644 --- a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php +++ b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php @@ -63,12 +63,12 @@ trait SimpleSubstitutionTrait { */ protected function checkPlaceholder(): void { $this->sanitizedPlaceholder = trim(strtolower($this->placeholder)); - if(!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { + if (!(bool)\preg_match('/^[a-z0-9]*$/', $this->sanitizedPlaceholder)) { throw new \RuntimeException(sprintf( 'Invalid placeholder %s, only [a-z0-9] are allowed', $this->sanitizedPlaceholder )); } - if($this->sanitizedPlaceholder === '') { + if ($this->sanitizedPlaceholder === '') { throw new \RuntimeException('Invalid empty placeholder'); } } @@ -79,7 +79,7 @@ trait SimpleSubstitutionTrait { * @return mixed */ protected function substituteIfString($value, string $replacement) { - if(is_string($value)) { + if (is_string($value)) { return str_ireplace('$' . $this->sanitizedPlaceholder, $replacement, $value); } return $value; diff --git a/apps/files_external/lib/Config/UserContext.php b/apps/files_external/lib/Config/UserContext.php index 94ac02c545b..fe65c2f2bf6 100644 --- a/apps/files_external/lib/Config/UserContext.php +++ b/apps/files_external/lib/Config/UserContext.php @@ -67,24 +67,24 @@ class UserContext { if ($this->userId !== null) { return $this->userId; } - if($this->session && $this->session->getUser() !== null) { + if ($this->session && $this->session->getUser() !== null) { return $this->session->getUser()->getUID(); } try { $shareToken = $this->request->getParam('token'); $share = $this->shareManager->getShareByToken($shareToken); return $share->getShareOwner(); - } catch (ShareNotFound $e) {} + } catch (ShareNotFound $e) { + } return null; } protected function getUser(): ?IUser { $userId = $this->getUserId(); - if($userId !== null) { + if ($userId !== null) { return $this->userManager->get($userId); } return null; } - } diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php index 4922143fa63..bc324931a7e 100644 --- a/apps/files_external/lib/Config/UserPlaceholderHandler.php +++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php @@ -35,7 +35,7 @@ class UserPlaceholderHandler extends UserContext implements IConfigHandler { public function handle($optionValue) { $this->placeholder = 'user'; $uid = $this->getUserId(); - if($uid === null) { + if ($uid === null) { return $optionValue; } return $this->processInput($optionValue, $uid); diff --git a/apps/files_external/lib/Controller/ApiController.php b/apps/files_external/lib/Controller/ApiController.php index 9da869ce5a8..6418e5d73ad 100644 --- a/apps/files_external/lib/Controller/ApiController.php +++ b/apps/files_external/lib/Controller/ApiController.php @@ -100,7 +100,7 @@ class ApiController extends OCSController { $user = $this->userSession->getUser()->getUID(); $mounts = \OC_Mount_Config::getAbsoluteMountPoints($user); - foreach($mounts as $mountPoint => $mount) { + foreach ($mounts as $mountPoint => $mount) { $entries[] = $this->formatMount($mountPoint, $mount); } diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php index 398399d820d..d42facb18ac 100644 --- a/apps/files_external/lib/Controller/GlobalStoragesController.php +++ b/apps/files_external/lib/Controller/GlobalStoragesController.php @@ -183,8 +183,5 @@ class GlobalStoragesController extends StoragesController { $this->formatStorageForUI($storage), Http::STATUS_OK ); - } - - } diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index d087a5e3900..a3a2712520a 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -363,5 +363,4 @@ abstract class StoragesController extends Controller { return new DataResponse([], Http::STATUS_NO_CONTENT); } - } diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 3773461d00c..1f7eb595701 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -186,7 +186,6 @@ class UserGlobalStoragesController extends StoragesController { $this->formatStorageForUI($storage), Http::STATUS_OK ); - } /** @@ -206,5 +205,4 @@ class UserGlobalStoragesController extends StoragesController { } } } - } diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index 787e7affaf5..8c588fc967e 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -211,7 +211,6 @@ class UserStoragesController extends StoragesController { $this->formatStorageForUI($storage), Http::STATUS_OK ); - } /** @@ -224,5 +223,4 @@ class UserStoragesController extends StoragesController { public function destroy($id) { return parent::destroy($id); } - } diff --git a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php index 78c9241a83c..4822789ba2b 100644 --- a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php +++ b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php @@ -32,7 +32,6 @@ use OCP\IL10N; * Amazon S3 access key authentication */ class AccessKey extends AuthMechanism { - const SCHEME_AMAZONS3_ACCESSKEY = 'amazons3_accesskey'; public function __construct(IL10N $l) { @@ -46,5 +45,4 @@ class AccessKey extends AuthMechanism { ->setType(DefinitionParameter::VALUE_PASSWORD), ]); } - } diff --git a/apps/files_external/lib/Lib/Auth/AuthMechanism.php b/apps/files_external/lib/Lib/Auth/AuthMechanism.php index cd8f8242e30..c13774ea5e0 100644 --- a/apps/files_external/lib/Lib/Auth/AuthMechanism.php +++ b/apps/files_external/lib/Lib/Auth/AuthMechanism.php @@ -118,5 +118,4 @@ class AuthMechanism implements \JsonSerializable { return $this->validateStorageDefinition($storage); } - } diff --git a/apps/files_external/lib/Lib/Auth/Builtin.php b/apps/files_external/lib/Lib/Auth/Builtin.php index 87c98d6957b..0f3d5342c6e 100644 --- a/apps/files_external/lib/Lib/Auth/Builtin.php +++ b/apps/files_external/lib/Lib/Auth/Builtin.php @@ -29,7 +29,6 @@ use OCP\IL10N; * Builtin authentication mechanism, for legacy backends */ class Builtin extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('builtin::builtin') @@ -37,5 +36,4 @@ class Builtin extends AuthMechanism { ->setText($l->t('Builtin')) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/InvalidAuth.php b/apps/files_external/lib/Lib/Auth/InvalidAuth.php index 8aff7bc163d..61302125b4f 100644 --- a/apps/files_external/lib/Lib/Auth/InvalidAuth.php +++ b/apps/files_external/lib/Lib/Auth/InvalidAuth.php @@ -41,5 +41,4 @@ class InvalidAuth extends AuthMechanism { ->setText('Unknown auth mechanism backend ' . $invalidId) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/NullMechanism.php b/apps/files_external/lib/Lib/Auth/NullMechanism.php index 57b9774b441..e7a30ea613e 100644 --- a/apps/files_external/lib/Lib/Auth/NullMechanism.php +++ b/apps/files_external/lib/Lib/Auth/NullMechanism.php @@ -29,7 +29,6 @@ use OCP\IL10N; * Null authentication mechanism */ class NullMechanism extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('null::null') @@ -37,5 +36,4 @@ class NullMechanism extends AuthMechanism { ->setText($l->t('None')) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php index 26b8c6348db..d93a09292ad 100644 --- a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php +++ b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php @@ -32,7 +32,6 @@ use OCP\IL10N; * OAuth1 authentication */ class OAuth1 extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('oauth1::oauth1') @@ -52,5 +51,4 @@ class OAuth1 extends AuthMechanism { ->addCustomJs('oauth1') ; } - } diff --git a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php index 8fbe412c2cf..17add489776 100644 --- a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php +++ b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php @@ -32,7 +32,6 @@ use OCP\IL10N; * OAuth2 authentication */ class OAuth2 extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('oauth2::oauth2') @@ -50,5 +49,4 @@ class OAuth2 extends AuthMechanism { ->addCustomJs('oauth2') ; } - } diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php index 688911b7d52..723ecc5068b 100644 --- a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php +++ b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php @@ -33,7 +33,6 @@ use OCP\IL10N; * OpenStack Keystone authentication */ class OpenStackV2 extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('openstack::openstack') @@ -48,5 +47,4 @@ class OpenStackV2 extends AuthMechanism { ]) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php index 75f2fc3173c..c8a78f52c41 100644 --- a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php +++ b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php @@ -36,7 +36,6 @@ use OCP\IL10N; * OpenStack Keystone authentication */ class OpenStackV3 extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('openstack::openstackv3') @@ -51,5 +50,4 @@ class OpenStackV3 extends AuthMechanism { ]) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php index 2d3fbcdcc73..4fa2a07440c 100644 --- a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php +++ b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php @@ -32,7 +32,6 @@ use OCP\IL10N; * Rackspace authentication */ class Rackspace extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('openstack::rackspace') @@ -45,5 +44,4 @@ class Rackspace extends AuthMechanism { ]) ; } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php index 8051e863609..de6e34c4443 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -36,7 +36,6 @@ use OCP\Security\ICredentialsManager; * Global Username and Password */ class GlobalAuth extends AuthMechanism { - const CREDENTIALS_IDENTIFIER = 'password::global'; /** @var ICredentialsManager */ @@ -86,5 +85,4 @@ class GlobalAuth extends AuthMechanism { $storage->setBackendOption('password', $credentials['password']); } } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php index fe5f11ca203..0165bb6d077 100644 --- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php @@ -35,7 +35,6 @@ use OCP\Security\ICredentialsManager; * Username and password from login credentials, saved in DB */ class LoginCredentials extends AuthMechanism { - const CREDENTIALS_IDENTIFIER = 'password::logincredentials/credentials'; /** @var ISession */ @@ -87,5 +86,4 @@ class LoginCredentials extends AuthMechanism { $storage->setBackendOption('user', $credentials['user']); $storage->setBackendOption('password', $credentials['password']); } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/Password.php b/apps/files_external/lib/Lib/Auth/Password/Password.php index 4429379fda1..79be4282014 100644 --- a/apps/files_external/lib/Lib/Auth/Password/Password.php +++ b/apps/files_external/lib/Lib/Auth/Password/Password.php @@ -32,7 +32,6 @@ use OCP\IL10N; * Basic password authentication mechanism */ class Password extends AuthMechanism { - public function __construct(IL10N $l) { $this ->setIdentifier('password::password') @@ -44,5 +43,4 @@ class Password extends AuthMechanism { ->setType(DefinitionParameter::VALUE_PASSWORD), ]); } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php index 1e899c79d7e..47fb044f885 100644 --- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php @@ -65,5 +65,4 @@ class SessionCredentials extends AuthMechanism { public function wrapStorage(Storage $storage) { return new SessionStorageWrapper(['storage' => $storage]); } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php index 80829b6a07c..ea39cabb2d0 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php @@ -40,7 +40,6 @@ use OCP\Security\ICredentialsManager; * User provided Global Username and Password */ class UserGlobalAuth extends AuthMechanism { - private const CREDENTIALS_IDENTIFIER = 'password::global'; /** @var ICredentialsManager */ @@ -59,7 +58,7 @@ class UserGlobalAuth extends AuthMechanism { public function saveBackendOptions(IUser $user, $id, $backendOptions) { // backendOptions are set when invoked via Files app // but they are not set when invoked via ext storage settings - if(!isset($backendOptions['user']) && !isset($backendOptions['password'])) { + if (!isset($backendOptions['user']) && !isset($backendOptions['password'])) { return; } // make sure we're not setting any unexpected keys @@ -83,5 +82,4 @@ class UserGlobalAuth extends AuthMechanism { $storage->setBackendOption('password', $credentials['password']); } } - } diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php index 0594730d1b8..552b707b544 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php @@ -37,7 +37,6 @@ use OCP\Security\ICredentialsManager; * User provided Username and Password */ class UserProvided extends AuthMechanism implements IUserProvided { - const CREDENTIALS_IDENTIFIER_PREFIX = 'password::userprovided/'; /** @var ICredentialsManager */ @@ -85,5 +84,4 @@ class UserProvided extends AuthMechanism implements IUserProvided { $storage->setBackendOption('user', $credentials['user']); $storage->setBackendOption('password', $credentials['password']); } - } diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php index 2135b758818..f3e6c891e73 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -83,5 +83,4 @@ class RSA extends AuthMechanism { return $rsa->createKey($keyLength); } - } diff --git a/apps/files_external/lib/Lib/Backend/AmazonS3.php b/apps/files_external/lib/Lib/Backend/AmazonS3.php index dff2cca9f23..5473975f372 100644 --- a/apps/files_external/lib/Lib/Backend/AmazonS3.php +++ b/apps/files_external/lib/Lib/Backend/AmazonS3.php @@ -31,7 +31,6 @@ use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; use OCP\IL10N; class AmazonS3 extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, AccessKey $legacyAuth) { @@ -59,5 +58,4 @@ class AmazonS3 extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/Backend.php b/apps/files_external/lib/Lib/Backend/Backend.php index 4b3d5c31011..69d41f85ecf 100644 --- a/apps/files_external/lib/Lib/Backend/Backend.php +++ b/apps/files_external/lib/Lib/Backend/Backend.php @@ -57,7 +57,6 @@ use OCA\Files_External\Lib\VisibilityTrait; * Object can affect storage mounting */ class Backend implements \JsonSerializable { - use VisibilityTrait; use FrontendDefinitionTrait; use PriorityTrait; @@ -162,5 +161,4 @@ class Backend implements \JsonSerializable { public function validateStorage(StorageConfig $storage) { return $this->validateStorageDefinition($storage); } - } diff --git a/apps/files_external/lib/Lib/Backend/DAV.php b/apps/files_external/lib/Lib/Backend/DAV.php index c7c13143628..0991c5ac1df 100644 --- a/apps/files_external/lib/Lib/Backend/DAV.php +++ b/apps/files_external/lib/Lib/Backend/DAV.php @@ -31,7 +31,6 @@ use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; use OCP\IL10N; class DAV extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, Password $legacyAuth) { @@ -51,5 +50,4 @@ class DAV extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/FTP.php b/apps/files_external/lib/Lib/Backend/FTP.php index 63be8fa5696..bc35a5d386a 100644 --- a/apps/files_external/lib/Lib/Backend/FTP.php +++ b/apps/files_external/lib/Lib/Backend/FTP.php @@ -31,7 +31,6 @@ use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; use OCP\IL10N; class FTP extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, Password $legacyAuth) { @@ -51,5 +50,4 @@ class FTP extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/LegacyBackend.php b/apps/files_external/lib/Lib/Backend/LegacyBackend.php index a1d6bbfad63..87dabda8bb6 100644 --- a/apps/files_external/lib/Lib/Backend/LegacyBackend.php +++ b/apps/files_external/lib/Lib/Backend/LegacyBackend.php @@ -32,7 +32,6 @@ use OCA\Files_External\Lib\MissingDependency; * Legacy compatibility for OC_Mount_Config::registerBackend() */ class LegacyBackend extends Backend { - use LegacyDependencyCheckPolyfill { LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies; } @@ -101,5 +100,4 @@ class LegacyBackend extends Backend { } return []; } - } diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php index b22b0db5749..67b50e127e9 100644 --- a/apps/files_external/lib/Lib/Backend/Local.php +++ b/apps/files_external/lib/Lib/Backend/Local.php @@ -31,7 +31,6 @@ use OCA\Files_External\Service\BackendService; use OCP\IL10N; class Local extends Backend { - public function __construct(IL10N $l, NullMechanism $legacyAuth) { $this ->setIdentifier('local') @@ -47,5 +46,4 @@ class Local extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/OwnCloud.php b/apps/files_external/lib/Lib/Backend/OwnCloud.php index 1221cf9ef63..876f8709cc3 100644 --- a/apps/files_external/lib/Lib/Backend/OwnCloud.php +++ b/apps/files_external/lib/Lib/Backend/OwnCloud.php @@ -31,7 +31,6 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCP\IL10N; class OwnCloud extends Backend { - public function __construct(IL10N $l, Password $legacyAuth) { $this ->setIdentifier('owncloud') @@ -49,5 +48,4 @@ class OwnCloud extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/SFTP.php b/apps/files_external/lib/Lib/Backend/SFTP.php index 88e9ce14b4a..a7f97c6b79a 100644 --- a/apps/files_external/lib/Lib/Backend/SFTP.php +++ b/apps/files_external/lib/Lib/Backend/SFTP.php @@ -30,7 +30,6 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCP\IL10N; class SFTP extends Backend { - public function __construct(IL10N $l, Password $legacyAuth) { $this ->setIdentifier('sftp') @@ -47,5 +46,4 @@ class SFTP extends Backend { ->setLegacyAuthMechanism($legacyAuth) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/SFTP_Key.php b/apps/files_external/lib/Lib/Backend/SFTP_Key.php index a9420a909e8..924d6a62ffe 100644 --- a/apps/files_external/lib/Lib/Backend/SFTP_Key.php +++ b/apps/files_external/lib/Lib/Backend/SFTP_Key.php @@ -30,7 +30,6 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCP\IL10N; class SFTP_Key extends Backend { - public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { $this ->setIdentifier('\OC\Files\Storage\SFTP_Key') @@ -46,5 +45,4 @@ class SFTP_Key extends Backend { ->deprecateTo($sftpBackend) ; } - } diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php index 20501e5bfe1..eefeb137bf8 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -38,7 +38,6 @@ use OCP\IL10N; use OCP\IUser; class SMB extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, Password $legacyAuth) { @@ -90,5 +89,4 @@ class SMB extends Backend { $storage->setBackendOption('auth', $smbAuth); } - } diff --git a/apps/files_external/lib/Lib/Backend/SMB_OC.php b/apps/files_external/lib/Lib/Backend/SMB_OC.php index 9c28a52e049..439d85164cc 100644 --- a/apps/files_external/lib/Lib/Backend/SMB_OC.php +++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php @@ -37,7 +37,6 @@ use OCP\IUser; * Deprecated SMB_OC class - use SMB with the password::sessioncredentials auth mechanism */ class SMB_OC extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) { @@ -69,5 +68,4 @@ class SMB_OC extends Backend { $storage->setBackendOption('share', $share); } } - } diff --git a/apps/files_external/lib/Lib/Backend/Swift.php b/apps/files_external/lib/Lib/Backend/Swift.php index 5d4d5ec1408..25ed72337a1 100644 --- a/apps/files_external/lib/Lib/Backend/Swift.php +++ b/apps/files_external/lib/Lib/Backend/Swift.php @@ -33,7 +33,6 @@ use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; use OCP\IL10N; class Swift extends Backend { - use LegacyDependencyCheckPolyfill; public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) { @@ -60,5 +59,4 @@ class Swift extends Backend { }) ; } - } diff --git a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php index 674f3ccf371..e8f142c01da 100644 --- a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php +++ b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php @@ -36,5 +36,4 @@ interface IAuthMechanismProvider { * @return AuthMechanism[] */ public function getAuthMechanisms(); - } diff --git a/apps/files_external/lib/Lib/Config/IBackendProvider.php b/apps/files_external/lib/Lib/Config/IBackendProvider.php index fd0deadcb23..7757f204c8c 100644 --- a/apps/files_external/lib/Lib/Config/IBackendProvider.php +++ b/apps/files_external/lib/Lib/Config/IBackendProvider.php @@ -36,5 +36,4 @@ interface IBackendProvider { * @return Backend[] */ public function getBackends(); - } diff --git a/apps/files_external/lib/Lib/DependencyTrait.php b/apps/files_external/lib/Lib/DependencyTrait.php index df7e29c7a79..b88a111392a 100644 --- a/apps/files_external/lib/Lib/DependencyTrait.php +++ b/apps/files_external/lib/Lib/DependencyTrait.php @@ -35,5 +35,4 @@ trait DependencyTrait { public function checkDependencies() { return []; // no dependencies by default } - } diff --git a/apps/files_external/lib/Lib/IdentifierTrait.php b/apps/files_external/lib/Lib/IdentifierTrait.php index 9aa6095c25e..6bdde976753 100644 --- a/apps/files_external/lib/Lib/IdentifierTrait.php +++ b/apps/files_external/lib/Lib/IdentifierTrait.php @@ -100,5 +100,4 @@ trait IdentifierTrait { } return $data; } - } diff --git a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php index cf720b35a5b..787872511f9 100644 --- a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php +++ b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php @@ -64,5 +64,4 @@ trait LegacyDependencyCheckPolyfill { return $ret; } - } diff --git a/apps/files_external/lib/Lib/PriorityTrait.php b/apps/files_external/lib/Lib/PriorityTrait.php index f6cfb7c4dfb..12e30de231f 100644 --- a/apps/files_external/lib/Lib/PriorityTrait.php +++ b/apps/files_external/lib/Lib/PriorityTrait.php @@ -57,5 +57,4 @@ trait PriorityTrait { public static function priorityCompare(PriorityTrait $a, PriorityTrait $b) { return ($a->getPriority() - $b->getPriority()); } - } diff --git a/apps/files_external/lib/Lib/SessionStorageWrapper.php b/apps/files_external/lib/Lib/SessionStorageWrapper.php index de082ccc3ad..2b8f2b8613b 100644 --- a/apps/files_external/lib/Lib/SessionStorageWrapper.php +++ b/apps/files_external/lib/Lib/SessionStorageWrapper.php @@ -39,5 +39,4 @@ class SessionStorageWrapper extends PermissionsMask { $arguments['mask'] = Constants::PERMISSION_ALL & ~Constants::PERMISSION_SHARE; parent::__construct($arguments); } - } diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 99cfcb594a9..0fb520cf9d4 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -649,7 +649,6 @@ class AmazonS3 extends \OC\Files\Storage\Common { $path2 = $this->normalizePath($path2); if ($this->is_file($path1)) { - if ($this->copy($path1, $path2) === false) { return false; } @@ -659,7 +658,6 @@ class AmazonS3 extends \OC\Files\Storage\Common { return false; } } else { - if ($this->copy($path1, $path2) === false) { return false; } @@ -704,5 +702,4 @@ class AmazonS3 extends \OC\Files\Storage\Common { public static function checkDependencies() { return true; } - } diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 0015f3008ef..d514bd7b7b0 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -38,7 +38,7 @@ namespace OCA\Files_External\Lib\Storage; use Icewind\Streams\CallbackWrapper; use Icewind\Streams\RetryWrapper; -class FTP extends StreamWrapper{ +class FTP extends StreamWrapper { private $password; private $user; private $host; @@ -65,7 +65,6 @@ class FTP extends StreamWrapper{ } else { throw new \Exception('Creating FTP storage failed'); } - } public function getId() { @@ -93,8 +92,7 @@ class FTP extends StreamWrapper{ public function unlink($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } - else { + } else { $url = $this->constructUrl($path); $result = unlink($url); clearstatcache(true, $url); @@ -102,7 +100,7 @@ class FTP extends StreamWrapper{ } } public function fopen($path,$mode) { - switch($mode) { + switch ($mode) { case 'r': case 'rb': case 'w': @@ -154,5 +152,4 @@ class FTP extends StreamWrapper{ return ['ftp']; } } - } diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index 1738aacd258..d8e3ee321b7 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -55,19 +55,18 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag } $contextPath = ''; $hostSlashPos = strpos($host, '/'); - if ($hostSlashPos !== false){ + if ($hostSlashPos !== false) { $contextPath = substr($host, $hostSlashPos); $host = substr($host, 0, $hostSlashPos); } - if (substr($contextPath, -1) !== '/'){ + if (substr($contextPath, -1) !== '/') { $contextPath .= '/'; } - if (isset($params['root'])){ + if (isset($params['root'])) { $root = '/' . ltrim($params['root'], '/'); - } - else{ + } else { $root = '/'; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index 9682ebd4535..bc6cd663b6d 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -70,7 +70,7 @@ class SFTP extends \OC\Files\Storage\Common { } $parsed = parse_url($host); - if(is_array($parsed) && isset($parsed['port'])) { + if (is_array($parsed) && isset($parsed['port'])) { return [$parsed['host'], $parsed['port']]; } elseif (is_array($parsed)) { return [$parsed['host'], 22]; @@ -310,13 +310,13 @@ class SFTP extends \OC\Files\Storage\Common { $id = md5('sftp:' . $path); $dirStream = []; - foreach($list as $file) { + foreach ($list as $file) { if ($file !== '.' && $file !== '..') { $dirStream[] = $file; } } return IteratorDirectory::wrap($dirStream); - } catch(\Exception $e) { + } catch (\Exception $e) { return false; } } @@ -335,7 +335,6 @@ class SFTP extends \OC\Files\Storage\Common { return 'dir'; } } catch (\Exception $e) { - } return false; } @@ -368,7 +367,7 @@ class SFTP extends \OC\Files\Storage\Common { public function fopen($path, $mode) { try { $absPath = $this->absPath($path); - switch($mode) { + switch ($mode) { case 'r': case 'rb': if (!$this->file_exists($path)) { diff --git a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php index 455b4a7cf28..a3023d1a22b 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php @@ -200,5 +200,4 @@ class SFTPReadStream implements File { return false; } } - } diff --git a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php index b5bc3ab667d..50faf8f466c 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPWriteStream.php @@ -178,5 +178,4 @@ class SFTPWriteStream implements File { return false; } } - } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 506774d5cea..d010fb54840 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -185,7 +185,7 @@ class SMB extends Common implements INotifyStorage { } catch (ForbiddenException $e) { // with php-smbclient, this exceptions is thrown when the provided password is invalid. // Possible is also ForbiddenException with a different error code, so we check it. - if($e->getCode() === 1) { + if ($e->getCode() === 1) { $this->throwUnavailable($e); } throw $e; diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php index 5d85aaace6e..b77b9e0fe46 100644 --- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php +++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php @@ -126,5 +126,4 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common { public function stat($path) { return stat($this->constructUrl($path)); } - } diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index a928f5b75d9..96fb4f0ac9a 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -316,7 +316,6 @@ class Swift extends \OC\Files\Storage\Common { ]); return false; } - } public function stat($path) { @@ -505,7 +504,6 @@ class Swift extends \OC\Files\Storage\Common { ]); return false; } - } elseif ($fileType === 'dir') { try { $source = $this->fetchObject($path1 . '/'); @@ -533,7 +531,6 @@ class Swift extends \OC\Files\Storage\Common { $target = $path2 . '/' . $file; $this->copy($source, $target); } - } else { //file does not exist return false; @@ -625,5 +622,4 @@ class Swift extends \OC\Files\Storage\Common { public static function checkDependencies() { return true; } - } diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php index aba5d3247c8..5ed65918b22 100644 --- a/apps/files_external/lib/Lib/StorageConfig.php +++ b/apps/files_external/lib/Lib/StorageConfig.php @@ -215,10 +215,10 @@ class StorageConfig implements \JsonSerializable { * @param array $backendOptions backend options */ public function setBackendOptions($backendOptions) { - if($this->getBackend() instanceof Backend) { + if ($this->getBackend() instanceof Backend) { $parameters = $this->getBackend()->getParameters(); - foreach($backendOptions as $key => $value) { - if(isset($parameters[$key])) { + foreach ($backendOptions as $key => $value) { + if (isset($parameters[$key])) { switch ($parameters[$key]->getType()) { case \OCA\Files_External\Lib\DefinitionParameter::VALUE_BOOLEAN: $value = (bool)$value; diff --git a/apps/files_external/lib/Lib/StorageModifierTrait.php b/apps/files_external/lib/Lib/StorageModifierTrait.php index 2d7140e68a9..304eadb2254 100644 --- a/apps/files_external/lib/Lib/StorageModifierTrait.php +++ b/apps/files_external/lib/Lib/StorageModifierTrait.php @@ -64,5 +64,4 @@ trait StorageModifierTrait { public function wrapStorage(Storage $storage) { return $storage; } - } diff --git a/apps/files_external/lib/Lib/VisibilityTrait.php b/apps/files_external/lib/Lib/VisibilityTrait.php index a056891403e..dc4ba7b366f 100644 --- a/apps/files_external/lib/Lib/VisibilityTrait.php +++ b/apps/files_external/lib/Lib/VisibilityTrait.php @@ -134,5 +134,4 @@ trait VisibilityTrait { public function removeAllowedVisibility($allowedVisibility) { return $this->setAllowedVisibility($this->allowedVisibility & ~$allowedVisibility); } - } diff --git a/apps/files_external/lib/Migration/DummyUserSession.php b/apps/files_external/lib/Migration/DummyUserSession.php index 496c4dfa760..10ab505cd3b 100644 --- a/apps/files_external/lib/Migration/DummyUserSession.php +++ b/apps/files_external/lib/Migration/DummyUserSession.php @@ -70,5 +70,4 @@ class DummyUserSession implements IUserSession { public function setImpersonatingUserID(bool $useCurrentUser = true): void { //no OP } - } diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php index 6c2ea72b840..617b44651ae 100644 --- a/apps/files_external/lib/Service/BackendService.php +++ b/apps/files_external/lib/Service/BackendService.php @@ -111,7 +111,7 @@ class BackendService { private function callForRegistrations() { static $eventSent = false; - if(!$eventSent) { + if (!$eventSent) { \OC::$server->getEventDispatcher()->dispatch( 'OCA\\Files_External::loadAdditionalBackends', new GenericEvent() @@ -322,15 +322,15 @@ class BackendService { */ public function registerConfigHandler(string $placeholder, callable $configHandlerLoader) { $placeholder = trim(strtolower($placeholder)); - if(!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) { + if (!(bool)\preg_match('/^[a-z0-9]*$/', $placeholder)) { throw new \RuntimeException(sprintf( 'Invalid placeholder %s, only [a-z0-9] are allowed', $placeholder )); } - if($placeholder === '') { + if ($placeholder === '') { throw new \RuntimeException('Invalid empty placeholder'); } - if(isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) { + if (isset($this->configHandlerLoaders[$placeholder]) || isset($this->configHandlers[$placeholder])) { throw new \RuntimeException(sprintf('A handler is already registered for %s', $placeholder)); } $this->configHandlerLoaders[$placeholder] = $configHandlerLoader; @@ -341,7 +341,7 @@ class BackendService { $newLoaded = false; foreach ($this->configHandlerLoaders as $placeholder => $loader) { $handler = $loader(); - if(!$handler instanceof IConfigHandler) { + if (!$handler instanceof IConfigHandler) { throw new \RuntimeException(sprintf( 'Handler for %s is not an instance of IConfigHandler', $placeholder )); @@ -350,7 +350,7 @@ class BackendService { $newLoaded = true; } $this->configHandlerLoaders = []; - if($newLoaded) { + if ($newLoaded) { // ensure those with longest placeholders come first, // to avoid substring matches uksort($this->configHandlers, function ($phA, $phB) { diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index 265848289f3..51373e8dda6 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -140,7 +140,7 @@ class DBConfigService { $stmt->closeCursor(); foreach ($result as $row) { - if((int)$row['count'] > 1) { + if ((int)$row['count'] > 1) { $this->removeApplicable($row['mount_id'], $applicableType, $applicableId); } else { $this->removeMount($row['mount_id']); @@ -343,7 +343,7 @@ class DBConfigService { ->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)) ->setValue('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)) ->execute(); - } catch(UniqueConstraintViolationException $e) { + } catch (UniqueConstraintViolationException $e) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_config') ->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)) @@ -366,7 +366,7 @@ class DBConfigService { ->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)) ->setValue('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR)) ->execute(); - } catch(UniqueConstraintViolationException $e) { + } catch (UniqueConstraintViolationException $e) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_options') ->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR)) @@ -384,7 +384,7 @@ class DBConfigService { ->setValue('type', $builder->createNamedParameter($type)) ->setValue('value', $builder->createNamedParameter($value)) ->execute(); - } catch(UniqueConstraintViolationException $e) { + } catch (UniqueConstraintViolationException $e) { // applicable exists already } } diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php index 0cad7b2535e..7b9af773233 100644 --- a/apps/files_external/lib/Service/UserGlobalStoragesService.php +++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php @@ -34,7 +34,6 @@ use OCP\IUserSession; * Read-only access available, attempting to write will throw DomainException */ class UserGlobalStoragesService extends GlobalStoragesService { - use UserTrait; /** @var IGroupManager */ diff --git a/apps/files_external/lib/Settings/Admin.php b/apps/files_external/lib/Settings/Admin.php index fe2d7598a17..d3c2c07aa83 100644 --- a/apps/files_external/lib/Settings/Admin.php +++ b/apps/files_external/lib/Settings/Admin.php @@ -92,5 +92,4 @@ class Admin implements ISettings { public function getPriority() { return 40; } - } diff --git a/apps/files_external/lib/Settings/Personal.php b/apps/files_external/lib/Settings/Personal.php index 927955cb420..de94793a6af 100644 --- a/apps/files_external/lib/Settings/Personal.php +++ b/apps/files_external/lib/Settings/Personal.php @@ -100,5 +100,4 @@ class Personal implements ISettings { public function getPriority() { return 40; } - } diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index c02d9d71566..c69955c3406 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -247,7 +247,7 @@ class OC_Mount_Config { return StorageNotAvailableException::STATUS_SUCCESS; } foreach ($options as $key => &$option) { - if($key === 'password') { + if ($key === 'password') { // no replacements in passwords continue; } diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 0142b206b3e..0ccf8366a91 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -46,7 +46,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || switch ($parameter->getType()) { case DefinitionParameter::VALUE_PASSWORD: ?> - <?php if ($is_optional) { $classes[] = 'optional'; } ?> + <?php if ($is_optional) { + $classes[] = 'optional'; + } ?> <input type="password" <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> data-parameter="<?php p($parameter->getName()); ?>" @@ -79,7 +81,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || <?php break; default: ?> - <?php if ($is_optional) { $classes[] = 'optional'; } ?> + <?php if ($is_optional) { + $classes[] = 'optional'; + } ?> <input type="text" <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> data-parameter="<?php p($parameter->getName()); ?>" @@ -100,7 +104,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || <h2 class="inlineblock" data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a> <p class="settings-hint"><?php p($l->t('External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices. You may also allow users to mount their own external storage services.')); ?></p> - <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> + <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) { + print_unescaped(''.$_['dependencies'].''); +} ?> <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> <thead> <tr> @@ -109,7 +115,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || <th><?php p($l->t('External storage')); ?></th> <th><?php p($l->t('Authentication')); ?></th> <th><?php p($l->t('Configuration')); ?></th> - <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) { + print_unescaped('<th>'.$l->t('Available for').'</th>'); +} ?> <th> </th> <th> </th> <th> </th> @@ -142,7 +150,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || }); ?> <?php foreach ($sortedBackends as $backend): ?> - <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends?> + <?php if ($backend->getDeprecateTo()) { + continue; + } // ignore deprecated backends?> <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> <?php endforeach; ?> </select> @@ -167,7 +177,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> <input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox" - value="1" <?php if ($_['allowUserMounting']) print_unescaped(' checked="checked"'); ?> /> + value="1" <?php if ($_['allowUserMounting']) { + print_unescaped(' checked="checked"'); + } ?> /> <label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span> <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> @@ -180,7 +192,9 @@ $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> <?php else: ?> - <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> + <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) { + print_unescaped(' checked="checked"'); + } ?> /> <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br /> <?php endif; ?> <?php $i++; ?> diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index dcdc8d42aec..8a4321466c8 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -28,7 +28,6 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class AuthMechanismTest extends \Test\TestCase { - public function testJsonSerialization() { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->setMethods(['jsonSerializeDefinition']) @@ -82,5 +81,4 @@ class AuthMechanismTest extends \Test\TestCase { $this->assertEquals($expectedSuccess, $mechanism->validateStorage($storageConfig)); } - } diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php index f6e6b0b55ac..8edf7358ed8 100644 --- a/apps/files_external/tests/Auth/Password/GlobalAuth.php +++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php @@ -118,5 +118,4 @@ class GlobalAuthTest extends TestCase { $this->instance->manipulateStorageConfig($storage); $this->assertEquals([], $storage->getBackendOptions()); } - } diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index 10853d9197c..ca7cc7d7b2c 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -28,7 +28,6 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class BackendTest extends \Test\TestCase { - public function testJsonSerialization() { $backend = $this->getMockBuilder(Backend::class) ->setMethods(['jsonSerializeDefinition']) @@ -89,5 +88,4 @@ class BackendTest extends \Test\TestCase { $this->assertEquals('foobar', $backend->getLegacyAuthMechanism(['other' => true])); $this->assertEquals('foobar', $backend->getLegacyAuthMechanism()); } - } diff --git a/apps/files_external/tests/Backend/LegacyBackendTest.php b/apps/files_external/tests/Backend/LegacyBackendTest.php index 71957466c7d..c929058c2b5 100644 --- a/apps/files_external/tests/Backend/LegacyBackendTest.php +++ b/apps/files_external/tests/Backend/LegacyBackendTest.php @@ -111,5 +111,4 @@ class LegacyBackendTest extends \Test\TestCase { $dependencies = $backend->checkDependencies(); $this->assertCount(0, $dependencies); } - } diff --git a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php index 443a13eccef..5fc03cad9e4 100644 --- a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php +++ b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php @@ -98,5 +98,4 @@ class UserPlaceholderHandlerTest extends \Test\TestCase { ->willThrowException(new ShareNotFound()); $this->assertSame($option, $this->handler->handle($option)); } - } diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 4e07751fb3d..40d0154d992 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -403,5 +403,4 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } } - } diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index 2c3da44b3b2..109a0335146 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -110,5 +110,4 @@ class UserStoragesControllerTest extends StoragesControllerTest { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } - } diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index 862d3deb557..b0a48509d65 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -27,7 +27,6 @@ namespace OCA\Files_External\Tests; use OCA\Files_External\Lib\DefinitionParameter as Param; class DefinitionParameterTest extends \Test\TestCase { - public function testJsonSerialization() { $param = new Param('foo', 'bar'); $this->assertEquals([ diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index ad5cb903214..c4eab6f0122 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -29,7 +29,6 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class FrontendDefinitionTraitTest extends \Test\TestCase { - public function testJsonSerialization() { $param = $this->getMockBuilder(DefinitionParameter::class) ->disableOriginalConstructor() diff --git a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php index b5c8ae3b2c6..b873a18694d 100644 --- a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php +++ b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php @@ -50,5 +50,4 @@ class LegacyDependencyCheckPolyfillTest extends \Test\TestCase { $this->assertEquals('program', $dependencies[1]->getDependency()); $this->assertEquals('cannot find program', $dependencies[1]->getMessage()); } - } diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index 35c3637ecf7..7ce72ce62d6 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -35,7 +35,6 @@ namespace OCA\Files_External\Tests; * @package OCA\Files_External\Tests */ class OwnCloudFunctionsTest extends \Test\TestCase { - function configUrlProvider() { return [ [ diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index 2c4587923d8..0964f48572b 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -242,7 +242,9 @@ class BackendServiceTest extends \Test\TestCase { $service = new BackendService($this->config); $mock = $this->createMock(IConfigHandler::class); - $cb = function () use ($mock) { return $mock; }; + $cb = function () use ($mock) { + return $mock; + }; foreach ($placeholders as $placeholder) { $service->registerConfigHandler($placeholder, $cb); } @@ -253,7 +255,9 @@ class BackendServiceTest extends \Test\TestCase { $mock = $this->createMock(IConfigHandler::class); $mock->expects($this->exactly(3)) ->method('handle'); - $cb = function () use ($mock) { return $mock; }; + $cb = function () use ($mock) { + return $mock; + }; $service->registerConfigHandler('one', $cb); $service->registerConfigHandler('2', $cb); $service->registerConfigHandler('Three', $cb); @@ -265,5 +269,4 @@ class BackendServiceTest extends \Test\TestCase { $handler->handle('Something'); } } - } diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php index bc831b1e95c..b977a4b3eb6 100644 --- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php @@ -445,7 +445,6 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $updatedApplicableUsers, $updatedApplicableGroups, $expectedCalls) { - $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); @@ -603,7 +602,6 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $sourceApplicableUsers, $sourceApplicableGroups, $expectedCalls) { - $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); @@ -626,5 +624,4 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { ); } } - } diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index 633399197f2..c23d741b23d 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -153,10 +153,8 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { $this->service->getStorage($newStorage->getId()); $this->fail('Failed asserting that storage can\'t be accessed by id'); } catch (NotFoundException $e) { - } } - } diff --git a/apps/files_external/tests/Storage/Amazons3Test.php b/apps/files_external/tests/Storage/Amazons3Test.php index 0e9ec3dbaa6..2aaeede47c3 100644 --- a/apps/files_external/tests/Storage/Amazons3Test.php +++ b/apps/files_external/tests/Storage/Amazons3Test.php @@ -38,7 +38,6 @@ use OCA\Files_External\Lib\Storage\AmazonS3; * @package OCA\Files_External\Tests\Storage */ class Amazons3Test extends \Test\Files\Storage\Storage { - private $config; protected function setUp(): void { diff --git a/apps/files_external/tests/Storage/OwncloudTest.php b/apps/files_external/tests/Storage/OwncloudTest.php index 0f63709614d..6a07bcf498f 100644 --- a/apps/files_external/tests/Storage/OwncloudTest.php +++ b/apps/files_external/tests/Storage/OwncloudTest.php @@ -37,7 +37,6 @@ use OCA\Files_External\Lib\Storage\OwnCloud; * @package OCA\Files_External\Tests\Storage */ class OwncloudTest extends \Test\Files\Storage\Storage { - private $config; protected function setUp(): void { diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 1300aa03038..d90608a2886 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -39,7 +39,6 @@ use OCA\Files_External\Lib\Storage\Swift; * @package OCA\Files_External\Tests\Storage */ class SwiftTest extends \Test\Files\Storage\Storage { - private $config; /** diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index 88e2d4a0181..03b1d41eae5 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -39,7 +39,6 @@ use OC\Files\Type\Detection; * @package OCA\Files_External\Tests\Storage */ class WebdavTest extends \Test\Files\Storage\Storage { - protected function setUp(): void { parent::setUp(); diff --git a/apps/files_external/tests/StorageConfigTest.php b/apps/files_external/tests/StorageConfigTest.php index 01dab4d95a0..2f0a8fdba50 100644 --- a/apps/files_external/tests/StorageConfigTest.php +++ b/apps/files_external/tests/StorageConfigTest.php @@ -32,7 +32,6 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class StorageConfigTest extends \Test\TestCase { - public function testJsonSerialization() { $backend = $this->getMockBuilder(Backend::class) ->disableOriginalConstructor() @@ -81,5 +80,4 @@ class StorageConfigTest extends \Test\TestCase { $this->assertSame(['group1', 'group2'], $json['applicableGroups']); $this->assertSame(['preview' => false], $json['mountOptions']); } - } |