Passed
Push — master ( b6c034...979f40 )
by John
40:53 queued 23:59
created
apps/files_trashbin/lib/Expiration.php 1 patch
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -32,143 +32,143 @@
 block discarded – undo
32 32
 
33 33
 class Expiration {
34 34
 
35
-	// how long do we keep files in the trash bin if no other value is defined in the config file (unit: days)
36
-	public const DEFAULT_RETENTION_OBLIGATION = 30;
37
-	public const NO_OBLIGATION = -1;
38
-
39
-	/** @var ITimeFactory */
40
-	private $timeFactory;
41
-
42
-	/** @var string */
43
-	private $retentionObligation;
44
-
45
-	/** @var int */
46
-	private $minAge;
47
-
48
-	/** @var int */
49
-	private $maxAge;
50
-
51
-	/** @var bool */
52
-	private $canPurgeToSaveSpace;
53
-
54
-	public function __construct(IConfig $config,ITimeFactory $timeFactory) {
55
-		$this->timeFactory = $timeFactory;
56
-		$this->setRetentionObligation($config->getSystemValue('trashbin_retention_obligation', 'auto'));
57
-	}
58
-
59
-	public function setRetentionObligation(string $obligation) {
60
-		$this->retentionObligation = $obligation;
61
-
62
-		if ($this->retentionObligation !== 'disabled') {
63
-			$this->parseRetentionObligation();
64
-		}
65
-	}
66
-
67
-	/**
68
-	 * Is trashbin expiration enabled
69
-	 * @return bool
70
-	 */
71
-	public function isEnabled() {
72
-		return $this->retentionObligation !== 'disabled';
73
-	}
74
-
75
-	/**
76
-	 * Check if given timestamp in expiration range
77
-	 * @param int $timestamp
78
-	 * @param bool $quotaExceeded
79
-	 * @return bool
80
-	 */
81
-	public function isExpired($timestamp, $quotaExceeded = false) {
82
-		// No expiration if disabled
83
-		if (!$this->isEnabled()) {
84
-			return false;
85
-		}
86
-
87
-		// Purge to save space (if allowed)
88
-		if ($quotaExceeded && $this->canPurgeToSaveSpace) {
89
-			return true;
90
-		}
91
-
92
-		$time = $this->timeFactory->getTime();
93
-		// Never expire dates in future e.g. misconfiguration or negative time
94
-		// adjustment
95
-		if ($time < $timestamp) {
96
-			return false;
97
-		}
98
-
99
-		// Purge as too old
100
-		if ($this->maxAge !== self::NO_OBLIGATION) {
101
-			$maxTimestamp = $time - ($this->maxAge * 86400);
102
-			$isOlderThanMax = $timestamp < $maxTimestamp;
103
-		} else {
104
-			$isOlderThanMax = false;
105
-		}
106
-
107
-		if ($this->minAge !== self::NO_OBLIGATION) {
108
-			// older than Min obligation and we are running out of quota?
109
-			$minTimestamp = $time - ($this->minAge * 86400);
110
-			$isMinReached = ($timestamp < $minTimestamp) && $quotaExceeded;
111
-		} else {
112
-			$isMinReached = false;
113
-		}
114
-
115
-		return $isOlderThanMax || $isMinReached;
116
-	}
117
-
118
-	/**
119
-	 * @return bool|int
120
-	 */
121
-	public function getMaxAgeAsTimestamp() {
122
-		$maxAge = false;
123
-		if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) {
124
-			$time = $this->timeFactory->getTime();
125
-			$maxAge = $time - ($this->maxAge * 86400);
126
-		}
127
-		return $maxAge;
128
-	}
129
-
130
-	private function parseRetentionObligation() {
131
-		$splitValues = explode(',', $this->retentionObligation);
132
-		if (!isset($splitValues[0])) {
133
-			$minValue = self::DEFAULT_RETENTION_OBLIGATION;
134
-		} else {
135
-			$minValue = trim($splitValues[0]);
136
-		}
137
-
138
-		if (!isset($splitValues[1]) && $minValue === 'auto') {
139
-			$maxValue = 'auto';
140
-		} elseif (!isset($splitValues[1])) {
141
-			$maxValue = self::DEFAULT_RETENTION_OBLIGATION;
142
-		} else {
143
-			$maxValue = trim($splitValues[1]);
144
-		}
145
-
146
-		if ($minValue === 'auto' && $maxValue === 'auto') {
147
-			// Default: Keep for 30 days but delete anytime if space needed
148
-			$this->minAge = self::DEFAULT_RETENTION_OBLIGATION;
149
-			$this->maxAge = self::NO_OBLIGATION;
150
-			$this->canPurgeToSaveSpace = true;
151
-		} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
152
-			// Keep for X days but delete anytime if space needed
153
-			$this->minAge = (int)$minValue;
154
-			$this->maxAge = self::NO_OBLIGATION;
155
-			$this->canPurgeToSaveSpace = true;
156
-		} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
157
-			// Delete anytime if space needed, Delete all older than max automatically
158
-			$this->minAge = self::NO_OBLIGATION;
159
-			$this->maxAge = (int)$maxValue;
160
-			$this->canPurgeToSaveSpace = true;
161
-		} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
162
-			// Delete all older than max OR older than min if space needed
163
-
164
-			// Max < Min as per https://github.com/owncloud/core/issues/16300
165
-			if ($maxValue < $minValue) {
166
-				$maxValue = $minValue;
167
-			}
168
-
169
-			$this->minAge = (int)$minValue;
170
-			$this->maxAge = (int)$maxValue;
171
-			$this->canPurgeToSaveSpace = false;
172
-		}
173
-	}
35
+    // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days)
36
+    public const DEFAULT_RETENTION_OBLIGATION = 30;
37
+    public const NO_OBLIGATION = -1;
38
+
39
+    /** @var ITimeFactory */
40
+    private $timeFactory;
41
+
42
+    /** @var string */
43
+    private $retentionObligation;
44
+
45
+    /** @var int */
46
+    private $minAge;
47
+
48
+    /** @var int */
49
+    private $maxAge;
50
+
51
+    /** @var bool */
52
+    private $canPurgeToSaveSpace;
53
+
54
+    public function __construct(IConfig $config,ITimeFactory $timeFactory) {
55
+        $this->timeFactory = $timeFactory;
56
+        $this->setRetentionObligation($config->getSystemValue('trashbin_retention_obligation', 'auto'));
57
+    }
58
+
59
+    public function setRetentionObligation(string $obligation) {
60
+        $this->retentionObligation = $obligation;
61
+
62
+        if ($this->retentionObligation !== 'disabled') {
63
+            $this->parseRetentionObligation();
64
+        }
65
+    }
66
+
67
+    /**
68
+     * Is trashbin expiration enabled
69
+     * @return bool
70
+     */
71
+    public function isEnabled() {
72
+        return $this->retentionObligation !== 'disabled';
73
+    }
74
+
75
+    /**
76
+     * Check if given timestamp in expiration range
77
+     * @param int $timestamp
78
+     * @param bool $quotaExceeded
79
+     * @return bool
80
+     */
81
+    public function isExpired($timestamp, $quotaExceeded = false) {
82
+        // No expiration if disabled
83
+        if (!$this->isEnabled()) {
84
+            return false;
85
+        }
86
+
87
+        // Purge to save space (if allowed)
88
+        if ($quotaExceeded && $this->canPurgeToSaveSpace) {
89
+            return true;
90
+        }
91
+
92
+        $time = $this->timeFactory->getTime();
93
+        // Never expire dates in future e.g. misconfiguration or negative time
94
+        // adjustment
95
+        if ($time < $timestamp) {
96
+            return false;
97
+        }
98
+
99
+        // Purge as too old
100
+        if ($this->maxAge !== self::NO_OBLIGATION) {
101
+            $maxTimestamp = $time - ($this->maxAge * 86400);
102
+            $isOlderThanMax = $timestamp < $maxTimestamp;
103
+        } else {
104
+            $isOlderThanMax = false;
105
+        }
106
+
107
+        if ($this->minAge !== self::NO_OBLIGATION) {
108
+            // older than Min obligation and we are running out of quota?
109
+            $minTimestamp = $time - ($this->minAge * 86400);
110
+            $isMinReached = ($timestamp < $minTimestamp) && $quotaExceeded;
111
+        } else {
112
+            $isMinReached = false;
113
+        }
114
+
115
+        return $isOlderThanMax || $isMinReached;
116
+    }
117
+
118
+    /**
119
+     * @return bool|int
120
+     */
121
+    public function getMaxAgeAsTimestamp() {
122
+        $maxAge = false;
123
+        if ($this->isEnabled() && $this->maxAge !== self::NO_OBLIGATION) {
124
+            $time = $this->timeFactory->getTime();
125
+            $maxAge = $time - ($this->maxAge * 86400);
126
+        }
127
+        return $maxAge;
128
+    }
129
+
130
+    private function parseRetentionObligation() {
131
+        $splitValues = explode(',', $this->retentionObligation);
132
+        if (!isset($splitValues[0])) {
133
+            $minValue = self::DEFAULT_RETENTION_OBLIGATION;
134
+        } else {
135
+            $minValue = trim($splitValues[0]);
136
+        }
137
+
138
+        if (!isset($splitValues[1]) && $minValue === 'auto') {
139
+            $maxValue = 'auto';
140
+        } elseif (!isset($splitValues[1])) {
141
+            $maxValue = self::DEFAULT_RETENTION_OBLIGATION;
142
+        } else {
143
+            $maxValue = trim($splitValues[1]);
144
+        }
145
+
146
+        if ($minValue === 'auto' && $maxValue === 'auto') {
147
+            // Default: Keep for 30 days but delete anytime if space needed
148
+            $this->minAge = self::DEFAULT_RETENTION_OBLIGATION;
149
+            $this->maxAge = self::NO_OBLIGATION;
150
+            $this->canPurgeToSaveSpace = true;
151
+        } elseif ($minValue !== 'auto' && $maxValue === 'auto') {
152
+            // Keep for X days but delete anytime if space needed
153
+            $this->minAge = (int)$minValue;
154
+            $this->maxAge = self::NO_OBLIGATION;
155
+            $this->canPurgeToSaveSpace = true;
156
+        } elseif ($minValue === 'auto' && $maxValue !== 'auto') {
157
+            // Delete anytime if space needed, Delete all older than max automatically
158
+            $this->minAge = self::NO_OBLIGATION;
159
+            $this->maxAge = (int)$maxValue;
160
+            $this->canPurgeToSaveSpace = true;
161
+        } elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
162
+            // Delete all older than max OR older than min if space needed
163
+
164
+            // Max < Min as per https://github.com/owncloud/core/issues/16300
165
+            if ($maxValue < $minValue) {
166
+                $maxValue = $minValue;
167
+            }
168
+
169
+            $this->minAge = (int)$minValue;
170
+            $this->maxAge = (int)$maxValue;
171
+            $this->canPurgeToSaveSpace = false;
172
+        }
173
+    }
174 174
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Settings/Admin.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -40,89 +40,89 @@
 block discarded – undo
