Passed
Push — master ( 4908d8...fbbdc6 )
by Joas
16:12 queued 12s
created
apps/settings/lib/Sections/Admin/Sharing.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class Sharing implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon(): string {
45
-		return $this->urlGenerator->imagePath('core', 'actions/share.svg');
46
-	}
44
+    public function getIcon(): string {
45
+        return $this->urlGenerator->imagePath('core', 'actions/share.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'sharing';
50
-	}
48
+    public function getID(): string {
49
+        return 'sharing';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Sharing');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Sharing');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 5;
58
-	}
56
+    public function getPriority(): int {
57
+        return 5;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Admin/Security.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class Security implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon(): string {
45
-		return $this->urlGenerator->imagePath('core', 'actions/password.svg');
46
-	}
44
+    public function getIcon(): string {
45
+        return $this->urlGenerator->imagePath('core', 'actions/password.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'security';
50
-	}
48
+    public function getID(): string {
49
+        return 'security';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Security');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Security');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 10;
58
-	}
56
+    public function getPriority(): int {
57
+        return 10;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Admin/Server.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class Server implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon(): string {
45
-		return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg');
46
-	}
44
+    public function getIcon(): string {
45
+        return $this->urlGenerator->imagePath('core', 'actions/settings-dark.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'server';
50
-	}
48
+    public function getID(): string {
49
+        return 'server';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Basic settings');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Basic settings');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 1;
58
-	}
56
+    public function getPriority(): int {
57
+        return 1;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Admin/Overview.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class Overview implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon(): string {
45
-		return $this->urlGenerator->imagePath('settings', 'admin.svg');
46
-	}
44
+    public function getIcon(): string {
45
+        return $this->urlGenerator->imagePath('settings', 'admin.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'overview';
50
-	}
48
+    public function getID(): string {
49
+        return 'overview';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Overview');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Overview');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 0;
58
-	}
56
+    public function getPriority(): int {
57
+        return 0;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Personal/SyncClients.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class SyncClients implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon() {
45
-		return $this->urlGenerator->imagePath('core', 'clients/phone.svg');
46
-	}
44
+    public function getIcon() {
45
+        return $this->urlGenerator->imagePath('core', 'clients/phone.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'sync-clients';
50
-	}
48
+    public function getID(): string {
49
+        return 'sync-clients';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Mobile & desktop');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Mobile & desktop');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 15;
58
-	}
56
+    public function getPriority(): int {
57
+        return 15;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Personal/Security.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class Security implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon() {
45
-		return $this->urlGenerator->imagePath('settings', 'password.svg');
46
-	}
44
+    public function getIcon() {
45
+        return $this->urlGenerator->imagePath('settings', 'password.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'security';
50
-	}
48
+    public function getID(): string {
49
+        return 'security';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Security');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Security');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 5;
58
-	}
56
+    public function getPriority(): int {
57
+        return 5;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Sections/Personal/PersonalInfo.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class PersonalInfo implements IIconSection {
32 32
 
33
-	/** @var IL10N */
34
-	private $l;
33
+    /** @var IL10N */
34
+    private $l;
35 35
 
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38 38
 
39
-	public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
-		$this->l = $l;
41
-		$this->urlGenerator = $urlGenerator;
42
-	}
39
+    public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
40
+        $this->l = $l;
41
+        $this->urlGenerator = $urlGenerator;
42
+    }
43 43
 
44
-	public function getIcon() {
45
-		return $this->urlGenerator->imagePath('core', 'actions/user.svg');
46
-	}
44
+    public function getIcon() {
45
+        return $this->urlGenerator->imagePath('core', 'actions/user.svg');
46
+    }
47 47
 
48
-	public function getID(): string {
49
-		return 'personal-info';
50
-	}
48
+    public function getID(): string {
49
+        return 'personal-info';
50
+    }
51 51
 
52
-	public function getName(): string {
53
-		return $this->l->t('Personal info');
54
-	}
52
+    public function getName(): string {
53
+        return $this->l->t('Personal info');
54
+    }
55 55
 
56
-	public function getPriority(): int {
57
-		return 0;
58
-	}
56
+    public function getPriority(): int {
57
+        return 0;
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/settings/lib/Settings/Personal/Security/TwoFactor.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,12 +106,12 @@
 block discarded – undo
106 106
 		}
107 107
 
108 108
 		return [
109
-			'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) {
109
+			'providers' => array_map(function(IProvidesPersonalSettings $provider) use ($user) {
110 110
 				return [
111 111
 					'provider' => $provider,
112 112
 					'settings' => $provider->getPersonalSettings($user)
113 113
 				];
114
-			}, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) {
114
+			}, array_filter($this->providerLoader->getProviders($user), function(IProvider $provider) {
115 115
 				return $provider instanceof IProvidesPersonalSettings;
116 116
 			}))
117 117
 		];
Please login to merge, or discard this patch.
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -42,95 +42,95 @@
 block discarded – undo
42 42
 
43 43
 class TwoFactor implements ISettings {
44 44
 
45
-	/** @var ProviderLoader */
46
-	private $providerLoader;
47
-
48
-	/** @var MandatoryTwoFactor */
49
-	private $mandatoryTwoFactor;
50
-
51
-	/** @var IUserSession */
52
-	private $userSession;
53
-
54
-	/** @var string|null */
55
-	private $uid;
56
-
57
-	/** @var IConfig */
58
-	private $config;
59
-
60
-	public function __construct(ProviderLoader $providerLoader,
61
-								MandatoryTwoFactor $mandatoryTwoFactor,
62
-								IUserSession $userSession,
63
-								IConfig $config,
64
-								?string $UserId) {
65
-		$this->providerLoader = $providerLoader;
66
-		$this->mandatoryTwoFactor = $mandatoryTwoFactor;
67
-		$this->userSession = $userSession;
68
-		$this->uid = $UserId;
69
-		$this->config = $config;
70
-	}
71
-
72
-	public function getForm(): TemplateResponse {
73
-		return new TemplateResponse('settings', 'settings/personal/security/twofactor', [
74
-			'twoFactorProviderData' => $this->getTwoFactorProviderData(),
75
-		]);
76
-	}
77
-
78
-	public function getSection(): ?string {
79
-		if (!$this->shouldShow()) {
80
-			return null;
81
-		}
82
-		return 'security';
83
-	}
84
-
85
-	public function getPriority(): int {
86
-		return 15;
87
-	}
88
-
89
-	private function shouldShow(): bool {
90
-		$user = $this->userSession->getUser();
91
-		if (is_null($user)) {
92
-			// Actually impossible, but still …
93
-			return false;
94
-		}
95
-
96
-		// Anyone who's supposed to use 2FA should see 2FA settings
97
-		if ($this->mandatoryTwoFactor->isEnforcedFor($user)) {
98
-			return true;
99
-		}
100
-
101
-		// If there is at least one provider with personal settings but it's not
102
-		// the backup codes provider, then these settings should show.
103
-		try {
104
-			$providers = $this->providerLoader->getProviders($user);
105
-		} catch (Exception $e) {
106
-			// Let's hope for the best
107
-			return true;
108
-		}
109
-		foreach ($providers as $provider) {
110
-			if ($provider instanceof IProvidesPersonalSettings
111
-				&& !($provider instanceof BackupCodesProvider)) {
112
-				return true;
113
-			}
114
-		}
115
-		return false;
116
-	}
117
-
118
-	private function getTwoFactorProviderData(): array {
119
-		$user = $this->userSession->getUser();
120
-		if (is_null($user)) {
121
-			// Actually impossible, but still …
122
-			return [];
123
-		}
124
-
125
-		return [
126
-			'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) {
127
-				return [
128
-					'provider' => $provider,
129
-					'settings' => $provider->getPersonalSettings($user)
130
-				];
131
-			}, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) {
132
-				return $provider instanceof IProvidesPersonalSettings;
133
-			}))
134
-		];
135
-	}
45
+    /** @var ProviderLoader */
46
+    private $providerLoader;
47
+
48
+    /** @var MandatoryTwoFactor */
49
+    private $mandatoryTwoFactor;
50
+
51
+    /** @var IUserSession */
52
+    private $userSession;
53
+
54
+    /** @var string|null */
55
+    private $uid;
56
+
57
+    /** @var IConfig */
58
+    private $config;
59
+
60
+    public function __construct(ProviderLoader $providerLoader,
61
+                                MandatoryTwoFactor $mandatoryTwoFactor,
62
+                                IUserSession $userSession,
63
+                                IConfig $config,
64
+                                ?string $UserId) {
65
+        $this->providerLoader = $providerLoader;
66
+        $this->mandatoryTwoFactor = $mandatoryTwoFactor;
67
+        $this->userSession = $userSession;
68
+        $this->uid = $UserId;
69
+        $this->config = $config;
70
+    }
71
+
72
+    public function getForm(): TemplateResponse {
73
+        return new TemplateResponse('settings', 'settings/personal/security/twofactor', [
74
+            'twoFactorProviderData' => $this->getTwoFactorProviderData(),
75
+        ]);
76
+    }
77
+
78
+    public function getSection(): ?string {
79
+        if (!$this->shouldShow()) {
80
+            return null;
81
+        }
82
+        return 'security';
83
+    }
84
+
85
+    public function getPriority(): int {
86
+        return 15;
87
+    }
88
+
89
+    private function shouldShow(): bool {
90
+        $user = $this->userSession->getUser();
91
+        if (is_null($user)) {
92
+            // Actually impossible, but still …
93
+            return false;
94
+        }
95
+
96
+        // Anyone who's supposed to use 2FA should see 2FA settings
97
+        if ($this->mandatoryTwoFactor->isEnforcedFor($user)) {
98
+            return true;
99
+        }
100
+
101
+        // If there is at least one provider with personal settings but it's not
102
+        // the backup codes provider, then these settings should show.
103
+        try {
104
+            $providers = $this->providerLoader->getProviders($user);
105
+        } catch (Exception $e) {
106
+            // Let's hope for the best
107
+            return true;
108
+        }
109
+        foreach ($providers as $provider) {
110
+            if ($provider instanceof IProvidesPersonalSettings
111
+                && !($provider instanceof BackupCodesProvider)) {
112
+                return true;
113
+            }
114
+        }
115
+        return false;
116
+    }
117
+
118
+    private function getTwoFactorProviderData(): array {
119
+        $user = $this->userSession->getUser();
120
+        if (is_null($user)) {
121
+            // Actually impossible, but still …
122
+            return [];
123
+        }
124
+
125
+        return [
126
+            'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) {
127
+                return [
128
+                    'provider' => $provider,
129
+                    'settings' => $provider->getPersonalSettings($user)
130
+                ];
131
+            }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) {
132
+                return $provider instanceof IProvidesPersonalSettings;
133
+            }))
134
+        ];
135
+    }
136 136
 }
