Passed
Push — master ( fd284f...fa2878 )
by Morris
13:09 queued 12s
created
apps/user_ldap/lib/LogWrapper.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
  * @brief wraps around static Nextcloud core methods
29 29
  */
30 30
 class LogWrapper {
31
-	protected $app = 'user_ldap';
31
+    protected $app = 'user_ldap';
32 32
 
33
-	/**
34
-	 * @brief states whether the filesystem was loaded
35
-	 * @return bool
36
-	 */
37
-	public function log($msg, $level) {
38
-		\OCP\Util::writeLog($this->app, $msg, $level);
39
-	}
33
+    /**
34
+     * @brief states whether the filesystem was loaded
35
+     * @return bool
36
+     */
37
+    public function log($msg, $level) {
38
+        \OCP\Util::writeLog($this->app, $msg, $level);
39
+    }
40 40
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/FilesystemHelper.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
  */
30 30
 class FilesystemHelper {
31 31
 
32
-	/**
33
-	 * @brief states whether the filesystem was loaded
34
-	 * @return bool
35
-	 */
36
-	public function isLoaded() {
37
-		return \OC\Files\Filesystem::$loaded;
38
-	}
32
+    /**
33
+     * @brief states whether the filesystem was loaded
34
+     * @return bool
35
+     */
36
+    public function isLoaded() {
37
+        return \OC\Files\Filesystem::$loaded;
38
+    }
39 39
 
40
-	/**
41
-	 * @brief initializes the filesystem for the given user
42
-	 * @param string $uid the Nextcloud username of the user
43
-	 */
44
-	public function setup($uid) {
45
-		\OC_Util::setupFS($uid);
46
-	}
40
+    /**
41
+     * @brief initializes the filesystem for the given user
42
+     * @param string $uid the Nextcloud username of the user
43
+     */
44
+    public function setup($uid) {
45
+        \OC_Util::setupFS($uid);
46
+    }
47 47
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Migration/StorageMigrator.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -42,97 +42,97 @@
 block discarded – undo
42 42
  * Migrate mount config from mount.json to the database
43 43
  */
44 44
 class StorageMigrator {
45
-	/**
46
-	 * @var BackendService
47
-	 */
48
-	private $backendService;
45
+    /**
46
+     * @var BackendService
47
+     */
48
+    private $backendService;
49 49
 
50
-	/**
51
-	 * @var DBConfigService
52
-	 */
53
-	private $dbConfig;
50
+    /**
51
+     * @var DBConfigService
52
+     */
53
+    private $dbConfig;
54 54
 
55
-	/**
56
-	 * @var IConfig
57
-	 */
58
-	private $config;
55
+    /**
56
+     * @var IConfig
57
+     */
58
+    private $config;
59 59
 
60
-	/**
61
-	 * @var IDBConnection
62
-	 */
63
-	private $connection;
60
+    /**
61
+     * @var IDBConnection
62
+     */
63
+    private $connection;
64 64
 
65
-	/**
66
-	 * @var ILogger
67
-	 */
68
-	private $logger;
65
+    /**
66
+     * @var ILogger
67
+     */
68
+    private $logger;
69 69
 
70
-	/** @var IUserMountCache  */
71
-	private $userMountCache;
70
+    /** @var IUserMountCache  */
71
+    private $userMountCache;
72 72
 
73
-	/**
74
-	 * StorageMigrator constructor.
75
-	 *
76
-	 * @param BackendService $backendService
77
-	 * @param DBConfigService $dbConfig
78
-	 * @param IConfig $config
79
-	 * @param IDBConnection $connection
80
-	 * @param ILogger $logger
81
-	 * @param IUserMountCache $userMountCache
82
-	 */
83
-	public function __construct(
84
-		BackendService $backendService,
85
-		DBConfigService $dbConfig,
86
-		IConfig $config,
87
-		IDBConnection $connection,
88
-		ILogger $logger,
89
-		IUserMountCache $userMountCache
90
-	) {
91
-		$this->backendService = $backendService;
92
-		$this->dbConfig = $dbConfig;
93
-		$this->config = $config;
94
-		$this->connection = $connection;
95
-		$this->logger = $logger;
96
-		$this->userMountCache = $userMountCache;
97
-	}
73
+    /**
74
+     * StorageMigrator constructor.
75
+     *
76
+     * @param BackendService $backendService
77
+     * @param DBConfigService $dbConfig
78
+     * @param IConfig $config
79
+     * @param IDBConnection $connection
80
+     * @param ILogger $logger
81
+     * @param IUserMountCache $userMountCache
82
+     */
83
+    public function __construct(
84
+        BackendService $backendService,
85
+        DBConfigService $dbConfig,
86
+        IConfig $config,
87
+        IDBConnection $connection,
88
+        ILogger $logger,
89
+        IUserMountCache $userMountCache
90
+    ) {
91
+        $this->backendService = $backendService;
92
+        $this->dbConfig = $dbConfig;
93
+        $this->config = $config;
94
+        $this->connection = $connection;
95
+        $this->logger = $logger;
96
+        $this->userMountCache = $userMountCache;
97
+    }
98 98
 
99
-	private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService) {
100
-		$existingStorage = $legacyService->getAllStorages();
99
+    private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService) {
100
+        $existingStorage = $legacyService->getAllStorages();
101 101
 
102
-		$this->connection->beginTransaction();
103
-		try {
104
-			foreach ($existingStorage as $storage) {
105
-				$mountOptions = $storage->getMountOptions();
106
-				if (!empty($mountOptions) && !isset($mountOptions['enable_sharing'])) {
107
-					// existing mounts must have sharing enabled by default to avoid surprises
108
-					$mountOptions['enable_sharing'] = true;
109
-					$storage->setMountOptions($mountOptions);
110
-				}
111
-				$storageService->addStorage($storage);
112
-			}
113
-			$this->connection->commit();
114
-		} catch (\Exception $e) {
115
-			$this->logger->logException($e);
116
-			$this->connection->rollBack();
117
-		}
118
-	}
102
+        $this->connection->beginTransaction();
103
+        try {
104
+            foreach ($existingStorage as $storage) {
105
+                $mountOptions = $storage->getMountOptions();
106
+                if (!empty($mountOptions) && !isset($mountOptions['enable_sharing'])) {
107
+                    // existing mounts must have sharing enabled by default to avoid surprises
108
+                    $mountOptions['enable_sharing'] = true;
109
+                    $storage->setMountOptions($mountOptions);
110
+                }
111
+                $storageService->addStorage($storage);
112
+            }
113
+            $this->connection->commit();
114
+        } catch (\Exception $e) {
115
+            $this->logger->logException($e);
116
+            $this->connection->rollBack();
117
+        }
118
+    }
119 119
 
120
-	/**
121
-	 * Migrate personal storages configured by the current user
122
-	 *
123
-	 * @param IUser $user
124
-	 */
125
-	public function migrateUser(IUser $user) {
126
-		$dummySession = new DummyUserSession();
127
-		$dummySession->setUser($user);
128
-		$userId = $user->getUID();
129
-		$userVersion = $this->config->getUserValue($userId, 'files_external', 'config_version', '0.0.0');
130
-		if (version_compare($userVersion, '0.5.0', '<')) {
131
-			$this->config->setUserValue($userId, 'files_external', 'config_version', '0.5.0');
132
-			$legacyService = new UserLegacyStoragesService($this->backendService, $dummySession);
133
-			$storageService = new UserStoragesService($this->backendService, $this->dbConfig, $dummySession, $this->userMountCache);
120
+    /**
121
+     * Migrate personal storages configured by the current user
122
+     *
123
+     * @param IUser $user
124
+     */
125
+    public function migrateUser(IUser $user) {
126
+        $dummySession = new DummyUserSession();
127
+        $dummySession->setUser($user);
128
+        $userId = $user->getUID();
129
+        $userVersion = $this->config->getUserValue($userId, 'files_external', 'config_version', '0.0.0');
130
+        if (version_compare($userVersion, '0.5.0', '<')) {
131
+            $this->config->setUserValue($userId, 'files_external', 'config_version', '0.5.0');
132
+            $legacyService = new UserLegacyStoragesService($this->backendService, $dummySession);
133
+            $storageService = new UserStoragesService($this->backendService, $this->dbConfig, $dummySession, $this->userMountCache);
134 134
 
135
-			$this->migrate($legacyService, $storageService);
136
-		}
137
-	}
135
+            $this->migrate($legacyService, $storageService);
136
+        }
137
+    }
138 138
 }