40 40
 
41 41
 class Admin implements ISettings {
42 42
 
43
-	/** @var IL10N */
44
-	private $l;
45
-
46
-	/** @var ILogger */
47
-	private $logger;
48
-
49
-	/** @var IUserSession */
50
-	private $userSession;
51
-
52
-	/** @var IConfig */
53
-	private $config;
54
-
55
-	/** @var IUserManager */
56
-	private $userManager;
57
-
58
-	/** @var ISession */
59
-	private $session;
60
-
61
-	public function __construct(
62
-		IL10N $l,
63
-		ILogger $logger,
64
-		IUserSession $userSession,
65
-		IConfig $config,
66
-		IUserManager $userManager,
67
-		ISession $session
68
-	) {
69
-		$this->l = $l;
70
-		$this->logger = $logger;
71
-		$this->userSession = $userSession;
72
-		$this->config = $config;
73
-		$this->userManager = $userManager;
74
-		$this->session = $session;
75
-	}
76
-
77
-	/**
78
-	 * @return TemplateResponse
79
-	 */
80
-	public function getForm() {
81
-		$crypt = new Crypt(
82
-			$this->logger,
83
-			$this->userSession,
84
-			$this->config,
85
-			$this->l);
86
-
87
-		$util = new Util(
88
-			new View(),
89
-			$crypt,
90
-			$this->logger,
91
-			$this->userSession,
92
-			$this->config,
93
-			$this->userManager);
94
-
95
-		// Check if an adminRecovery account is enabled for recovering files after lost pwd
96
-		$recoveryAdminEnabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', '0');
97
-		$session = new Session($this->session);
98
-
99
-		$encryptHomeStorage = $util->shouldEncryptHomeStorage();
100
-
101
-		$parameters = [
102
-			'recoveryEnabled' => $recoveryAdminEnabled,
103
-			'initStatus' => $session->getStatus(),
104
-			'encryptHomeStorage' => $encryptHomeStorage,
105
-			'masterKeyEnabled' => $util->isMasterKeyEnabled(),
106
-		];
107
-
108
-		return new TemplateResponse('encryption', 'settings-admin', $parameters, '');
109
-	}
110
-
111
-	/**
112
-	 * @return string the section ID, e.g. 'sharing'
113
-	 */
114
-	public function getSection() {
115
-		return 'security';
116
-	}
117
-
118
-	/**
119
-	 * @return int whether the form should be rather on the top or bottom of
120
-	 * the admin section. The forms are arranged in ascending order of the
121
-	 * priority values. It is required to return a value between 0 and 100.
122
-	 *
123
-	 * E.g.: 70
124
-	 */
125
-	public function getPriority() {
126
-		return 11;
127
-	}
43
+    /** @var IL10N */
44
+    private $l;
45
+
46
+    /** @var ILogger */
47
+    private $logger;
48
+
49
+    /** @var IUserSession */
50
+    private $userSession;
51
+
52
+    /** @var IConfig */
53
+    private $config;
54
+
55
+    /** @var IUserManager */
56
+    private $userManager;
57
+
58
+    /** @var ISession */
59
+    private $session;
60
+
61
+    public function __construct(
62
+        IL10N $l,
63
+        ILogger $logger,
64
+        IUserSession $userSession,
65
+        IConfig $config,
66
+        IUserManager $userManager,
67
+        ISession $session
68
+    ) {
69
+        $this->l = $l;
70
+        $this->logger = $logger;
71
+        $this->userSession = $userSession;
72
+        $this->config = $config;
73
+        $this->userManager = $userManager;
74
+        $this->session = $session;
75
+    }
76
+
77
+    /**
78
+     * @return TemplateResponse
79
+     */
80
+    public function getForm() {
81
+        $crypt = new Crypt(
82
+            $this->logger,
83
+            $this->userSession,
84
+            $this->config,
85
+            $this->l);
86
+
87
+        $util = new Util(
88
+            new View(),
89
+            $crypt,
90
+            $this->logger,
91
+            $this->userSession,
92
+            $this->config,
93
+            $this->userManager);
94
+
95
+        // Check if an adminRecovery account is enabled for recovering files after lost pwd
96
+        $recoveryAdminEnabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', '0');
97
+        $session = new Session($this->session);
98
+
99
+        $encryptHomeStorage = $util->shouldEncryptHomeStorage();
100
+
101
+        $parameters = [
102
+            'recoveryEnabled' => $recoveryAdminEnabled,
103
+            'initStatus' => $session->getStatus(),
104
+            'encryptHomeStorage' => $encryptHomeStorage,
105
+            'masterKeyEnabled' => $util->isMasterKeyEnabled(),
106
+        ];
107
+
108
+        return new TemplateResponse('encryption', 'settings-admin', $parameters, '');
109
+    }
110
+
111
+    /**
112
+     * @return string the section ID, e.g. 'sharing'
113
+     */
114
+    public function getSection() {
115
+        return 'security';
116
+    }
117
+
118
+    /**
119
+     * @return int whether the form should be rather on the top or bottom of
120
+     * the admin section. The forms are arranged in ascending order of the
121
+     * priority values. It is required to return a value between 0 and 100.
122
+     *
123
+     * E.g.: 70
124
+     */
125
+    public function getPriority() {
126
+        return 11;
127
+    }
128 128
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Settings/Admin.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -33,64 +33,64 @@
 block discarded – undo
33 33
 
34 34
 class Admin implements ISettings {
35 35
 
36
-	/** @var IManager */
37
-	private $encryptionManager;
36
+    /** @var IManager */
37
+    private $encryptionManager;
38 38
 
39
-	/** @var GlobalStoragesService */
40
-	private $globalStoragesService;
39
+    /** @var GlobalStoragesService */
40
+    private $globalStoragesService;
41 41
 
42
-	/** @var BackendService */
43
-	private $backendService;
42
+    /** @var BackendService */
43
+    private $backendService;
44 44
 
45
-	/** @var GlobalAuth	 */
46
-	private $globalAuth;
45
+    /** @var GlobalAuth	 */
46
+    private $globalAuth;
47 47
 
48
-	public function __construct(
49
-		IManager $encryptionManager,
50
-		GlobalStoragesService $globalStoragesService,
51
-		BackendService $backendService,
52
-		GlobalAuth $globalAuth
53
-	) {
54
-		$this->encryptionManager = $encryptionManager;
55
-		$this->globalStoragesService = $globalStoragesService;
56
-		$this->backendService = $backendService;
57
-		$this->globalAuth = $globalAuth;
58
-	}
48
+    public function __construct(
49
+        IManager $encryptionManager,
50
+        GlobalStoragesService $globalStoragesService,
51
+        BackendService $backendService,
52
+        GlobalAuth $globalAuth
53
+    ) {
54
+        $this->encryptionManager = $encryptionManager;
55
+        $this->globalStoragesService = $globalStoragesService;
56
+        $this->backendService = $backendService;
57
+        $this->globalAuth = $globalAuth;
58
+    }
59 59
 
60
-	/**
61
-	 * @return TemplateResponse
62
-	 */
63
-	public function getForm() {
64
-		$parameters = [
65
-			'encryptionEnabled' => $this->encryptionManager->isEnabled(),
66
-			'visibilityType' => BackendService::VISIBILITY_ADMIN,
67
-			'storages' => $this->globalStoragesService->getStorages(),
68
-			'backends' => $this->backendService->getAvailableBackends(),
69
-			'authMechanisms' => $this->backendService->getAuthMechanisms(),
70
-			'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
71
-			'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
72
-			'globalCredentials' => $this->globalAuth->getAuth(''),
73
-			'globalCredentialsUid' => '',
74
-		];
60
+    /**
61
+     * @return TemplateResponse
62
+     */
63
+    public function getForm() {
64
+        $parameters = [
65
+            'encryptionEnabled' => $this->encryptionManager->isEnabled(),
66
+            'visibilityType' => BackendService::VISIBILITY_ADMIN,
67
+            'storages' => $this->globalStoragesService->getStorages(),
68
+            'backends' => $this->backendService->getAvailableBackends(),
69
+            'authMechanisms' => $this->backendService->getAuthMechanisms(),
70
+            'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
71
+            'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
72
+            'globalCredentials' => $this->globalAuth->getAuth(''),
73
+            'globalCredentialsUid' => '',
74
+        ];
75 75
 
76
-		return new TemplateResponse('files_external', 'settings', $parameters, '');
77
-	}
76
+        return new TemplateResponse('files_external', 'settings', $parameters, '');
77
+    }
78 78
 
79
-	/**
80
-	 * @return string the section ID, e.g. 'sharing'
81
-	 */
82
-	public function getSection() {
83
-		return 'externalstorages';
84
-	}
79
+    /**
80
+     * @return string the section ID, e.g. 'sharing'
81
+     */
82
+    public function getSection() {
83
+        return 'externalstorages';
84
+    }
85 85
 
86
-	/**
87
-	 * @return int whether the form should be rather on the top or bottom of
88
-	 * the admin section. The forms are arranged in ascending order of the
89
-	 * priority values. It is required to return a value between 0 and 100.
90
-	 *
91
-	 * E.g.: 70
92
-	 */
93
-	public function getPriority() {
94
-		return 40;
95
-	}
86
+    /**
87
+     * @return int whether the form should be rather on the top or bottom of
88
+     * the admin section. The forms are arranged in ascending order of the
89
+     * priority values. It is required to return a value between 0 and 100.
90
+     *
91
+     * E.g.: 70
92
+     */
93
+    public function getPriority() {
94
+        return 40;
95
+    }
96 96
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Settings/Personal.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -34,71 +34,71 @@
 block discarded – undo
34 34
 
35 35
 class Personal implements ISettings {
36 36
 
37
-	/** @var IManager */
38
-	private $encryptionManager;
37
+    /** @var IManager */
38
+    private $encryptionManager;
39 39
 
40
-	/** @var UserGlobalStoragesService */
41
-	private $userGlobalStoragesService;
40
+    /** @var UserGlobalStoragesService */
41
+    private $userGlobalStoragesService;
42 42
 
43
-	/** @var BackendService */
44
-	private $backendService;
43
+    /** @var BackendService */
44
+    private $backendService;
45 45
 
46
-	/** @var GlobalAuth	 */
47
-	private $globalAuth;
46
+    /** @var GlobalAuth	 */
47
+    private $globalAuth;
48 48
 
49
-	/** @var IUserSession */
50
-	private $userSession;
49
+    /** @var IUserSession */
50
+    private $userSession;
51 51
 
52
-	public function __construct(
53
-		IManager $encryptionManager,
54
-		UserGlobalStoragesService $userGlobalStoragesService,
55
-		BackendService $backendService,
56
-		GlobalAuth $globalAuth,
57
-		IUserSession $userSession
58
-	) {
59
-		$this->encryptionManager = $encryptionManager;
60
-		$this->userGlobalStoragesService = $userGlobalStoragesService;
61
-		$this->backendService = $backendService;
62
-		$this->globalAuth = $globalAuth;
63
-		$this->userSession = $userSession;
64
-	}
52
+    public function __construct(
53
+        IManager $encryptionManager,
54
+        UserGlobalStoragesService $userGlobalStoragesService,
55
+        BackendService $backendService,
56
+        GlobalAuth $globalAuth,
57
+        IUserSession $userSession
58
+    ) {
59
+        $this->encryptionManager = $encryptionManager;
60
+        $this->userGlobalStoragesService = $userGlobalStoragesService;
61
+        $this->backendService = $backendService;
62
+        $this->globalAuth = $globalAuth;
63
+        $this->userSession = $userSession;
64
+    }
65 65
 
66
-	/**
67
-	 * @return TemplateResponse
68
-	 */
69
-	public function getForm() {
70
-		$uid = $this->userSession->getUser()->getUID();
66
+    /**
67
+     * @return TemplateResponse
68
+     */
69
+    public function getForm() {
70
+        $uid = $this->userSession->getUser()->getUID();
71 71
 
72
-		$parameters = [
73
-			'encryptionEnabled' => $this->encryptionManager->isEnabled(),
74
-			'visibilityType' => BackendService::VISIBILITY_PERSONAL,
75
-			'storages' => $this->userGlobalStoragesService->getStorages(),
76
-			'backends' => $this->backendService->getAvailableBackends(),
77
-			'authMechanisms' => $this->backendService->getAuthMechanisms(),
78
-			'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
79
-			'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
80
-			'globalCredentials' => $this->globalAuth->getAuth($uid),
81
-			'globalCredentialsUid' => $uid,
82
-		];
72
+        $parameters = [
73
+            'encryptionEnabled' => $this->encryptionManager->isEnabled(),
74
+            'visibilityType' => BackendService::VISIBILITY_PERSONAL,
75
+            'storages' => $this->userGlobalStoragesService->getStorages(),
76
+            'backends' => $this->backendService->getAvailableBackends(),
77
+            'authMechanisms' => $this->backendService->getAuthMechanisms(),
78
+            'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
79
+            'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
80
+            'globalCredentials' => $this->globalAuth->getAuth($uid),
81
+            'globalCredentialsUid' => $uid,
82
+        ];
83 83
 
84
-		return new TemplateResponse('files_external', 'settings', $parameters, '');
85
-	}
84
+        return new TemplateResponse('files_external', 'settings', $parameters, '');
85
+    }
86 86
 
87
-	/**
88
-	 * @return string the section ID, e.g. 'sharing'
89
-	 */
90
-	public function getSection() {
91
-		return 'externalstorages';
92
-	}
87
+    /**
88
+     * @return string the section ID, e.g. 'sharing'
89
+     */
90
+    public function getSection() {
91
+        return 'externalstorages';
92
+    }
93 93
 
94
-	/**
95
-	 * @return int whether the form should be rather on the top or bottom of
96
-	 * the admin section. The forms are arranged in ascending order of the
97
-	 * priority values. It is required to return a value between 0 and 100.
98
-	 *
99
-	 * E.g.: 70
100
-	 */
101
-	public function getPriority() {
102
-		return 40;
103
-	}
94
+    /**
95
+     * @return int whether the form should be rather on the top or bottom of
96
+     * the admin section. The forms are arranged in ascending order of the
97
+     * priority values. It is required to return a value between 0 and 100.
98
+     *
99
+     * E.g.: 70
100
+     */
101
+    public function getPriority() {
102
+        return 40;
103
+    }
104 104
 }
Please login to merge, or discard this patch.
apps/updatenotification/lib/UpdateChecker.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -32,60 +32,60 @@
 block discarded – undo
32 32
 use OC\Updater\VersionCheck;
33 33
 
34 34
 class UpdateChecker {
35
-	/** @var VersionCheck */
36
-	private $updater;
37
-	/** @var ChangesCheck */
38
-	private $changesCheck;
35
+    /** @var VersionCheck */
36
+    private $updater;
37
+    /** @var ChangesCheck */
38
+    private $changesCheck;
39 39
 
40
-	/**
41
-	 * @param VersionCheck $updater
42
-	 */
43
-	public function __construct(VersionCheck $updater, ChangesCheck $changesCheck) {
44
-		$this->updater = $updater;
45
-		$this->changesCheck = $changesCheck;
46
-	}
40
+    /**
41
+     * @param VersionCheck $updater
42
+     */
43
+    public function __construct(VersionCheck $updater, ChangesCheck $changesCheck) {
44
+        $this->updater = $updater;
45
+        $this->changesCheck = $changesCheck;
46
+    }
47 47
 
48
-	/**
49
-	 * @return array
50
-	 */
51
-	public function getUpdateState(): array {
52
-		$data = $this->updater->check();
53
-		$result = [];
48
+    /**
49
+     * @return array
50
+     */
51
+    public function getUpdateState(): array {
52
+        $data = $this->updater->check();
53
+        $result = [];
54 54
 
55
-		if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
56
-			$result['updateAvailable'] = true;
57
-			$result['updateVersion'] = $data['version'];
58
-			$result['updateVersionString'] = $data['versionstring'];
59
-			$result['updaterEnabled'] = $data['autoupdater'] === '1';
60
-			$result['versionIsEol'] = $data['eol'] === '1';
61
-			if (strpos($data['web'], 'https://') === 0) {
62
-				$result['updateLink'] = $data['web'];
63
-			}
64
-			if (strpos($data['url'], 'https://') === 0) {
65
-				$result['downloadLink'] = $data['url'];
66
-			}
67
-			if (strpos($data['changes'], 'https://') === 0) {
68
-				try {
69
-					$result['changes'] = $this->changesCheck->check($data['changes'], $data['version']);
70
-				} catch (\Exception $e) {
71
-					// no info, not a problem
72
-				}
73
-			}
55
+        if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
56
+            $result['updateAvailable'] = true;
57
+            $result['updateVersion'] = $data['version'];
58
+            $result['updateVersionString'] = $data['versionstring'];
59
+            $result['updaterEnabled'] = $data['autoupdater'] === '1';
60
+            $result['versionIsEol'] = $data['eol'] === '1';
61
+            if (strpos($data['web'], 'https://') === 0) {
62
+                $result['updateLink'] = $data['web'];
63
+            }
64
+            if (strpos($data['url'], 'https://') === 0) {
65
+                $result['downloadLink'] = $data['url'];
66
+            }
67
+            if (strpos($data['changes'], 'https://') === 0) {
68
+                try {
69
+                    $result['changes'] = $this->changesCheck->check($data['changes'], $data['version']);
70
+                } catch (\Exception $e) {
71
+                    // no info, not a problem
72
+                }
73
+            }
74 74
 
75
-			return $result;
76
-		}
75
+            return $result;
76
+        }
77 77
 
78
-		return [];
79
-	}
78
+        return [];
79
+    }
80 80
 
81
-	/**
82
-	 * @param array $data
83
-	 */
84
-	public function populateJavaScriptVariables(array $data) {
85
-		$data['array']['oc_updateState'] = json_encode([
86
-			'updateAvailable' => true,
87
-			'updateVersion' => $this->getUpdateState()['updateVersionString'],
88
-			'updateLink' => $this->getUpdateState()['updateLink'] ?? '',
89
-		]);
90
-	}
81
+    /**
82
+     * @param array $data
83
+     */
84
+    public function populateJavaScriptVariables(array $data) {
85
+        $data['array']['oc_updateState'] = json_encode([
86
+            'updateAvailable' => true,
87
+            'updateVersion' => $this->getUpdateState()['updateVersionString'],
88
+            'updateLink' => $this->getUpdateState()['updateLink'] ?? '',
89
+        ]);
90
+    }
91 91
 }
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/HasPhotoPlugin.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -38,69 +38,69 @@
 block discarded – undo