Please login to merge, or discard this patch.
apps/settings/lib/Settings/Personal/Security/Password.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,35 +34,35 @@
 block discarded – undo
34 34
 
35 35
 class Password implements ISettings {
36 36
 
37
-	/** @var IUserManager */
38
-	private $userManager;
37
+    /** @var IUserManager */
38
+    private $userManager;
39 39
 
40
-	/** @var string|null */
41
-	private $uid;
40
+    /** @var string|null */
41
+    private $uid;
42 42
 
43
-	public function __construct(IUserManager $userManager,
44
-								?string $UserId) {
45
-		$this->userManager = $userManager;
46
-		$this->uid = $UserId;
47
-	}
43
+    public function __construct(IUserManager $userManager,
44
+                                ?string $UserId) {
45
+        $this->userManager = $userManager;
46
+        $this->uid = $UserId;
47
+    }
48 48
 
49
-	public function getForm(): TemplateResponse {
50
-		$user = $this->userManager->get($this->uid);
51
-		$passwordChangeSupported = false;
52
-		if ($user !== null) {
53
-			$passwordChangeSupported = $user->canChangePassword();
54
-		}
49
+    public function getForm(): TemplateResponse {
50
+        $user = $this->userManager->get($this->uid);
51
+        $passwordChangeSupported = false;
52
+        if ($user !== null) {
53
+            $passwordChangeSupported = $user->canChangePassword();
54
+        }
55 55
 
56
-		return new TemplateResponse('settings', 'settings/personal/security/password', [
57
-			'passwordChangeSupported' => $passwordChangeSupported,
58
-		]);
59
-	}
56
+        return new TemplateResponse('settings', 'settings/personal/security/password', [
57
+            'passwordChangeSupported' => $passwordChangeSupported,
58
+        ]);
59
+    }
60 60
 
61
-	public function getSection(): string {
62
-		return 'security';
63
-	}
61
+    public function getSection(): string {
62
+        return 'security';
63
+    }
64 64
 
65
-	public function getPriority(): int {
66
-		return 10;
67
-	}
65
+    public function getPriority(): int {
66
+        return 10;
67
+    }
68 68
 }
Please login to merge, or discard this patch.