Please login to merge, or discard this patch.
apps/testing/lib/Controller/RateLimitTestController.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,28 +25,28 @@
 block discarded – undo
25 25
 use OCP\AppFramework\Http\JSONResponse;
26 26
 
27 27
 class RateLimitTestController extends Controller {
28
-	/**
29
-	 * @PublicPage
30
-	 * @NoCSRFRequired
31
-	 *
32
-	 * @UserRateThrottle(limit=5, period=100)
33
-	 * @AnonRateThrottle(limit=1, period=100)
34
-	 *
35
-	 * @return JSONResponse
36
-	 */
37
-	public function userAndAnonProtected() {
38
-		return new JSONResponse();
39
-	}
28
+    /**
29
+     * @PublicPage
30
+     * @NoCSRFRequired
31
+     *
32
+     * @UserRateThrottle(limit=5, period=100)
33
+     * @AnonRateThrottle(limit=1, period=100)
34
+     *
35
+     * @return JSONResponse
36
+     */
37
+    public function userAndAnonProtected() {
38
+        return new JSONResponse();
39
+    }
40 40
 
41
-	/**
42
-	 * @PublicPage
43
-	 * @NoCSRFRequired
44
-	 *
45
-	 * @AnonRateThrottle(limit=1, period=10)
46
-	 *
47
-	 * @return JSONResponse
48
-	 */
49
-	public function onlyAnonProtected() {
50
-		return new JSONResponse();
51
-	}
41
+    /**
42
+     * @PublicPage
43
+     * @NoCSRFRequired
44
+     *
45
+     * @AnonRateThrottle(limit=1, period=10)
46
+     *
47
+     * @return JSONResponse
48
+     */
49
+    public function onlyAnonProtected() {
50
+        return new JSONResponse();
51
+    }
52 52
 }