38 38
 
39 39
 class HasPhotoPlugin extends ServerPlugin {
40 40
 
41
-	/** @var Server */
42
-	protected $server;
41
+    /** @var Server */
42
+    protected $server;
43 43
 
44
-	/**
45
-	 * Initializes the plugin and registers event handlers
46
-	 *
47
-	 * @param Server $server
48
-	 * @return void
49
-	 */
50
-	public function initialize(Server $server) {
51
-		$server->on('propFind', [$this, 'propFind']);
52
-	}
44
+    /**
45
+     * Initializes the plugin and registers event handlers
46
+     *
47
+     * @param Server $server
48
+     * @return void
49
+     */
50
+    public function initialize(Server $server) {
51
+        $server->on('propFind', [$this, 'propFind']);
52
+    }
53 53
 
54
-	/**
55
-	 * Adds all CardDAV-specific properties
56
-	 *
57
-	 * @param PropFind $propFind
58
-	 * @param INode $node
59
-	 * @return void
60
-	 */
61
-	public function propFind(PropFind $propFind, INode $node) {
62
-		$ns = '{http://nextcloud.com/ns}';
54
+    /**
55
+     * Adds all CardDAV-specific properties
56
+     *
57
+     * @param PropFind $propFind
58
+     * @param INode $node
59
+     * @return void
60
+     */
61
+    public function propFind(PropFind $propFind, INode $node) {
62
+        $ns = '{http://nextcloud.com/ns}';
63 63
 
64
-		if ($node instanceof Card) {
65
-			$propFind->handle($ns . 'has-photo', function () use ($node) {
66
-				$vcard = Reader::read($node->get());
67
-				return $vcard instanceof VCard
68
-					&& $vcard->PHOTO
69
-					// Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/
70
-					&& (strpos($vcard->PHOTO->getValue(), 'data:') !== 0
71
-						|| strpos($vcard->PHOTO->getValue(), 'data:image/') === 0)
72
-				;
73
-			});
74
-		}
75
-	}
64
+        if ($node instanceof Card) {
65
+            $propFind->handle($ns . 'has-photo', function () use ($node) {
66
+                $vcard = Reader::read($node->get());
67
+                return $vcard instanceof VCard
68
+                    && $vcard->PHOTO
69
+                    // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/
70
+                    && (strpos($vcard->PHOTO->getValue(), 'data:') !== 0
71
+                        || strpos($vcard->PHOTO->getValue(), 'data:image/') === 0)
72
+                ;
73
+            });
74
+        }
75
+    }
76 76
 
77
-	/**
78
-	 * Returns a plugin name.
79
-	 *
80
-	 * Using this name other plugins will be able to access other plugins
81
-	 * using \Sabre\DAV\Server::getPlugin
82
-	 *
83
-	 * @return string
84
-	 */
85
-	public function getPluginName() {
86
-		return 'vcard-has-photo';
87
-	}
77
+    /**
78
+     * Returns a plugin name.
79
+     *
80
+     * Using this name other plugins will be able to access other plugins
81
+     * using \Sabre\DAV\Server::getPlugin
82
+     *
83
+     * @return string
84
+     */
85
+    public function getPluginName() {
86
+        return 'vcard-has-photo';
87
+    }
88 88
 
89
-	/**
90
-	 * Returns a bunch of meta-data about the plugin.
91
-	 *
92
-	 * Providing this information is optional, and is mainly displayed by the
93
-	 * Browser plugin.
94
-	 *
95
-	 * The description key in the returned array may contain html and will not
96
-	 * be sanitized.
97
-	 *
98
-	 * @return array
99
-	 */
100
-	public function getPluginInfo() {
101
-		return [
102
-			'name' => $this->getPluginName(),
103
-			'description' => 'Return a boolean stating if the vcard have a photo property set or not.'
104
-		];
105
-	}
89
+    /**
90
+     * Returns a bunch of meta-data about the plugin.
91
+     *
92
+     * Providing this information is optional, and is mainly displayed by the
93
+     * Browser plugin.
94
+     *
95
+     * The description key in the returned array may contain html and will not
96
+     * be sanitized.
97
+     *
98
+     * @return array
99
+     */
100
+    public function getPluginInfo() {
101
+        return [
102
+            'name' => $this->getPluginName(),
103
+            'description' => 'Return a boolean stating if the vcard have a photo property set or not.'
104
+        ];
105
+    }
106 106
 }
