Completed
Pull Request — master (#10075)
by
unknown
27:10
created
lib/public/Files/StorageConnectionException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
  */
28 28
 class StorageConnectionException extends StorageNotAvailableException {
29 29
 
30
-	/**
31
-	 * StorageConnectionException constructor.
32
-	 *
33
-	 * @param string $message
34
-	 * @param \Exception|null $previous
35
-	 * @since 9.0.0
36
-	 */
37
-	public function __construct($message = '', \Exception $previous = null) {
38
-		$l = \OC::$server->getL10N('core');
39
-		parent::__construct($l->t('Storage connection error. %s', [$message]), self::STATUS_NETWORK_ERROR, $previous);
40
-	}
30
+    /**
31
+     * StorageConnectionException constructor.
32
+     *
33
+     * @param string $message
34
+     * @param \Exception|null $previous
35
+     * @since 9.0.0
36
+     */
37
+    public function __construct($message = '', \Exception $previous = null) {
38
+        $l = \OC::$server->getL10N('core');
39
+        parent::__construct($l->t('Storage connection error. %s', [$message]), self::STATUS_NETWORK_ERROR, $previous);
40
+    }
41 41
 }
Please login to merge, or discard this patch.
settings/Controller/CertificateController.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -37,144 +37,144 @@
 block discarded – undo
37 37
  * @package OC\Settings\Controller
38 38
  */
39 39
 class CertificateController extends Controller {
40
-	/** @var ICertificateManager */
41
-	private $userCertificateManager;
42
-	/** @var ICertificateManager  */
43
-	private $systemCertificateManager;
44
-	/** @var IL10N */
45
-	private $l10n;
46
-	/** @var IAppManager */
47
-	private $appManager;
48
-
49
-	/**
50
-	 * @param string $appName
51
-	 * @param IRequest $request
52
-	 * @param ICertificateManager $userCertificateManager
53
-	 * @param ICertificateManager $systemCertificateManager
54
-	 * @param IL10N $l10n
55
-	 * @param IAppManager $appManager
56
-	 */
57
-	public function __construct($appName,
58
-								IRequest $request,
59
-								ICertificateManager $userCertificateManager,
60
-								ICertificateManager $systemCertificateManager,
61
-								IL10N $l10n,
62
-								IAppManager $appManager) {
63
-		parent::__construct($appName, $request);
64
-		$this->userCertificateManager = $userCertificateManager;
65
-		$this->systemCertificateManager = $systemCertificateManager;
66
-		$this->l10n = $l10n;
67
-		$this->appManager = $appManager;
68
-	}
69
-
70
-	/**
71
-	 * Add a new personal root certificate to the users' trust store
72
-	 *
73
-	 * @NoAdminRequired
74
-	 * @NoSubadminRequired
75
-	 * @return DataResponse
76
-	 */
77
-	public function addPersonalRootCertificate() {
78
-		return $this->addCertificate($this->userCertificateManager);
79
-	}
80
-
81
-	/**
82
-	 * Add a new root certificate to a trust store
83
-	 *
84
-	 * @param ICertificateManager $certificateManager
85
-	 * @return DataResponse
86
-	 */
87
-	private function addCertificate(ICertificateManager $certificateManager) {
88
-		$headers = [];
89
-
90
-		if ($this->isCertificateImportAllowed() === false) {
91
-			return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
92
-		}
93
-
94
-		$file = $this->request->getUploadedFile('rootcert_import');
95
-		if (empty($file)) {
96
-			return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
97
-		}
98
-
99
-		try {
100
-			$certificate = $certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
101
-			return new DataResponse(
102
-				[
103
-					'name' => $certificate->getName(),
104
-					'commonName' => $certificate->getCommonName(),
105
-					'organization' => $certificate->getOrganization(),
106
-					'validFrom' => $certificate->getIssueDate()->getTimestamp(),
107
-					'validTill' => $certificate->getExpireDate()->getTimestamp(),
108
-					'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()),
109
-					'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()),
110
-					'issuer' => $certificate->getIssuerName(),
111
-					'issuerOrganization' => $certificate->getIssuerOrganization(),
112
-				],
113
-				Http::STATUS_OK,
114
-				$headers
115
-			);
116
-		} catch (\Exception $e) {
117
-			return new DataResponse(['An error occurred.'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
118
-		}
119
-	}
120
-
121
-	/**
122
-	 * Removes a personal root certificate from the users' trust store
123
-	 *
124
-	 * @NoAdminRequired
125
-	 * @NoSubadminRequired
126
-	 * @param string $certificateIdentifier
127
-	 * @return DataResponse
128
-	 */
129
-	public function removePersonalRootCertificate($certificateIdentifier) {
130
-
131
-		if ($this->isCertificateImportAllowed() === false) {
132
-			return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
133
-		}
134
-
135
-		$this->userCertificateManager->removeCertificate($certificateIdentifier);
136
-		return new DataResponse();
137
-	}
138
-
139
-	/**
140
-	 * check if certificate import is allowed
141
-	 *
142
-	 * @return bool
143
-	 */
144
-	protected function isCertificateImportAllowed() {
145
-		$externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
146
-		if ($externalStorageEnabled) {
147
-			/** @var \OCA\Files_External\Service\BackendService $backendService */
148
-			$backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
149
-			if ($backendService->isUserMountingAllowed()) {
150
-				return true;
151
-			}
152
-		}
153
-		return false;
154
-	}
155
-
156
-	/**
157
-	 * Add a new personal root certificate to the system's trust store
158
-	 *
159
-	 * @return DataResponse
160
-	 */
161
-	public function addSystemRootCertificate() {
162
-		return $this->addCertificate($this->systemCertificateManager);
163
-	}
164
-
165
-	/**
166
-	 * Removes a personal root certificate from the users' trust store
167
-	 *
168
-	 * @param string $certificateIdentifier
169
-	 * @return DataResponse
170
-	 */
171
-	public function removeSystemRootCertificate($certificateIdentifier) {
172
-
173
-		if ($this->isCertificateImportAllowed() === false) {
174
-			return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
175
-		}
176
-
177
-		$this->systemCertificateManager->removeCertificate($certificateIdentifier);
178
-		return new DataResponse();
179
-	}
40
+    /** @var ICertificateManager */
41
+    private $userCertificateManager;
42
+    /** @var ICertificateManager  */
43
+    private $systemCertificateManager;
44
+    /** @var IL10N */
45
+    private $l10n;
46
+    /** @var IAppManager */
47
+    private $appManager;
48
+
49
+    /**
50
+     * @param string $appName
51
+     * @param IRequest $request
52
+     * @param ICertificateManager $userCertificateManager
53
+     * @param ICertificateManager $systemCertificateManager
54
+     * @param IL10N $l10n
55
+     * @param IAppManager $appManager
56
+     */
57
+    public function __construct($appName,
58
+                                IRequest $request,
59
+                                ICertificateManager $userCertificateManager,
60
+                                ICertificateManager $systemCertificateManager,
61
+                                IL10N $l10n,
62
+                                IAppManager $appManager) {
63
+        parent::__construct($appName, $request);
64
+        $this->userCertificateManager = $userCertificateManager;
65
+        $this->systemCertificateManager = $systemCertificateManager;
66
+        $this->l10n = $l10n;
67
+        $this->appManager = $appManager;
68
+    }
69
+
70
+    /**
71
+     * Add a new personal root certificate to the users' trust store
72
+     *
73
+     * @NoAdminRequired
74
+     * @NoSubadminRequired
75
+     * @return DataResponse
76
+     */
77
+    public function addPersonalRootCertificate() {
78
+        return $this->addCertificate($this->userCertificateManager);
79
+    }
80
+
81
+    /**
82
+     * Add a new root certificate to a trust store
83
+     *
84
+     * @param ICertificateManager $certificateManager
85
+     * @return DataResponse
86
+     */
87
+    private function addCertificate(ICertificateManager $certificateManager) {
88
+        $headers = [];
89
+
90
+        if ($this->isCertificateImportAllowed() === false) {
91
+            return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
92
+        }
93
+
94
+        $file = $this->request->getUploadedFile('rootcert_import');
95
+        if (empty($file)) {
96
+            return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
97
+        }
98
+
99
+        try {
100
+            $certificate = $certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
101
+            return new DataResponse(
102
+                [
103
+                    'name' => $certificate->getName(),
104
+                    'commonName' => $certificate->getCommonName(),
105
+                    'organization' => $certificate->getOrganization(),
106
+                    'validFrom' => $certificate->getIssueDate()->getTimestamp(),
107
+                    'validTill' => $certificate->getExpireDate()->getTimestamp(),
108
+                    'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()),
109
+                    'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()),
110
+                    'issuer' => $certificate->getIssuerName(),
111
+                    'issuerOrganization' => $certificate->getIssuerOrganization(),
112
+                ],
113
+                Http::STATUS_OK,
114
+                $headers
115
+            );
116
+        } catch (\Exception $e) {
117
+            return new DataResponse(['An error occurred.'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
118
+        }
119
+    }
120
+
121
+    /**
122
+     * Removes a personal root certificate from the users' trust store
123
+     *
124
+     * @NoAdminRequired
125
+     * @NoSubadminRequired
126
+     * @param string $certificateIdentifier
127
+     * @return DataResponse
128
+     */
129
+    public function removePersonalRootCertificate($certificateIdentifier) {
130
+
131
+        if ($this->isCertificateImportAllowed() === false) {
132
+            return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
133
+        }
134
+
135
+        $this->userCertificateManager->removeCertificate($certificateIdentifier);
136
+        return new DataResponse();
137
+    }
138
+
139
+    /**
140
+     * check if certificate import is allowed
141
+     *
142
+     * @return bool
143
+     */
144
+    protected function isCertificateImportAllowed() {
145
+        $externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
146
+        if ($externalStorageEnabled) {
147
+            /** @var \OCA\Files_External\Service\BackendService $backendService */
148
+            $backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
149
+            if ($backendService->isUserMountingAllowed()) {
150
+                return true;
151
+            }
152
+        }
153
+        return false;
154
+    }
155
+
156
+    /**
157
+     * Add a new personal root certificate to the system's trust store
158
+     *
159
+     * @return DataResponse
160
+     */
161
+    public function addSystemRootCertificate() {
162
+        return $this->addCertificate($this->systemCertificateManager);
163
+    }
164
+
165
+    /**
166
+     * Removes a personal root certificate from the users' trust store
167
+     *
168
+     * @param string $certificateIdentifier
169
+     * @return DataResponse
170
+     */
171
+    public function removeSystemRootCertificate($certificateIdentifier) {
172
+
173
+        if ($this->isCertificateImportAllowed() === false) {
174
+            return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
175
+        }
176
+
177
+        $this->systemCertificateManager->removeCertificate($certificateIdentifier);
178
+        return new DataResponse();
179
+    }
180 180
 }
Please login to merge, or discard this patch.
core/Controller/ContactsMenuController.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -33,46 +33,46 @@
 block discarded – undo
33 33
 
34 34
 class ContactsMenuController extends Controller {
35 35
 
36
-	/** @var Manager */
37
-	private $manager;
36
+    /** @var Manager */
37
+    private $manager;
38 38
 
39
-	/** @var IUserSession */
40
-	private $userSession;
39
+    /** @var IUserSession */
40
+    private $userSession;
41 41
 
42
-	/**
43
-	 * @param IRequest $request
44
-	 * @param IUserSession $userSession
45
-	 * @param Manager $manager
46
-	 */
47
-	public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) {
48
-		parent::__construct('core', $request);
49
-		$this->userSession = $userSession;
50
-		$this->manager = $manager;
51
-	}
42
+    /**
43
+     * @param IRequest $request
44
+     * @param IUserSession $userSession
45
+     * @param Manager $manager
46
+     */
47
+    public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) {
48
+        parent::__construct('core', $request);
49
+        $this->userSession = $userSession;
50
+        $this->manager = $manager;
51
+    }
52 52
 
53
-	/**
54
-	 * @NoAdminRequired
55
-	 *
56
-	 * @param string|null filter
57
-	 * @return \JsonSerializable[]
58
-	 */
59
-	public function index($filter = null) {
60
-		return $this->manager->getEntries($this->userSession->getUser(), $filter);
61
-	}
53
+    /**
54
+     * @NoAdminRequired
55
+     *
56
+     * @param string|null filter
57
+     * @return \JsonSerializable[]
58
+     */
59
+    public function index($filter = null) {
60
+        return $this->manager->getEntries($this->userSession->getUser(), $filter);
61
+    }
62 62
 
63
-	/**
64
-	 * @NoAdminRequired
65
-	 *
66
-	 * @param integer $shareType
67
-	 * @param string $shareWith
68
-	 * @return JSONResponse|\JsonSerializable
69
-	 */
70
-	public function findOne($shareType, $shareWith) {
71
-		$contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith);
63
+    /**
64
+     * @NoAdminRequired
65
+     *
66
+     * @param integer $shareType
67
+     * @param string $shareWith
68
+     * @return JSONResponse|\JsonSerializable
69
+     */
70
+    public function findOne($shareType, $shareWith) {
71
+        $contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith);
72 72
 
73
-		if ($contact) {
74
-			return $contact;
75
-		}
76
-		return new JSONResponse([], Http::STATUS_NOT_FOUND);
77
-	}
73
+        if ($contact) {
74
+            return $contact;
75
+        }
76
+        return new JSONResponse([], Http::STATUS_NOT_FOUND);
77
+    }
78 78
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Notification/Notifier.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,52 +32,52 @@
 block discarded – undo
32 32
 
33 33
 class Notifier implements INotifier {
34 34
 
35
-	/** @var IFactory */
36
-	protected $l10nFactory;
35
+    /** @var IFactory */
36
+    protected $l10nFactory;
37 37
 
38
-	/**
39
-	 * @param IFactory $l10nFactory
40
-	 */
41
-	 public function __construct(\OCP\L10N\IFactory $l10nFactory) {
42
-		$this->l10nFactory = $l10nFactory;
43
-	}
38
+    /**
39
+     * @param IFactory $l10nFactory
40
+     */
41
+        public function __construct(\OCP\L10N\IFactory $l10nFactory) {
42
+        $this->l10nFactory = $l10nFactory;
43
+    }
44 44
 
45
-	/**
46
-	 * @param INotification $notification
47
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
48
-	 * @return INotification
49
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
50
-	 */
51
-	public function prepare(INotification $notification, $languageCode) {
52
-		if ($notification->getApp() !== 'user_ldap') {
53
-			// Not my app => throw
54
-			throw new \InvalidArgumentException();
55
-		}
45
+    /**
46
+     * @param INotification $notification
47
+     * @param string $languageCode The code of the language that should be used to prepare the notification
48
+     * @return INotification
49
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
50
+     */
51
+    public function prepare(INotification $notification, $languageCode) {
52
+        if ($notification->getApp() !== 'user_ldap') {
53
+            // Not my app => throw
54
+            throw new \InvalidArgumentException();
55
+        }
56 56
 
57
-		// Read the language from the notification
58
-		$l = $this->l10nFactory->get('user_ldap', $languageCode);
57
+        // Read the language from the notification
58
+        $l = $this->l10nFactory->get('user_ldap', $languageCode);
59 59
 
60
-		switch ($notification->getSubject()) {
61
-			// Deal with known subjects
62
-			case 'pwd_exp_warn_days':
63
-				$params = $notification->getSubjectParameters();
64
-				$days = (int) $params[0];
65
-				if ($days === 2) {
66
-					$notification->setParsedSubject($l->t('Your password will expire tomorrow.'));
67
-				} else if ($days === 1) {
68
-					$notification->setParsedSubject($l->t('Your password will expire today.'));
69
-				} else {
70
-					$notification->setParsedSubject($l->n(
71
-						'Your password will expire within %n day.',
72
-						'Your password will expire within %n days.',
73
-						$days
74
-					));
75
-				}
76
-				return $notification;
60
+        switch ($notification->getSubject()) {
61
+            // Deal with known subjects
62
+            case 'pwd_exp_warn_days':
63
+                $params = $notification->getSubjectParameters();
64
+                $days = (int) $params[0];
65
+                if ($days === 2) {
66
+                    $notification->setParsedSubject($l->t('Your password will expire tomorrow.'));
67
+                } else if ($days === 1) {
68
+                    $notification->setParsedSubject($l->t('Your password will expire today.'));
69
+                } else {
70
+                    $notification->setParsedSubject($l->n(
71
+                        'Your password will expire within %n day.',
72
+                        'Your password will expire within %n days.',
73
+                        $days
74
+                    ));
75
+                }
76
+                return $notification;
77 77
 
78
-			default:
79
-				// Unknown subject => Unknown notification => throw
80
-				throw new \InvalidArgumentException();
81
-		}
82
-	}
78
+            default:
79
+                // Unknown subject => Unknown notification => throw
80
+                throw new \InvalidArgumentException();
81
+        }
82
+    }
83 83
 }
Please login to merge, or discard this patch.
apps/comments/appinfo/routes.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 
23 23
 return [
24
-	'routes' => [
25
-		['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'],
26
-	]
24
+    'routes' => [
25
+        ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'],
26
+    ]
27 27
 ];
Please login to merge, or discard this patch.
apps/comments/lib/Controller/Notifications.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -40,95 +40,95 @@
 block discarded – undo
40 40
  * @package OCA\Comments\Controller
41 41
  */
42 42
 class Notifications extends Controller {
43
-	/** @var Folder  */
44
-	protected $folder;
43
+    /** @var Folder  */
44
+    protected $folder;
45 45
 
46
-	/** @var ICommentsManager  */
47
-	protected $commentsManager;
46
+    /** @var ICommentsManager  */
47
+    protected $commentsManager;
48 48
 
49
-	/** @var IURLGenerator  */
50
-	protected $urlGenerator;
49
+    /** @var IURLGenerator  */
50
+    protected $urlGenerator;
51 51
 
52
-	/** @var IManager  */
53
-	protected $notificationManager;
52
+    /** @var IManager  */
53
+    protected $notificationManager;
54 54
 
55
-	/** @var IUserSession  */
56
-	protected $userSession;
55
+    /** @var IUserSession  */
56
+    protected $userSession;
57 57
 
58
-	/**
59
-	 * Notifications constructor.
60
-	 *
61
-	 * @param string $appName
62
-	 * @param IRequest $request
63
-	 * @param ICommentsManager $commentsManager
64
-	 * @param Folder $folder
65
-	 * @param IURLGenerator $urlGenerator
66
-	 * @param IManager $notificationManager
67
-	 * @param IUserSession $userSession
68
-	 */
69
-	public function __construct(
70
-		$appName,
71
-		IRequest $request,
72
-		ICommentsManager $commentsManager,
73
-		Folder $folder,
74
-		IURLGenerator $urlGenerator,
75
-		IManager $notificationManager,
76
-		IUserSession $userSession
77
-	) {
78
-		parent::__construct($appName, $request);
79
-		$this->commentsManager = $commentsManager;
80
-		$this->folder = $folder;
81
-		$this->urlGenerator = $urlGenerator;
82
-		$this->notificationManager = $notificationManager;
83
-		$this->userSession = $userSession;
84
-	}
58
+    /**
59
+     * Notifications constructor.
60
+     *
61
+     * @param string $appName
62
+     * @param IRequest $request
63
+     * @param ICommentsManager $commentsManager
64
+     * @param Folder $folder
65
+     * @param IURLGenerator $urlGenerator
66
+     * @param IManager $notificationManager
67
+     * @param IUserSession $userSession
68
+     */
69
+    public function __construct(
70
+        $appName,
71
+        IRequest $request,
72
+        ICommentsManager $commentsManager,
73
+        Folder $folder,
74
+        IURLGenerator $urlGenerator,
75
+        IManager $notificationManager,
76
+        IUserSession $userSession
77
+    ) {
78
+        parent::__construct($appName, $request);
79
+        $this->commentsManager = $commentsManager;
80
+        $this->folder = $folder;
81
+        $this->urlGenerator = $urlGenerator;
82
+        $this->notificationManager = $notificationManager;
83
+        $this->userSession = $userSession;
84
+    }
85 85
 
86
-	/**
87
-	 * @NoAdminRequired
88
-	 * @NoCSRFRequired
89
-	 *
90
-	 * @param string $id		the comment ID
91
-	 * @return Response
92
-	 */
93
-	public function view($id) {
94
-		try {
95
-			$comment = $this->commentsManager->get($id);
96
-			if($comment->getObjectType() !== 'files') {
97
-				return new NotFoundResponse();
98
-			}
99
-			$files = $this->folder->getById((int)$comment->getObjectId());
100
-			if(count($files) === 0) {
101
-				$this->markProcessed($comment);
102
-				return new NotFoundResponse();
103
-			}
86
+    /**
87
+     * @NoAdminRequired
88
+     * @NoCSRFRequired
89
+     *
90
+     * @param string $id		the comment ID
91
+     * @return Response
92
+     */
93
+    public function view($id) {
94
+        try {
95
+            $comment = $this->commentsManager->get($id);
96
+            if($comment->getObjectType() !== 'files') {
97
+                return new NotFoundResponse();
98
+            }
99
+            $files = $this->folder->getById((int)$comment->getObjectId());
100
+            if(count($files) === 0) {
101
+                $this->markProcessed($comment);
102
+                return new NotFoundResponse();
103
+            }
104 104
 
105
-			$url = $this->urlGenerator->linkToRouteAbsolute(
106
-				'files.viewcontroller.showFile',
107
-				[ 'fileid' => $comment->getObjectId() ]
108
-			);
105
+            $url = $this->urlGenerator->linkToRouteAbsolute(
106
+                'files.viewcontroller.showFile',
107
+                [ 'fileid' => $comment->getObjectId() ]
108
+            );
109 109
 
110
-			$this->markProcessed($comment);
110
+            $this->markProcessed($comment);
111 111
 
112
-			return new RedirectResponse($url);
113
-		} catch (\Exception $e) {
114
-			return new NotFoundResponse();
115
-		}
116
-	}
112
+            return new RedirectResponse($url);
113
+        } catch (\Exception $e) {
114
+            return new NotFoundResponse();
115
+        }
116
+    }
117 117
 
118
-	/**
119
-	 * Marks the notification about a comment as processed
120
-	 * @param IComment $comment
121
-	 */
122
-	protected function markProcessed(IComment $comment) {
123
-		$user = $this->userSession->getUser();
124
-		if(is_null($user)) {
125
-			return;
126
-		}
127
-		$notification = $this->notificationManager->createNotification();
128
-		$notification->setApp('comments')
129
-			->setObject('comment', $comment->getId())
130
-			->setSubject('mention')
131
-			->setUser($user->getUID());
132
-		$this->notificationManager->markProcessed($notification);
133
-	}
118
+    /**
119
+     * Marks the notification about a comment as processed
120
+     * @param IComment $comment
121
+     */
122
+    protected function markProcessed(IComment $comment) {
123
+        $user = $this->userSession->getUser();
124
+        if(is_null($user)) {
125
+            return;
126
+        }
127
+        $notification = $this->notificationManager->createNotification();
128
+        $notification->setApp('comments')
129
+            ->setObject('comment', $comment->getId())
130
+            ->setSubject('mention')
131
+            ->setUser($user->getUID());
132
+        $this->notificationManager->markProcessed($notification);
133
+    }
134 134
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 	public function view($id) {
94 94
 		try {
95 95
 			$comment = $this->commentsManager->get($id);
96
-			if($comment->getObjectType() !== 'files') {
96
+			if ($comment->getObjectType() !== 'files') {
97 97
 				return new NotFoundResponse();
98 98
 			}
99
-			$files = $this->folder->getById((int)$comment->getObjectId());
100
-			if(count($files) === 0) {
99
+			$files = $this->folder->getById((int) $comment->getObjectId());
100
+			if (count($files) === 0) {
101 101
 				$this->markProcessed($comment);
102 102
 				return new NotFoundResponse();
103 103
 			}
104 104
 
105 105
 			$url = $this->urlGenerator->linkToRouteAbsolute(
106 106
 				'files.viewcontroller.showFile',
107
-				[ 'fileid' => $comment->getObjectId() ]
107
+				['fileid' => $comment->getObjectId()]
108 108
 			);
109 109
 
110 110
 			$this->markProcessed($comment);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function markProcessed(IComment $comment) {
123 123
 		$user = $this->userSession->getUser();
124
-		if(is_null($user)) {
124
+		if (is_null($user)) {
125 125
 			return;
126 126
 		}
127 127
 		$notification = $this->notificationManager->createNotification();
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/Plugin.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -30,51 +30,51 @@
 block discarded – undo
30 30
 
31 31
 class Plugin extends \Sabre\CardDAV\Plugin {
32 32
 
33
-	function initialize(Server $server) {
34
-		$server->on('propFind', [$this, 'propFind']);
35
-		parent::initialize($server);
36
-	}
33
+    function initialize(Server $server) {
34
+        $server->on('propFind', [$this, 'propFind']);
35
+        parent::initialize($server);
36
+    }
37 37
 
38
-	/**
39
-	 * Returns the addressbook home for a given principal
40
-	 *
41
-	 * @param string $principal
42
-	 * @return string
43
-	 */
44
-	protected function getAddressbookHomeForPrincipal($principal) {
38
+    /**
39
+     * Returns the addressbook home for a given principal
40
+     *
41
+     * @param string $principal
42
+     * @return string
43
+     */
44
+    protected function getAddressbookHomeForPrincipal($principal) {
45 45
 
46
-		if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
47
-			list(, $principalId) = \Sabre\Uri\split($principal);
48
-			return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
49
-		}
50
-		if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) {
51
-			list(, $principalId) = \Sabre\Uri\split($principal);
52
-			return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId;
53
-		}
54
-		if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) {
55
-			list(, $principalId) = \Sabre\Uri\split($principal);
56
-			return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
57
-		}
46
+        if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
47
+            list(, $principalId) = \Sabre\Uri\split($principal);
48
+            return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
49
+        }
50
+        if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) {
51
+            list(, $principalId) = \Sabre\Uri\split($principal);
52
+            return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId;
53
+        }
54
+        if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) {
55
+            list(, $principalId) = \Sabre\Uri\split($principal);
56
+            return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
57
+        }
58 58
 
59
-		throw new \LogicException('This is not supposed to happen');
60
-	}
59
+        throw new \LogicException('This is not supposed to happen');
60
+    }
61 61
 
62
-	/**
63
-	 * Adds all CardDAV-specific properties
64
-	 *
65
-	 * @param PropFind $propFind
66
-	 * @param INode $node
67
-	 * @return void
68
-	 */
69
-	function propFind(PropFind $propFind, INode $node) {
62
+    /**
63
+     * Adds all CardDAV-specific properties
64
+     *
65
+     * @param PropFind $propFind
66
+     * @param INode $node
67
+     * @return void
68
+     */
69
+    function propFind(PropFind $propFind, INode $node) {
70 70
 
71
-		$ns = '{http://owncloud.org/ns}';
71
+        $ns = '{http://owncloud.org/ns}';
72 72
 
73
-		if ($node instanceof AddressBook) {
73
+        if ($node instanceof AddressBook) {
74 74
 
75
-			$propFind->handle($ns . 'groups', function () use ($node) {
76
-				return new Groups($node->getContactsGroups());
77
-			});
78
-		}
79
-	}
75
+            $propFind->handle($ns . 'groups', function () use ($node) {
76
+                return new Groups($node->getContactsGroups());
77
+            });
78
+        }
79
+    }
80 80
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 
46 46
 		if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
47 47
 			list(, $principalId) = \Sabre\Uri\split($principal);
48
-			return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
48
+			return self::ADDRESSBOOK_ROOT.'/users/'.$principalId;
49 49
 		}
50 50
 		if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) {
51 51
 			list(, $principalId) = \Sabre\Uri\split($principal);
52
-			return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId;
52
+			return self::ADDRESSBOOK_ROOT.'/groups/'.$principalId;
53 53
 		}
54 54
 		if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) {
55 55
 			list(, $principalId) = \Sabre\Uri\split($principal);
56
-			return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
56
+			return self::ADDRESSBOOK_ROOT.'/system/'.$principalId;
57 57
 		}
58 58
 
59 59
 		throw new \LogicException('This is not supposed to happen');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		if ($node instanceof AddressBook) {
74 74
 
75
-			$propFind->handle($ns . 'groups', function () use ($node) {
75
+			$propFind->handle($ns.'groups', function() use ($node) {
76 76
 				return new Groups($node->getContactsGroups());
77 77
 			});
78 78
 		}
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Backend.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -57,110 +57,110 @@
 block discarded – undo
57 57
  */
58 58
 class Backend implements \JsonSerializable {
59 59
 
60
-	use VisibilityTrait;
61
-	use FrontendDefinitionTrait;
62
-	use PriorityTrait;
63
-	use DependencyTrait;
64
-	use StorageModifierTrait;
65
-	use IdentifierTrait;
66
-
67
-	/** @var string storage class */
68
-	private $storageClass;
69
-
70
-	/** @var array 'scheme' => true, supported authentication schemes */
71
-	private $authSchemes = [];
72
-
73
-	/** @var AuthMechanism|callable authentication mechanism fallback */
74
-	private $legacyAuthMechanism;
75
-
76
-	/**
77
-	 * @return string
78
-	 */
79
-	public function getStorageClass() {
80
-		return $this->storageClass;
81
-	}
82
-
83
-	/**
84
-	 * @param string $class
85
-	 * @return $this
86
-	 */
87
-	public function setStorageClass($class) {
88
-		$this->storageClass = $class;
89
-		return $this;
90
-	}
91
-
92
-	/**
93
-	 * @return array
94
-	 */
95
-	public function getAuthSchemes() {
96
-		if (empty($this->authSchemes)) {
97
-			return [AuthMechanism::SCHEME_NULL => true];
98
-		}
99
-		return $this->authSchemes;
100
-	}
101
-
102
-	/**
103
-	 * @param string $scheme
104
-	 * @return self
105
-	 */
106
-	public function addAuthScheme($scheme) {
107
-		$this->authSchemes[$scheme] = true;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @param array $parameters storage parameters, for dynamic mechanism selection
113
-	 * @return AuthMechanism
114
-	 */
115
-	public function getLegacyAuthMechanism(array $parameters = []) {
116
-		if (is_callable($this->legacyAuthMechanism)) {
117
-			return call_user_func($this->legacyAuthMechanism, $parameters);
118
-		}
119
-		return $this->legacyAuthMechanism;
120
-	}
121
-
122
-	/**
123
-	 * @param AuthMechanism $authMechanism
124
-	 * @return self
125
-	 */
126
-	public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
127
-		$this->legacyAuthMechanism = $authMechanism;
128
-		return $this;
129
-	}
130
-
131
-	/**
132
-	 * @param callable $callback dynamic auth mechanism selection
133
-	 * @return self
134
-	 */
135
-	public function setLegacyAuthMechanismCallback(callable $callback) {
136
-		$this->legacyAuthMechanism = $callback;
137
-	}
138
-
139
-	/**
140
-	 * Serialize into JSON for client-side JS
141
-	 *
142
-	 * @return array
143
-	 */
144
-	public function jsonSerialize() {
145
-		$data = $this->jsonSerializeDefinition();
146
-		$data += $this->jsonSerializeIdentifier();
147
-
148
-		$data['backend'] = $data['name']; // legacy compat
149
-		$data['priority'] = $this->getPriority();
150
-		$data['authSchemes'] = $this->getAuthSchemes();
151
-
152
-		return $data;
153
-	}
154
-
155
-	/**
156
-	 * Check if parameters are satisfied in a StorageConfig
157
-	 *
158
-	 * @param StorageConfig $storage
159
-	 * @return bool
160
-	 */
161
-	public function validateStorage(StorageConfig $storage) {
162
-		return $this->validateStorageDefinition($storage);
163
-	}
60
+    use VisibilityTrait;
61
+    use FrontendDefinitionTrait;
62
+    use PriorityTrait;
63
+    use DependencyTrait;
64
+    use StorageModifierTrait;
65
+    use IdentifierTrait;
66
+
67
+    /** @var string storage class */
68
+    private $storageClass;
69
+
70
+    /** @var array 'scheme' => true, supported authentication schemes */
71
+    private $authSchemes = [];
72
+
73
+    /** @var AuthMechanism|callable authentication mechanism fallback */
74
+    private $legacyAuthMechanism;
75
+
76
+    /**
77
+     * @return string
78
+     */
79
+    public function getStorageClass() {
80
+        return $this->storageClass;
81
+    }
82
+
83
+    /**
84
+     * @param string $class
85
+     * @return $this
86
+     */
87
+    public function setStorageClass($class) {
88
+        $this->storageClass = $class;
89
+        return $this;
90
+    }
91
+
92
+    /**
93
+     * @return array
94
+     */
95
+    public function getAuthSchemes() {
96
+        if (empty($this->authSchemes)) {
97
+            return [AuthMechanism::SCHEME_NULL => true];
98
+        }
99
+        return $this->authSchemes;
100
+    }
101
+
102
+    /**
103
+     * @param string $scheme
104
+     * @return self
105
+     */
106
+    public function addAuthScheme($scheme) {
107
+        $this->authSchemes[$scheme] = true;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @param array $parameters storage parameters, for dynamic mechanism selection
113
+     * @return AuthMechanism
114
+     */
115
+    public function getLegacyAuthMechanism(array $parameters = []) {
116
+        if (is_callable($this->legacyAuthMechanism)) {
117
+            return call_user_func($this->legacyAuthMechanism, $parameters);
118
+        }
119
+        return $this->legacyAuthMechanism;
120
+    }
121
+
122
+    /**
123
+     * @param AuthMechanism $authMechanism
124
+     * @return self
125
+     */
126
+    public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
127
+        $this->legacyAuthMechanism = $authMechanism;
128
+        return $this;
129
+    }
130
+
131
+    /**
132
+     * @param callable $callback dynamic auth mechanism selection
133
+     * @return self
134
+     */
135
+    public function setLegacyAuthMechanismCallback(callable $callback) {
136
+        $this->legacyAuthMechanism = $callback;
137
+    }
138
+
139
+    /**
140
+     * Serialize into JSON for client-side JS
141
+     *
142
+     * @return array
143
+     */
144
+    public function jsonSerialize() {
145
+        $data = $this->jsonSerializeDefinition();
146
+        $data += $this->jsonSerializeIdentifier();
147
+
148
+        $data['backend'] = $data['name']; // legacy compat
149
+        $data['priority'] = $this->getPriority();
150
+        $data['authSchemes'] = $this->getAuthSchemes();
151
+
152
+        return $data;
153
+    }
154
+
155
+    /**
156
+     * Check if parameters are satisfied in a StorageConfig
157
+     *
158
+     * @param StorageConfig $storage
159
+     * @return bool
160
+     */
161
+    public function validateStorage(StorageConfig $storage) {
162
+        return $this->validateStorageDefinition($storage);
163
+    }
164 164
 
165 165
 }
166 166
 
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/FrontendDefinitionTrait.php 1 patch
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -31,129 +31,129 @@
 block discarded – undo
31 31
  */
32 32
 trait FrontendDefinitionTrait {
33 33
 
34
-	/** @var string human-readable mechanism name */
35
-	private $text;
36
-
37
-	/** @var DefinitionParameter[] parameters for mechanism */
38
-	private $parameters = [];
39
-
40
-	/** @var string[] custom JS */
41
-	private $customJs = [];
42
-
43
-	/**
44
-	 * @return string
45
-	 */
46
-	public function getText() {
47
-		return $this->text;
48
-	}
49
-
50
-	/**
51
-	 * @param string $text
52
-	 * @return $this
53
-	 */
54
-	public function setText($text) {
55
-		$this->text = $text;
56
-		return $this;
57
-	}
58
-
59
-	/**
60
-	 * @param FrontendDefinitionTrait $a
61
-	 * @param FrontendDefinitionTrait $b
62
-	 * @return int
63
-	 */
64
-	public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) {
65
-		return strcmp($a->getText(), $b->getText());
66
-	}
67
-
68
-	/**
69
-	 * @return DefinitionParameter[]
70
-	 */
71
-	public function getParameters() {
72
-		return $this->parameters;
73
-	}
74
-
75
-	/**
76
-	 * @param DefinitionParameter[] $parameters
77
-	 * @return self
78
-	 */
79
-	public function addParameters(array $parameters) {
80
-		foreach ($parameters as $parameter) {
81
-			$this->addParameter($parameter);
82
-		}
83
-		return $this;
84
-	}
85
-
86
-	/**
87
-	 * @param DefinitionParameter $parameter
88
-	 * @return self
89
-	 */
90
-	public function addParameter(DefinitionParameter $parameter) {
91
-		$this->parameters[$parameter->getName()] = $parameter;
92
-		return $this;
93
-	}
94
-
95
-	/**
96
-	 * @return string[]
97
-	 */
98
-	public function getCustomJs() {
99
-		return $this->customJs;
100
-	}
101
-
102
-	/**
103
-	 * @param string $custom
104
-	 * @return self
105
-	 */
106
-	public function addCustomJs($custom) {
107
-		$this->customJs[] = $custom;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @param string $custom
113
-	 * @return self
114
-	 * @deprecated 9.1.0, use addCustomJs() instead
115
-	 */
116
-	public function setCustomJs($custom) {
117
-		$this->customJs = [$custom];
118
-		return $this;
119
-	}
120
-
121
-	/**
122
-	 * Serialize into JSON for client-side JS
123
-	 *
124
-	 * @return array
125
-	 */
126
-	public function jsonSerializeDefinition() {
127
-		$configuration = [];
128
-		foreach ($this->getParameters() as $parameter) {
129
-			$configuration[$parameter->getName()] = $parameter;
130
-		}
131
-
132
-		$data = [
133
-			'name' => $this->getText(),
134
-			'configuration' => $configuration,
135
-			'custom' => $this->getCustomJs(),
136
-		];
137
-		return $data;
138
-	}
139
-
140
-	/**
141
-	 * Check if parameters are satisfied in a StorageConfig
142
-	 *
143
-	 * @param StorageConfig $storage
144
-	 * @return bool
145
-	 */
146
-	public function validateStorageDefinition(StorageConfig $storage) {
147
-		foreach ($this->getParameters() as $name => $parameter) {
148
-			$value = $storage->getBackendOption($name);
149
-			if (!is_null($value) || !$parameter->isOptional()) {
150
-				if (!$parameter->validateValue($value)) {
151
-					return false;
152
-				}
153
-				$storage->setBackendOption($name, $value);
154
-			}
155
-		}
156
-		return true;
157
-	}
34
+    /** @var string human-readable mechanism name */
35
+    private $text;
36
+
37
+    /** @var DefinitionParameter[] parameters for mechanism */
38
+    private $parameters = [];
39
+
40
+    /** @var string[] custom JS */
41
+    private $customJs = [];
42
+
43
+    /**
44
+     * @return string
45
+     */
46
+    public function getText() {
47
+        return $this->text;
48
+    }
49
+
50
+    /**
51
+     * @param string $text
52
+     * @return $this
53
+     */
54
+    public function setText($text) {
55
+        $this->text = $text;
56
+        return $this;
57
+    }
58
+
59
+    /**
60
+     * @param FrontendDefinitionTrait $a
61
+     * @param FrontendDefinitionTrait $b
62
+     * @return int
63
+     */
64
+    public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) {
65
+        return strcmp($a->getText(), $b->getText());
66
+    }
67
+
68
+    /**
69
+     * @return DefinitionParameter[]
70
+     */
71
+    public function getParameters() {
72
+        return $this->parameters;
73
+    }
74
+
75
+    /**
76
+     * @param DefinitionParameter[] $parameters
77
+     * @return self
78
+     */
79
+    public function addParameters(array $parameters) {
80
+        foreach ($parameters as $parameter) {
81
+            $this->addParameter($parameter);
82
+        }
83
+        return $this;
84
+    }
85
+
86
+    /**
87
+     * @param DefinitionParameter $parameter
88
+     * @return self
89
+     */
90
+    public function addParameter(DefinitionParameter $parameter) {
91
+        $this->parameters[$parameter->getName()] = $parameter;
92
+        return $this;
93
+    }
94
+
95
+    /**
96
+     * @return string[]
97
+     */
98
+    public function getCustomJs() {
99
+        return $this->customJs;
100
+    }
101
+
102
+    /**
103
+     * @param string $custom
104
+     * @return self
105
+     */
106
+    public function addCustomJs($custom) {
107
+        $this->customJs[] = $custom;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @param string $custom
113
+     * @return self
114
+     * @deprecated 9.1.0, use addCustomJs() instead
115
+     */
116
+    public function setCustomJs($custom) {
117
+        $this->customJs = [$custom];
118
+        return $this;
119
+    }
120
+
121
+    /**
122
+     * Serialize into JSON for client-side JS
123
+     *
124
+     * @return array
125
+     */
126
+    public function jsonSerializeDefinition() {
127
+        $configuration = [];
128
+        foreach ($this->getParameters() as $parameter) {
129
+            $configuration[$parameter->getName()] = $parameter;
130
+        }
131
+
132
+        $data = [
133
+            'name' => $this->getText(),
134
+            'configuration' => $configuration,
135
+            'custom' => $this->getCustomJs(),
136
+        ];
137
+        return $data;
138
+    }
139
+
140
+    /**
141
+     * Check if parameters are satisfied in a StorageConfig
142
+     *
143
+     * @param StorageConfig $storage
144
+     * @return bool
145
+     */
146
+    public function validateStorageDefinition(StorageConfig $storage) {
147
+        foreach ($this->getParameters() as $name => $parameter) {
148
+            $value = $storage->getBackendOption($name);
149
+            if (!is_null($value) || !$parameter->isOptional()) {
150
+                if (!$parameter->validateValue($value)) {
151
+                    return false;
152
+                }
153
+                $storage->setBackendOption($name, $value);
154
+            }
155
+        }
156
+        return true;
157
+    }
158 158
 
159 159
 }
Please login to merge, or discard this patch.