Please login to merge, or discard this patch.
lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 use OCP\AppFramework\Http;
26 26
 
27 27
 class RateLimitExceededException extends SecurityException {
28
-	public function __construct() {
29
-		parent::__construct('Rate limit exceeded', Http::STATUS_TOO_MANY_REQUESTS);
30
-	}
28
+    public function __construct() {
29
+        parent::__construct('Rate limit exceeded', Http::STATUS_TOO_MANY_REQUESTS);
30
+    }
31 31
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -107,32 +107,32 @@  discard block
 block discarded – undo
107 107
 				case '{DAV:}prop':
108 108
 					$newProps['properties'] = array_keys($elem['value']);
109 109
 					break;
110
-				case '{' . SearchPlugin::NS_Nextcloud . '}filter':
110
+				case '{'.SearchPlugin::NS_Nextcloud.'}filter':
111 111
 					foreach ($elem['value'] as $subElem) {
112
-						if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
112
+						if ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}comp-filter') {
113 113
 							if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) {
114 114
 								$newProps['filters']['comps'] = [];
115 115
 							}
116 116
 							$newProps['filters']['comps'][] = $subElem['value'];
117
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
117
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}prop-filter') {
118 118
 							if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) {
119 119
 								$newProps['filters']['props'] = [];
120 120
 							}
121 121
 							$newProps['filters']['props'][] = $subElem['value'];
122
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
122
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}param-filter') {
123 123
 							if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) {
124 124
 								$newProps['filters']['params'] = [];
125 125
 							}
126 126
 							$newProps['filters']['params'][] = $subElem['value'];
127
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
127
+						} elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}search-term') {
128 128
 							$newProps['filters']['search-term'] = $subElem['value'];
129 129
 						}
130 130
 					}