Please login to merge, or discard this patch.
lib/private/Route/Route.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -33,128 +33,128 @@
 block discarded – undo
33 33
 use Symfony\Component\Routing\Route as SymfonyRoute;
34 34
 
35 35
 class Route extends SymfonyRoute implements IRoute {
36
-	/**
37
-	 * Specify the method when this route is to be used
38
-	 *
39
-	 * @param string $method HTTP method (uppercase)
40
-	 * @return \OC\Route\Route
41
-	 */
42
-	public function method($method) {
43
-		$this->setMethods($method);
44
-		return $this;
45
-	}
36
+    /**
37
+     * Specify the method when this route is to be used
38
+     *
39
+     * @param string $method HTTP method (uppercase)
40
+     * @return \OC\Route\Route
41
+     */
42
+    public function method($method) {
43
+        $this->setMethods($method);
44
+        return $this;
45
+    }
46 46
 
47
-	/**
48
-	 * Specify POST as the method to use with this route
49
-	 * @return \OC\Route\Route
50
-	 */
51
-	public function post() {
52
-		$this->method('POST');
53
-		return $this;
54
-	}
47
+    /**
48
+     * Specify POST as the method to use with this route
49
+     * @return \OC\Route\Route
50
+     */
51
+    public function post() {
52
+        $this->method('POST');
53
+        return $this;
54
+    }
55 55
 
56
-	/**
57
-	 * Specify GET as the method to use with this route
58
-	 * @return \OC\Route\Route
59
-	 */
60
-	public function get() {
61
-		$this->method('GET');
62
-		return $this;
63
-	}
56
+    /**
57
+     * Specify GET as the method to use with this route
58
+     * @return \OC\Route\Route
59
+     */
60
+    public function get() {
61
+        $this->method('GET');
62
+        return $this;
63
+    }
64 64
 
65
-	/**
66
-	 * Specify PUT as the method to use with this route
67
-	 * @return \OC\Route\Route
68
-	 */
69
-	public function put() {
70
-		$this->method('PUT');
71
-		return $this;
72
-	}
65
+    /**
66
+     * Specify PUT as the method to use with this route
67
+     * @return \OC\Route\Route
68
+     */
69
+    public function put() {
70
+        $this->method('PUT');
71
+        return $this;
72
+    }
73 73
 
74
-	/**
75
-	 * Specify DELETE as the method to use with this route
76
-	 * @return \OC\Route\Route
77
-	 */
78
-	public function delete() {
79
-		$this->method('DELETE');
80
-		return $this;
81
-	}
74
+    /**
75
+     * Specify DELETE as the method to use with this route
76
+     * @return \OC\Route\Route
77
+     */
78
+    public function delete() {
79
+        $this->method('DELETE');
80
+        return $this;
81
+    }
82 82
 
83
-	/**
84
-	 * Specify PATCH as the method to use with this route
85
-	 * @return \OC\Route\Route
86
-	 */
87
-	public function patch() {
88
-		$this->method('PATCH');
89
-		return $this;
90
-	}
83
+    /**
84
+     * Specify PATCH as the method to use with this route
85
+     * @return \OC\Route\Route
86
+     */
87
+    public function patch() {
88
+        $this->method('PATCH');
89
+        return $this;
90
+    }
91 91
 
92
-	/**
93
-	 * Defaults to use for this route
94
-	 *
95
-	 * @param array $defaults The defaults
96
-	 * @return \OC\Route\Route
97
-	 */
98
-	public function defaults($defaults) {
99
-		$action = $this->getDefault('action');
100
-		$this->setDefaults($defaults);
101
-		if (isset($defaults['action'])) {
102
-			$action = $defaults['action'];
103
-		}
104
-		$this->action($action);
105
-		return $this;
106
-	}
92
+    /**
93
+     * Defaults to use for this route
94
+     *
95
+     * @param array $defaults The defaults
96
+     * @return \OC\Route\Route
97
+     */
98
+    public function defaults($defaults) {
99
+        $action = $this->getDefault('action');
100
+        $this->setDefaults($defaults);
101
+        if (isset($defaults['action'])) {
102
+            $action = $defaults['action'];
103
+        }
104
+        $this->action($action);
105
+        return $this;
106
+    }
107 107
 
108
-	/**
109
-	 * Requirements for this route
110
-	 *
111
-	 * @param array $requirements The requirements
112
-	 * @return \OC\Route\Route
113
-	 */
114
-	public function requirements($requirements) {
115
-		$method = $this->getMethods();
116
-		$this->setRequirements($requirements);
117
-		if (isset($requirements['_method'])) {
118
-			$method = $requirements['_method'];
119
-		}
120
-		if ($method) {
121
-			$this->method($method);
122
-		}
123
-		return $this;
124
-	}
108
+    /**
109
+     * Requirements for this route
110
+     *
111
+     * @param array $requirements The requirements
112
+     * @return \OC\Route\Route
113
+     */
114
+    public function requirements($requirements) {
115
+        $method = $this->getMethods();
116
+        $this->setRequirements($requirements);
117
+        if (isset($requirements['_method'])) {
118
+            $method = $requirements['_method'];
119
+        }
120
+        if ($method) {
121
+            $this->method($method);
122
+        }
123
+        return $this;
124
+    }
125 125
 
126
-	/**
127
-	 * The action to execute when this route matches
128
-	 *
129
-	 * @param string|callable $class the class or a callable
130
-	 * @param string $function the function to use with the class
131
-	 * @return \OC\Route\Route
132
-	 *
133
-	 * This function is called with $class set to a callable or
134
-	 * to the class with $function
135
-	 */
136
-	public function action($class, $function = null) {
137
-		$action = [$class, $function];
138
-		if (is_null($function)) {
139
-			$action = $class;
140
-		}
141
-		$this->setDefault('action', $action);
142
-		return $this;
143
-	}
126
+    /**
127
+     * The action to execute when this route matches
128
+     *
129
+     * @param string|callable $class the class or a callable
130
+     * @param string $function the function to use with the class
131
+     * @return \OC\Route\Route
132
+     *
133
+     * This function is called with $class set to a callable or
134
+     * to the class with $function
135
+     */
136
+    public function action($class, $function = null) {
137
+        $action = [$class, $function];
138
+        if (is_null($function)) {
139
+            $action = $class;
140
+        }
141
+        $this->setDefault('action', $action);
142
+        return $this;
143
+    }
144 144
 
145
-	/**
146
-	 * The action to execute when this route matches, includes a file like
147
-	 * it is called directly
148
-	 * @param string $file
149
-	 * @return void
150
-	 */
151
-	public function actionInclude($file) {
152
-		$function = function ($param) use ($file) {
153
-			unset($param["_route"]);
154
-			$_GET = array_merge($_GET, $param);
155
-			unset($param);
156
-			require_once "$file";
157
-		} ;
158
-		$this->action($function);
159
-	}
145
+    /**
146
+     * The action to execute when this route matches, includes a file like
147
+     * it is called directly
148
+     * @param string $file
149
+     * @return void
150
+     */
151
+    public function actionInclude($file) {
152
+        $function = function ($param) use ($file) {
153
+            unset($param["_route"]);
154
+            $_GET = array_merge($_GET, $param);
155
+            unset($param);
156
+            require_once "$file";
157
+        } ;
158
+        $this->action($function);
159
+    }
160 160
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Http.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -33,99 +33,99 @@
 block discarded – undo
33 33
 use OCP\AppFramework\Http as BaseHttp;
34 34
 
35 35
 class Http extends BaseHttp {
36
-	private $server;
37
-	private $protocolVersion;
38
-	protected $headers;
36
+    private $server;
37
+    private $protocolVersion;
38
+    protected $headers;
39 39
 
40
-	/**
41
-	 * @param array $server $_SERVER
42
-	 * @param string $protocolVersion the http version to use defaults to HTTP/1.1
43
-	 */
44
-	public function __construct($server, $protocolVersion = 'HTTP/1.1') {
45
-		$this->server = $server;
46
-		$this->protocolVersion = $protocolVersion;
40
+    /**
41
+     * @param array $server $_SERVER
42
+     * @param string $protocolVersion the http version to use defaults to HTTP/1.1
43
+     */
44
+    public function __construct($server, $protocolVersion = 'HTTP/1.1') {
45
+        $this->server = $server;
46
+        $this->protocolVersion = $protocolVersion;
47 47
 
48
-		$this->headers = [
49
-			self::STATUS_CONTINUE => 'Continue',
50
-			self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols',
51
-			self::STATUS_PROCESSING => 'Processing',
52
-			self::STATUS_OK => 'OK',
53
-			self::STATUS_CREATED => 'Created',
54
-			self::STATUS_ACCEPTED => 'Accepted',
55
-			self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information',
56
-			self::STATUS_NO_CONTENT => 'No Content',
57
-			self::STATUS_RESET_CONTENT => 'Reset Content',
58
-			self::STATUS_PARTIAL_CONTENT => 'Partial Content',
59
-			self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918
60
-			self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842
61
-			self::STATUS_IM_USED => 'IM Used', // RFC 3229
62
-			self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices',
63
-			self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently',
64
-			self::STATUS_FOUND => 'Found',
65
-			self::STATUS_SEE_OTHER => 'See Other',
66
-			self::STATUS_NOT_MODIFIED => 'Not Modified',
67
-			self::STATUS_USE_PROXY => 'Use Proxy',
68
-			self::STATUS_RESERVED => 'Reserved',
69
-			self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect',
70
-			self::STATUS_BAD_REQUEST => 'Bad request',
71
-			self::STATUS_UNAUTHORIZED => 'Unauthorized',
72
-			self::STATUS_PAYMENT_REQUIRED => 'Payment Required',
73
-			self::STATUS_FORBIDDEN => 'Forbidden',
74
-			self::STATUS_NOT_FOUND => 'Not Found',
75
-			self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed',
76
-			self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable',
77
-			self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required',
78
-			self::STATUS_REQUEST_TIMEOUT => 'Request Timeout',
79
-			self::STATUS_CONFLICT => 'Conflict',
80
-			self::STATUS_GONE => 'Gone',
81
-			self::STATUS_LENGTH_REQUIRED => 'Length Required',
82
-			self::STATUS_PRECONDITION_FAILED => 'Precondition failed',
83
-			self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large',
84
-			self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long',
85
-			self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type',
86
-			self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable',
87
-			self::STATUS_EXPECTATION_FAILED => 'Expectation Failed',
88
-			self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324
89
-			self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918
90
-			self::STATUS_LOCKED => 'Locked', // RFC 4918
91
-			self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918
92
-			self::STATUS_UPGRADE_REQUIRED => 'Upgrade required',
93
-			self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status
94
-			self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status
95
-			self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status
96
-			self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error',
97
-			self::STATUS_NOT_IMPLEMENTED => 'Not Implemented',
98
-			self::STATUS_BAD_GATEWAY => 'Bad Gateway',
99
-			self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable',
100
-			self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout',
101
-			self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported',
102
-			self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates',
103
-			self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918
104
-			self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842
105
-			self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard
106
-			self::STATUS_NOT_EXTENDED => 'Not extended',
107
-			self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status
108
-		];
109
-	}
48
+        $this->headers = [
49
+            self::STATUS_CONTINUE => 'Continue',
50
+            self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols',
51
+            self::STATUS_PROCESSING => 'Processing',
52
+            self::STATUS_OK => 'OK',
53
+            self::STATUS_CREATED => 'Created',
54
+            self::STATUS_ACCEPTED => 'Accepted',
55
+            self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information',
56
+            self::STATUS_NO_CONTENT => 'No Content',
57
+            self::STATUS_RESET_CONTENT => 'Reset Content',
58
+            self::STATUS_PARTIAL_CONTENT => 'Partial Content',
59
+            self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918
60
+            self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842
61
+            self::STATUS_IM_USED => 'IM Used', // RFC 3229
62
+            self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices',
63
+            self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently',
64
+            self::STATUS_FOUND => 'Found',
65
+            self::STATUS_SEE_OTHER => 'See Other',
66
+            self::STATUS_NOT_MODIFIED => 'Not Modified',
67
+            self::STATUS_USE_PROXY => 'Use Proxy',
68
+            self::STATUS_RESERVED => 'Reserved',
69
+            self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect',
70
+            self::STATUS_BAD_REQUEST => 'Bad request',
71
+            self::STATUS_UNAUTHORIZED => 'Unauthorized',
72
+            self::STATUS_PAYMENT_REQUIRED => 'Payment Required',
73
+            self::STATUS_FORBIDDEN => 'Forbidden',
74
+            self::STATUS_NOT_FOUND => 'Not Found',
75
+            self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed',
76
+            self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable',
77
+            self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required',
78
+            self::STATUS_REQUEST_TIMEOUT => 'Request Timeout',
79
+            self::STATUS_CONFLICT => 'Conflict',
80
+            self::STATUS_GONE => 'Gone',
81
+            self::STATUS_LENGTH_REQUIRED => 'Length Required',
82
+            self::STATUS_PRECONDITION_FAILED => 'Precondition failed',
83
+            self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large',
84
+            self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long',
85
+            self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type',
86
+            self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable',
87
+            self::STATUS_EXPECTATION_FAILED => 'Expectation Failed',
88
+            self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324
89
+            self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918
90
+            self::STATUS_LOCKED => 'Locked', // RFC 4918
91
+            self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918
92
+            self::STATUS_UPGRADE_REQUIRED => 'Upgrade required',
93
+            self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status
94
+            self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status
95
+            self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status
96
+            self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error',
97
+            self::STATUS_NOT_IMPLEMENTED => 'Not Implemented',
98
+            self::STATUS_BAD_GATEWAY => 'Bad Gateway',
99
+            self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable',
100
+            self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout',
101
+            self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported',
102
+            self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates',
103
+            self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918
104
+            self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842
105
+            self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard
106
+            self::STATUS_NOT_EXTENDED => 'Not extended',
107
+            self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status
108
+        ];
109
+    }
110 110
 
111 111
 
112
-	/**
113
-	 * Gets the correct header
114
-	 * @param int Http::CONSTANT $status the constant from the Http class
115
-	 * @param \DateTime $lastModified formatted last modified date
116
-	 * @param string $ETag the etag
117
-	 * @return string
118
-	 */
119
-	public function getStatusHeader($status) {
120
-		// we have one change currently for the http 1.0 header that differs
121
-		// from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND
122
-		// if this differs any more, we want to create childclasses for this
123
-		if ($status === self::STATUS_TEMPORARY_REDIRECT
124
-			&& $this->protocolVersion === 'HTTP/1.0') {
125
-			$status = self::STATUS_FOUND;
126
-		}
112
+    /**
113
+     * Gets the correct header
114
+     * @param int Http::CONSTANT $status the constant from the Http class
115
+     * @param \DateTime $lastModified formatted last modified date
116
+     * @param string $ETag the etag
117
+     * @return string
118
+     */
119
+    public function getStatusHeader($status) {
120
+        // we have one change currently for the http 1.0 header that differs
121
+        // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND
122
+        // if this differs any more, we want to create childclasses for this
123
+        if ($status === self::STATUS_TEMPORARY_REDIRECT
124
+            && $this->protocolVersion === 'HTTP/1.0') {
125
+            $status = self::STATUS_FOUND;
126
+        }
127 127
 
128
-		return $this->protocolVersion . ' ' . $status . ' ' .
129
-			$this->headers[$status];
130
-	}
128
+        return $this->protocolVersion . ' ' . $status . ' ' .
129
+            $this->headers[$status];
130
+    }
131 131
 }
Please login to merge, or discard this patch.
lib/private/Collaboration/AutoComplete/Manager.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -29,54 +29,54 @@
 block discarded – undo
29 29
 use OCP\IServerContainer;
30 30
 
31 31
 class Manager implements IManager {
32
-	/** @var string[] */
33
-	protected $sorters = [];
32
+    /** @var string[] */
33
+    protected $sorters = [];
34 34
 
35
-	/** @var ISorter[]  */
36
-	protected $sorterInstances = [];
37
-	/** @var IServerContainer */
38
-	private $c;
35
+    /** @var ISorter[]  */
36
+    protected $sorterInstances = [];
37
+    /** @var IServerContainer */
38
+    private $c;
39 39
 
40
-	public function __construct(IServerContainer $container) {
41
-		$this->c = $container;
42
-	}
40
+    public function __construct(IServerContainer $container) {
41
+        $this->c = $container;
42
+    }
43 43
 
44
-	public function runSorters(array $sorters, array &$sortArray, array $context) {
45
-		$sorterInstances = $this->getSorters();
46
-		while ($sorter = array_shift($sorters)) {
47
-			if (isset($sorterInstances[$sorter])) {
48
-				$sorterInstances[$sorter]->sort($sortArray, $context);
49
-			} else {
50
-				$this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [
51
-					'app' => 'core', 'id' => $sorter
52
-				]);
53
-			}
54
-		}
55
-	}
44
+    public function runSorters(array $sorters, array &$sortArray, array $context) {
45
+        $sorterInstances = $this->getSorters();
46
+        while ($sorter = array_shift($sorters)) {
47
+            if (isset($sorterInstances[$sorter])) {
48
+                $sorterInstances[$sorter]->sort($sortArray, $context);
49
+            } else {
50
+                $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [
51
+                    'app' => 'core', 'id' => $sorter
52
+                ]);
53
+            }
54
+        }
55
+    }
56 56
 