131 131
 					break;
132
-				case '{' . SearchPlugin::NS_Nextcloud . '}limit':
132
+				case '{'.SearchPlugin::NS_Nextcloud.'}limit':
133 133
 					$newProps['limit'] = $elem['value'];
134 134
 					break;
135
-				case '{' . SearchPlugin::NS_Nextcloud . '}offset':
135
+				case '{'.SearchPlugin::NS_Nextcloud.'}offset':
136 136
 					$newProps['offset'] = $elem['value'];
137 137
 					break;
138 138
 
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 		}
141 141
 
142 142
 		if (empty($newProps['filters'])) {
143
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
143
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}filter element is required for this request');
144 144
 		}
145 145
 
146 146
 		$propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params']));
147 147
 		$noCompsDefined = empty($newProps['filters']['comps']);
148 148
 		if ($propsOrParamsDefined && $noCompsDefined) {
149
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
149
+			throw new BadRequest('{'.SearchPlugin::NS_Nextcloud.'}prop-filter or {'.SearchPlugin::NS_Nextcloud.'}param-filter given without any {'.SearchPlugin::NS_Nextcloud.'}comp-filter');
150 150
 		}
151 151
 
152 152
 		if (!isset($newProps['filters']['search-term'])) {
153
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request');
153
+			throw new BadRequest('{'.SearchPlugin::NS_Nextcloud.'}search-term is required for this request');
154 154
 		}
155 155
 
156 156
 		if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) {
157
-			throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request');
157
+			throw new BadRequest('At least one{'.SearchPlugin::NS_Nextcloud.'}prop-filter or {'.SearchPlugin::NS_Nextcloud.'}param-filter is required for this request');
158 158
 		}
159 159
 
160 160
 
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -35,133 +35,133 @@
 block discarded – undo
35 35
  */