57
-	public function registerSorter($className) {
58
-		$this->sorters[] = $className;
59
-	}
57
+    public function registerSorter($className) {
58
+        $this->sorters[] = $className;
59
+    }
60 60
 
61
-	protected function getSorters() {
62
-		if (count($this->sorterInstances) === 0) {
63
-			foreach ($this->sorters as $sorter) {
64
-				/** @var ISorter $instance */
65
-				$instance = $this->c->resolve($sorter);
66
-				if (!$instance instanceof ISorter) {
67
-					$this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}',
68
-						['app' => 'core', 'class' => $sorter]);
69
-					continue;
70
-				}
71
-				$sorterId = trim($instance->getId());
72
-				if (trim($sorterId) === '') {
73
-					$this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}',
74
-						['app' => 'core', 'class' => $sorter]);
75
-					continue;
76
-				}
77
-				$this->sorterInstances[$sorterId] = $instance;
78
-			}
79
-		}
80
-		return $this->sorterInstances;
81
-	}
61
+    protected function getSorters() {
62
+        if (count($this->sorterInstances) === 0) {
63
+            foreach ($this->sorters as $sorter) {
64
+                /** @var ISorter $instance */
65
+                $instance = $this->c->resolve($sorter);
66
+                if (!$instance instanceof ISorter) {
67
+                    $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}',
68
+                        ['app' => 'core', 'class' => $sorter]);
69
+                    continue;
70
+                }
71
+                $sorterId = trim($instance->getId());
72
+                if (trim($sorterId) === '') {
73
+                    $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}',
74
+                        ['app' => 'core', 'class' => $sorter]);
75
+                    continue;
76
+                }
77
+                $this->sorterInstances[$sorterId] = $instance;
78
+            }
79
+        }
80
+        return $this->sorterInstances;
81
+    }
82 82
 }
Please login to merge, or discard this patch.