36 36
 class CalendarSearchReport implements XmlDeserializable {
37 37
 
38
-	/**
39
-	 * An array with requested properties.
40
-	 *
41
-	 * @var array
42
-	 */
43
-	public $properties;
44
-
45
-	/**
46
-	 * List of property/component filters.
47
-	 *
48
-	 * @var array
49
-	 */
50
-	public $filters;
51
-
52
-	/**
53
-	 * @var int
54
-	 */
55
-	public $limit;
56
-
57
-	/**
58
-	 * @var int
59
-	 */
60
-	public $offset;
61
-
62
-	/**
63
-	 * The deserialize method is called during xml parsing.
64
-	 *
65
-	 * This method is called statically, this is because in theory this method
66
-	 * may be used as a type of constructor, or factory method.
67
-	 *
68
-	 * Often you want to return an instance of the current class, but you are
69
-	 * free to return other data as well.
70
-	 *
71
-	 * You are responsible for advancing the reader to the next element. Not
72
-	 * doing anything will result in a never-ending loop.
73
-	 *
74
-	 * If you just want to skip parsing for this element altogether, you can
75
-	 * just call $reader->next();
76
-	 *
77
-	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
-	 * the next element.
79
-	 *
80
-	 * @param Reader $reader
81
-	 * @return mixed
82
-	 */
83
-	public static function xmlDeserialize(Reader $reader) {
84
-		$elems = $reader->parseInnerTree([
85
-			'{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
86
-			'{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
87
-			'{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
88
-			'{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
89
-			'{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
90
-			'{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
91
-			'{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
92
-		]);
93
-
94
-		$newProps = [
95
-			'filters' => [],
96
-			'properties' => [],
97
-			'limit' => null,
98
-			'offset' => null
99
-		];
100
-
101
-		if (!is_array($elems)) {
102
-			$elems = [];
103
-		}
104
-
105
-		foreach ($elems as $elem) {
106
-			switch ($elem['name']) {
107
-				case '{DAV:}prop':
108
-					$newProps['properties'] = array_keys($elem['value']);
109
-					break;
110
-				case '{' . SearchPlugin::NS_Nextcloud . '}filter':
111
-					foreach ($elem['value'] as $subElem) {
112
-						if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
113
-							if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) {
114
-								$newProps['filters']['comps'] = [];
115
-							}
116
-							$newProps['filters']['comps'][] = $subElem['value'];
117
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
118
-							if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) {
119
-								$newProps['filters']['props'] = [];
120
-							}
121
-							$newProps['filters']['props'][] = $subElem['value'];
122
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
123
-							if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) {
124
-								$newProps['filters']['params'] = [];
125
-							}
126
-							$newProps['filters']['params'][] = $subElem['value'];
127
-						} elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
128
-							$newProps['filters']['search-term'] = $subElem['value'];
129
-						}
130
-					}
131
-					break;
132
-				case '{' . SearchPlugin::NS_Nextcloud . '}limit':
133
-					$newProps['limit'] = $elem['value'];
134
-					break;
135
-				case '{' . SearchPlugin::NS_Nextcloud . '}offset':
136
-					$newProps['offset'] = $elem['value'];
137
-					break;
138
-
139
-			}
140
-		}
141
-
142
-		if (empty($newProps['filters'])) {
143
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
144
-		}
145
-
146
-		$propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params']));
147
-		$noCompsDefined = empty($newProps['filters']['comps']);
148
-		if ($propsOrParamsDefined && $noCompsDefined) {
149
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
150
-		}
151
-
152
-		if (!isset($newProps['filters']['search-term'])) {
153
-			throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request');
154
-		}
155
-
156
-		if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) {
157
-			throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request');
158
-		}
159
-
160
-
161
-		$obj = new self();
162
-		foreach ($newProps as $key => $value) {
163
-			$obj->$key = $value;
164
-		}
165
-		return $obj;
166
-	}
38
+    /**
39
+     * An array with requested properties.
40
+     *
41
+     * @var array
42
+     */
43
+    public $properties;
44
+
45
+    /**
46
+     * List of property/component filters.
47
+     *
48
+     * @var array
49
+     */
50
+    public $filters;
51
+
52
+    /**
53
+     * @var int
54
+     */
55
+    public $limit;
56
+
57
+    /**
58
+     * @var int
59
+     */
60
+    public $offset;
61
+
62
+    /**
63
+     * The deserialize method is called during xml parsing.
64
+     *
65
+     * This method is called statically, this is because in theory this method
66
+     * may be used as a type of constructor, or factory method.
67
+     *
68
+     * Often you want to return an instance of the current class, but you are
69
+     * free to return other data as well.
70
+     *
71
+     * You are responsible for advancing the reader to the next element. Not
72
+     * doing anything will result in a never-ending loop.
73
+     *
74
+     * If you just want to skip parsing for this element altogether, you can
75
+     * just call $reader->next();
76
+     *
77
+     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
78
+     * the next element.
79
+     *
80
+     * @param Reader $reader
81
+     * @return mixed
82
+     */
83
+    public static function xmlDeserialize(Reader $reader) {
84
+        $elems = $reader->parseInnerTree([
85
+            '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
86
+            '{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
87
+            '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
88
+            '{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
89
+            '{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
90
+            '{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
91
+            '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
92
+        ]);
93
+
94
+        $newProps = [
95
+            'filters' => [],
96
+            'properties' => [],
97
+            'limit' => null,
98
+            'offset' => null
99
+        ];
100
+
101
+        if (!is_array($elems)) {
102
+            $elems = [];
103
+        }
104
+
105
+        foreach ($elems as $elem) {
106
+            switch ($elem['name']) {
107
+                case '{DAV:}prop':
108
+                    $newProps['properties'] = array_keys($elem['value']);
109
+                    break;
110
+                case '{' . SearchPlugin::NS_Nextcloud . '}filter':
111
+                    foreach ($elem['value'] as $subElem) {
112
+                        if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') {
113
+                            if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) {
114
+                                $newProps['filters']['comps'] = [];
115
+                            }
116
+                            $newProps['filters']['comps'][] = $subElem['value'];
117
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') {
118
+                            if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) {
119
+                                $newProps['filters']['props'] = [];
120
+                            }
121
+                            $newProps['filters']['props'][] = $subElem['value'];
122
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') {
123
+                            if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) {
124
+                                $newProps['filters']['params'] = [];
125
+                            }
126
+                            $newProps['filters']['params'][] = $subElem['value'];
127
+                        } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') {
128
+                            $newProps['filters']['search-term'] = $subElem['value'];
129
+                        }
130
+                    }
131
+                    break;
132
+                case '{' . SearchPlugin::NS_Nextcloud . '}limit':
133
+                    $newProps['limit'] = $elem['value'];
134
+                    break;
135
+                case '{' . SearchPlugin::NS_Nextcloud . '}offset':
136
+                    $newProps['offset'] = $elem['value'];
137
+                    break;
138
+
139
+            }
140
+        }
141
+
142
+        if (empty($newProps['filters'])) {
143
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request');
144
+        }
145
+
146
+        $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params']));
147
+        $noCompsDefined = empty($newProps['filters']['comps']);
148
+        if ($propsOrParamsDefined && $noCompsDefined) {
149
+            throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter');
150
+        }
151
+
152
+        if (!isset($newProps['filters']['search-term'])) {
153
+            throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request');
154
+        }
155
+
156
+        if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) {
157
+            throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request');
158
+        }
159
+
160
+
161
+        $obj = new self();
162
+        foreach ($newProps as $key => $value) {
163
+            $obj->$key = $value;
164
+        }
165
+        return $obj;
166
+    }
167 167
 }
Please login to merge, or discard this patch.
lib/private/App/AppStore/Bundles/CoreBundle.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@
 block discarded – undo
23 23
 
24 24
 class CoreBundle extends Bundle {
25 25
 
26
-	/**
27
-	 * {@inheritDoc}
28
-	 */
29
-	public function getName() {
30
-		return 'Core bundle';
31
-	}
26
+    /**
27
+     * {@inheritDoc}
28
+     */
29
+    public function getName() {
30
+        return 'Core bundle';
31
+    }
32 32
 
33
-	/**
34
-	 * {@inheritDoc}
35
-	 */
36
-	public function getAppIdentifiers() {
37
-		return [
38
-			'bruteforcesettings',
39
-		];
40
-	}
33
+    /**
34
+     * {@inheritDoc}
35
+     */
36
+    public function getAppIdentifiers() {
37
+        return [
38
+            'bruteforcesettings',
39
+        ];
40
+    }
41 41
 
42 42
 }
Please login to merge, or discard this patch.
lib/public/Diagnostics/IEventLogger.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -35,55 +35,55 @@
 block discarded – undo
35 35
  * @since 8.0.0
36 36
  */
37 37
 interface IEventLogger {
38
-	/**
39
-	 * Mark the start of an event setting its ID $id and providing event description $description.
40
-	 *
41
-	 * @param string $id
42
-	 * @param string $description
43
-	 * @since 8.0.0
44
-	 */
45
-	public function start($id, $description);
38
+    /**
39
+     * Mark the start of an event setting its ID $id and providing event description $description.
40
+     *
41
+     * @param string $id
42
+     * @param string $description
43
+     * @since 8.0.0
44
+     */
45
+    public function start($id, $description);
46 46
 
47
-	/**
48
-	 * Mark the end of an event with specific ID $id, marked by start() method.
49
-	 * Ending event should store \OCP\Diagnostics\IEvent to
50
-	 * be returned with getEvents() method.
51
-	 *
52
-	 * @param string $id
53
-	 * @since 8.0.0
54
-	 */
55
-	public function end($id);
47
+    /**
48
+     * Mark the end of an event with specific ID $id, marked by start() method.
49
+     * Ending event should store \OCP\Diagnostics\IEvent to
50
+     * be returned with getEvents() method.
51
+     *
52
+     * @param string $id
53
+     * @since 8.0.0
54
+     */
55
+    public function end($id);
56 56
 
57
-	/**
58
-	 * Mark the start and the end of an event with specific ID $id and description $description,
59
-	 * explicitly marking start and end of the event, represented by $start and $end timestamps.
60
-	 * Logging event should store \OCP\Diagnostics\IEvent to
61
-	 * be returned with getEvents() method.
62
-	 *
63
-	 * @param string $id
64
-	 * @param string $description
65
-	 * @param float $start
66
-	 * @param float $end
67
-	 * @since 8.0.0
68
-	 */
69
-	public function log($id, $description, $start, $end);
57
+    /**
58
+     * Mark the start and the end of an event with specific ID $id and description $description,
59
+     * explicitly marking start and end of the event, represented by $start and $end timestamps.
60
+     * Logging event should store \OCP\Diagnostics\IEvent to
61
+     * be returned with getEvents() method.
62
+     *
63
+     * @param string $id
64
+     * @param string $description
65
+     * @param float $start
66
+     * @param float $end
67
+     * @since 8.0.0
68
+     */
69
+    public function log($id, $description, $start, $end);
70 70
 
71
-	/**
72
-	 * This method should return all \OCP\Diagnostics\IEvent objects stored using
73
-	 * start()/end() or log() methods
74
-	 *
75
-	 * @return \OCP\Diagnostics\IEvent[]
76
-	 * @since 8.0.0
77
-	 */
78
-	public function getEvents();
71
+    /**
72
+     * This method should return all \OCP\Diagnostics\IEvent objects stored using
73
+     * start()/end() or log() methods
74
+     *
75
+     * @return \OCP\Diagnostics\IEvent[]
76
+     * @since 8.0.0
77
+     */
78
+    public function getEvents();
79 79
 
80
-	/**
81
-	 * Activate the module for the duration of the request. Deactivated module
82
-	 * does not create and store \OCP\Diagnostics\IEvent objects.
83
-	 * Only activated module should create and store objects to be
84
-	 * returned with getEvents() call.
85
-	 *
86
-	 * @since 12.0.0
87
-	 */
88
-	public function activate();
80
+    /**
81
+     * Activate the module for the duration of the request. Deactivated module
82
+     * does not create and store \OCP\Diagnostics\IEvent objects.
83
+     * Only activated module should create and store objects to be
84
+     * returned with getEvents() call.
85
+     *
86
+     * @since 12.0.0
87
+     */
88
+    public function activate();
89 89
 }
Please login to merge, or discard this patch.
lib/public/Diagnostics/IQuery.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -30,38 +30,38 @@
 block discarded – undo
30 30
  * @since 8.0.0
31 31
  */
32 32
 interface IQuery {
33
-	/**
34
-	 * @return string
35
-	 * @since 8.0.0
36
-	 */
37
-	public function getSql();
33
+    /**
34
+     * @return string
35
+     * @since 8.0.0
36
+     */
37
+    public function getSql();
38 38
 
39
-	/**
40
-	 * @return array
41
-	 * @since 8.0.0
42
-	 */
43
-	public function getParams();
39
+    /**
40
+     * @return array
41
+     * @since 8.0.0
42
+     */
43
+    public function getParams();
44 44
 
45
-	/**
46
-	 * @return float
47
-	 * @since 8.0.0
48
-	 */
49
-	public function getDuration();
45
+    /**
46
+     * @return float
47
+     * @since 8.0.0
48
+     */
49
+    public function getDuration();
50 50
 
51
-	/**
52
-	 * @return float
53
-	 * @since 11.0.0
54
-	 */
55
-	public function getStartTime();
51
+    /**
52
+     * @return float
53
+     * @since 11.0.0
54
+     */
55
+    public function getStartTime();
56 56
 
57
-	/**
58
-	 * @return array
59
-	 * @since 11.0.0
60
-	 */
61
-	public function getStacktrace();
62
-	/**
63
-	 * @return array
64
-	 * @since 12.0.0
65
-	 */
66
-	public function getStart();
57
+    /**
58
+     * @return array
59
+     * @since 11.0.0
60
+     */
61
+    public function getStacktrace();
62
+    /**
63
+     * @return array
64
+     * @since 12.0.0
65
+     */
66
+    public function getStart();
67 67
 }
Please login to merge, or discard this patch.