Completed
Push — master ( 08b58a...0efd05 )
by Daniel
30:08 queued 21s
created
apps/federation/lib/Migration/Version1010Date20200630191302.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -33,51 +33,51 @@
 block discarded – undo
33 33
 
34 34
 class Version1010Date20200630191302 extends SimpleMigrationStep {
35 35
 
36
-	/**
37
-	 * @param IOutput $output
38
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
-	 * @param array $options
40
-	 * @return null|ISchemaWrapper
41
-	 */
42
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
-		/** @var ISchemaWrapper $schema */
44
-		$schema = $schemaClosure();
36
+    /**
37
+     * @param IOutput $output
38
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
+     * @param array $options
40
+     * @return null|ISchemaWrapper
41
+     */
42
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
+        /** @var ISchemaWrapper $schema */
44
+        $schema = $schemaClosure();
45 45
 
46
-		if (!$schema->hasTable('trusted_servers')) {
47
-			$table = $schema->createTable('trusted_servers');
48
-			$table->addColumn('id', Types::INTEGER, [
49
-				'autoincrement' => true,
50
-				'notnull' => true,
51
-				'length' => 4,
52
-			]);
53
-			$table->addColumn('url', Types::STRING, [
54
-				'notnull' => true,
55
-				'length' => 512,
56
-			]);
57
-			$table->addColumn('url_hash', Types::STRING, [
58
-				'notnull' => true,
59
-				'default' => '',
60
-			]);
61
-			$table->addColumn('token', Types::STRING, [
62
-				'notnull' => false,
63
-				'length' => 128,
64
-			]);
65
-			$table->addColumn('shared_secret', Types::STRING, [
66
-				'notnull' => false,
67
-				'length' => 256,
68
-			]);
69
-			$table->addColumn('status', Types::INTEGER, [
70
-				'notnull' => true,
71
-				'length' => 4,
72
-				'default' => 2,
73
-			]);
74
-			$table->addColumn('sync_token', Types::STRING, [
75
-				'notnull' => false,
76
-				'length' => 512,
77
-			]);
78
-			$table->setPrimaryKey(['id']);
79
-			$table->addUniqueIndex(['url_hash'], 'url_hash');
80
-		}
81
-		return $schema;
82
-	}
46
+        if (!$schema->hasTable('trusted_servers')) {
47
+            $table = $schema->createTable('trusted_servers');
48
+            $table->addColumn('id', Types::INTEGER, [
49
+                'autoincrement' => true,
50
+                'notnull' => true,
51
+                'length' => 4,
52
+            ]);
53
+            $table->addColumn('url', Types::STRING, [
54
+                'notnull' => true,
55
+                'length' => 512,
56
+            ]);
57
+            $table->addColumn('url_hash', Types::STRING, [
58
+                'notnull' => true,
59
+                'default' => '',
60
+            ]);
61
+            $table->addColumn('token', Types::STRING, [
62
+                'notnull' => false,
63
+                'length' => 128,
64
+            ]);
65
+            $table->addColumn('shared_secret', Types::STRING, [
66
+                'notnull' => false,
67
+                'length' => 256,
68
+            ]);
69
+            $table->addColumn('status', Types::INTEGER, [
70
+                'notnull' => true,
71
+                'length' => 4,
72
+                'default' => 2,
73
+            ]);
74
+            $table->addColumn('sync_token', Types::STRING, [
75
+                'notnull' => false,
76
+                'length' => 512,
77
+            ]);
78
+            $table->setPrimaryKey(['id']);
79
+            $table->addUniqueIndex(['url_hash'], 'url_hash');
80
+        }
81
+        return $schema;
82
+    }
83 83
 }
Please login to merge, or discard this patch.
apps/contactsinteraction/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
 use OCP\Contacts\Events\ContactInteractedWithEvent;
34 34
 
35 35
 class Application extends App implements IBootstrap {
36
-	public const APP_ID = 'contactsinteraction';
36
+    public const APP_ID = 'contactsinteraction';
37 37
 
38
-	public function __construct() {
39
-		parent::__construct(self::APP_ID);
40
-	}
38
+    public function __construct() {
39
+        parent::__construct(self::APP_ID);
40
+    }
41 41
 
42
-	public function register(IRegistrationContext $context): void {
43
-		$context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
44
-	}
42
+    public function register(IRegistrationContext $context): void {
43
+        $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
44
+    }
45 45
 
46
-	public function boot(IBootContext $context): void {
47
-	}
46
+    public function boot(IBootContext $context): void {
47
+    }
48 48
 }
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
 use OCP\AppFramework\Bootstrap\IRegistrationContext;
34 34
 
35 35
 class Application extends App implements IBootstrap {
36
-	public const APP_ID = 'cloud_federation_api';
36
+    public const APP_ID = 'cloud_federation_api';
37 37
 
38
-	public function __construct() {
39
-		parent::__construct(self::APP_ID);
40
-	}
38
+    public function __construct() {
39
+        parent::__construct(self::APP_ID);
40
+    }
41 41
 
42
-	public function register(IRegistrationContext $context): void {
43
-		$context->registerCapability(Capabilities::class);
44
-	}
42
+    public function register(IRegistrationContext $context): void {
43
+        $context->registerCapability(Capabilities::class);
44
+    }
45 45
 
46
-	public function boot(IBootContext $context): void {
47
-	}
46
+    public function boot(IBootContext $context): void {
47
+    }
48 48
 }
Please login to merge, or discard this patch.
lib/private/ServerContainer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 		if (isset($this->namespaces[$namespace])) {
105 105
 			if (!isset($this->hasNoAppContainer[$namespace])) {
106
-				$applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
106
+				$applicationClassName = 'OCA\\'.$sensitiveNamespace.'\\AppInfo\\Application';
107 107
 				if (class_exists($applicationClassName)) {
108 108
 					$app = new $applicationClassName();
109 109
 					if (isset($this->appContainers[$namespace])) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		try {
162
-			[,$namespace,] = explode('\\', $id);
162
+			[,$namespace, ] = explode('\\', $id);
163 163
 			return $this->getAppContainer(strtolower($namespace), $namespace);
164 164
 		} catch (QueryException $e) {
165 165
 			return null;
Please login to merge, or discard this patch.
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -21,154 +21,154 @@
 block discarded – undo
21 21
  * @package OC
22 22
  */
23 23
 class ServerContainer extends SimpleContainer {
24
-	/** @var DIContainer[] */
25
-	protected $appContainers;
26
-
27
-	/** @var string[] */
28
-	protected $hasNoAppContainer;
29
-
30
-	/** @var string[] */
31
-	protected $namespaces;
32
-
33
-	/**
34
-	 * ServerContainer constructor.
35
-	 */
36
-	public function __construct() {
37
-		parent::__construct();
38
-		$this->appContainers = [];
39
-		$this->namespaces = [];
40
-		$this->hasNoAppContainer = [];
41
-	}
42
-
43
-	/**
44
-	 * @param string $appName
45
-	 * @param string $appNamespace
46
-	 */
47
-	public function registerNamespace(string $appName, string $appNamespace): void {
48
-		// Cut of OCA\ and lowercase
49
-		$appNamespace = strtolower(substr($appNamespace, strrpos($appNamespace, '\\') + 1));
50
-		$this->namespaces[$appNamespace] = $appName;
51
-	}
52
-
53
-	/**
54
-	 * @param string $appName
55
-	 * @param DIContainer $container
56
-	 */
57
-	public function registerAppContainer(string $appName, DIContainer $container): void {
58
-		$this->appContainers[strtolower(App::buildAppNamespace($appName, ''))] = $container;
59
-	}
60
-
61
-	/**
62
-	 * @param string $appName
63
-	 * @return DIContainer
64
-	 * @throws QueryException
65
-	 */
66
-	public function getRegisteredAppContainer(string $appName): DIContainer {
67
-		if (isset($this->appContainers[strtolower(App::buildAppNamespace($appName, ''))])) {
68
-			return $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))];
69
-		}
70
-
71
-		throw new QueryException();
72
-	}
73
-
74
-	/**
75
-	 * @param string $namespace
76
-	 * @param string $sensitiveNamespace
77
-	 * @return DIContainer
78
-	 * @throws QueryException
79
-	 */
80
-	protected function getAppContainer(string $namespace, string $sensitiveNamespace): DIContainer {
81
-		if (isset($this->appContainers[$namespace])) {
82
-			return $this->appContainers[$namespace];
83
-		}
84
-
85
-		if (isset($this->namespaces[$namespace])) {
86
-			if (!isset($this->hasNoAppContainer[$namespace])) {
87
-				$applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
88
-				if (class_exists($applicationClassName)) {
89
-					$app = new $applicationClassName();
90
-					if (isset($this->appContainers[$namespace])) {
91
-						$this->appContainers[$namespace]->offsetSet($applicationClassName, $app);
92
-						return $this->appContainers[$namespace];
93
-					}
94
-				}
95
-				$this->hasNoAppContainer[$namespace] = true;
96
-			}
97
-
98
-			return new DIContainer($this->namespaces[$namespace]);
99
-		}
100
-		throw new QueryException();
101
-	}
102
-
103
-	public function has($id, bool $noRecursion = false): bool {
104
-		if (!$noRecursion && ($appContainer = $this->getAppContainerForService($id)) !== null) {
105
-			return $appContainer->has($id);
106
-		}
107
-
108
-		return parent::has($id);
109
-	}
110
-
111
-	/**
112
-	 * @template T
113
-	 * @param class-string<T>|string $name
114
-	 * @return T|mixed
115
-	 * @psalm-template S as class-string<T>|string
116
-	 * @psalm-param S $name
117
-	 * @psalm-return (S is class-string<T> ? T : mixed)
118
-	 * @throws QueryException
119
-	 * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
120
-	 */
121
-	public function query(string $name, bool $autoload = true) {
122
-		$name = $this->sanitizeName($name);
123
-
124
-		if (str_starts_with($name, 'OCA\\')) {
125
-			// Skip server container query for app namespace classes
126
-			try {
127
-				return parent::query($name, false);
128
-			} catch (QueryException $e) {
129
-				// Continue with general autoloading then
130
-			}
131
-			// In case the service starts with OCA\ we try to find the service in
132
-			// the apps container first.
133
-			if (($appContainer = $this->getAppContainerForService($name)) !== null) {
134
-				try {
135
-					return $appContainer->queryNoFallback($name);
136
-				} catch (QueryException $e) {
137
-					// Didn't find the service or the respective app container
138
-					// In this case the service won't be part of the core container,
139
-					// so we can throw directly
140
-					throw $e;
141
-				}
142
-			}
143
-		} elseif (str_starts_with($name, 'OC\\Settings\\') && substr_count($name, '\\') >= 3) {
144
-			$segments = explode('\\', $name);
145
-			try {
146
-				$appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]);
147
-				return $appContainer->queryNoFallback($name);
148
-			} catch (QueryException $e) {
149
-				// Didn't find the service or the respective app container,
150
-				// ignore it and fall back to the core container.
151
-			}
152
-		}
153
-
154
-		return parent::query($name, $autoload);
155
-	}
156
-
157
-	/**
158
-	 * @internal
159
-	 * @param string $id
160
-	 * @return DIContainer|null
161
-	 */
162
-	public function getAppContainerForService(string $id): ?DIContainer {
163
-		if (!str_starts_with($id, 'OCA\\') || substr_count($id, '\\') < 2) {
164
-			return null;
165
-		}
166
-
167
-		try {
168
-			[,$namespace,] = explode('\\', $id);
169
-			return $this->getAppContainer(strtolower($namespace), $namespace);
170
-		} catch (QueryException $e) {
171
-			return null;
172
-		}
173
-	}
24
+    /** @var DIContainer[] */
25
+    protected $appContainers;
26
+
27
+    /** @var string[] */
28
+    protected $hasNoAppContainer;
29
+
30
+    /** @var string[] */
31
+    protected $namespaces;
32
+
33
+    /**
34
+     * ServerContainer constructor.
35
+     */
36
+    public function __construct() {
37
+        parent::__construct();
38
+        $this->appContainers = [];
39
+        $this->namespaces = [];
40
+        $this->hasNoAppContainer = [];
41
+    }
42
+
43
+    /**
44
+     * @param string $appName
45
+     * @param string $appNamespace
46
+     */
47
+    public function registerNamespace(string $appName, string $appNamespace): void {
48
+        // Cut of OCA\ and lowercase
49
+        $appNamespace = strtolower(substr($appNamespace, strrpos($appNamespace, '\\') + 1));
50
+        $this->namespaces[$appNamespace] = $appName;
51
+    }
52
+
53
+    /**
54
+     * @param string $appName
55
+     * @param DIContainer $container
56
+     */
57
+    public function registerAppContainer(string $appName, DIContainer $container): void {
58
+        $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))] = $container;
59
+    }
60
+
61
+    /**
62
+     * @param string $appName
63
+     * @return DIContainer
64
+     * @throws QueryException
65
+     */
66
+    public function getRegisteredAppContainer(string $appName): DIContainer {
67
+        if (isset($this->appContainers[strtolower(App::buildAppNamespace($appName, ''))])) {
68
+            return $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))];
69
+        }
70
+
71
+        throw new QueryException();
72
+    }
73
+
74
+    /**
75
+     * @param string $namespace
76
+     * @param string $sensitiveNamespace
77
+     * @return DIContainer
78
+     * @throws QueryException
79
+     */
80
+    protected function getAppContainer(string $namespace, string $sensitiveNamespace): DIContainer {
81
+        if (isset($this->appContainers[$namespace])) {
82
+            return $this->appContainers[$namespace];
83
+        }
84
+
85
+        if (isset($this->namespaces[$namespace])) {
86
+            if (!isset($this->hasNoAppContainer[$namespace])) {
87
+                $applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
88
+                if (class_exists($applicationClassName)) {
89
+                    $app = new $applicationClassName();
90
+                    if (isset($this->appContainers[$namespace])) {
91
+                        $this->appContainers[$namespace]->offsetSet($applicationClassName, $app);
92
+                        return $this->appContainers[$namespace];
93
+                    }
94
+                }
95
+                $this->hasNoAppContainer[$namespace] = true;
96
+            }
97
+
98
+            return new DIContainer($this->namespaces[$namespace]);
99
+        }
100
+        throw new QueryException();
101
+    }
102
+
103
+    public function has($id, bool $noRecursion = false): bool {
104
+        if (!$noRecursion && ($appContainer = $this->getAppContainerForService($id)) !== null) {
105
+            return $appContainer->has($id);
106
+        }
107
+
108
+        return parent::has($id);
109
+    }
110
+
111
+    /**
112
+     * @template T
113
+     * @param class-string<T>|string $name
114
+     * @return T|mixed
115
+     * @psalm-template S as class-string<T>|string
116
+     * @psalm-param S $name
117
+     * @psalm-return (S is class-string<T> ? T : mixed)
118
+     * @throws QueryException
119
+     * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
120
+     */
121
+    public function query(string $name, bool $autoload = true) {
122
+        $name = $this->sanitizeName($name);
123
+
124
+        if (str_starts_with($name, 'OCA\\')) {
125
+            // Skip server container query for app namespace classes
126
+            try {
127
+                return parent::query($name, false);
128
+            } catch (QueryException $e) {
129
+                // Continue with general autoloading then
130
+            }
131
+            // In case the service starts with OCA\ we try to find the service in
132
+            // the apps container first.
133
+            if (($appContainer = $this->getAppContainerForService($name)) !== null) {
134
+                try {
135
+                    return $appContainer->queryNoFallback($name);
136
+                } catch (QueryException $e) {
137
+                    // Didn't find the service or the respective app container
138
+                    // In this case the service won't be part of the core container,
139
+                    // so we can throw directly
140
+                    throw $e;
141
+                }
142
+            }
143
+        } elseif (str_starts_with($name, 'OC\\Settings\\') && substr_count($name, '\\') >= 3) {
144
+            $segments = explode('\\', $name);
145
+            try {
146
+                $appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]);
147
+                return $appContainer->queryNoFallback($name);
148
+            } catch (QueryException $e) {
149
+                // Didn't find the service or the respective app container,
150
+                // ignore it and fall back to the core container.
151
+            }
152
+        }
153
+
154
+        return parent::query($name, $autoload);
155
+    }
156
+
157
+    /**
158
+     * @internal
159
+     * @param string $id
160
+     * @return DIContainer|null
161
+     */
162
+    public function getAppContainerForService(string $id): ?DIContainer {
163
+        if (!str_starts_with($id, 'OCA\\') || substr_count($id, '\\') < 2) {
164
+            return null;
165
+        }
166
+
167
+        try {
168
+            [,$namespace,] = explode('\\', $id);
169
+            return $this->getAppContainer(strtolower($namespace), $namespace);
170
+        } catch (QueryException $e) {
171
+            return null;
172
+        }
173
+    }
174 174
 }
Please login to merge, or discard this patch.
lib/public/User/Backend/ICustomLogout.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
  * SSO providers that also have a SSO logout url
33 33
  */
34 34
 interface ICustomLogout {
35
-	/**
36
-	 * @since 20.0.0
37
-	 *
38
-	 * The url to redirect to for logout
39
-	 *
40
-	 * @return string
41
-	 */
42
-	public function getLogoutUrl(): string;
35
+    /**
36
+     * @since 20.0.0
37
+     *
38
+     * The url to redirect to for logout
39
+     *
40
+     * @return string
41
+     */
42
+    public function getLogoutUrl(): string;
43 43
 }
Please login to merge, or discard this patch.
apps/user_status/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\UserStatus\\' => array($baseDir . '/../lib'),
9
+    'OCA\\UserStatus\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/user_status/composer/composer/ClassLoader.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
     private function findFileWithExtension($class, $ext)
371 371
     {
372 372
         // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
373
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
374 374
 
375 375
         $first = $class[0];
376 376
         if (isset($this->prefixLengthsPsr4[$first])) {
377 377
             $subPath = $class;
378 378
             while (false !== $lastPos = strrpos($subPath, '\\')) {
379 379
                 $subPath = substr($subPath, 0, $lastPos);
380
-                $search = $subPath . '\\';
380
+                $search = $subPath.'\\';
381 381
                 if (isset($this->prefixDirsPsr4[$search])) {
382
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
382
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
383 383
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
-                        if (file_exists($file = $dir . $pathEnd)) {
384
+                        if (file_exists($file = $dir.$pathEnd)) {
385 385
                             return $file;
386 386
                         }
387 387
                     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         // PSR-4 fallback dirs
393 393
         foreach ($this->fallbackDirsPsr4 as $dir) {
394
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
394
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
395 395
                 return $file;
396 396
             }
397 397
         }
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404 404
         } else {
405 405
             // PEAR-like class name
406
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
406
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
407 407
         }
408 408
 
409 409
         if (isset($this->prefixesPsr0[$first])) {
410 410
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411 411
                 if (0 === strpos($class, $prefix)) {
412 412
                     foreach ($dirs as $dir) {
413
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
413
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
414 414
                             return $file;
415 415
                         }
416 416
                     }
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         // PSR-0 fallback dirs
422 422
         foreach ($this->fallbackDirsPsr0 as $dir) {
423
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
423
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
424 424
                 return $file;
425 425
             }
426 426
         }
Please login to merge, or discard this patch.
lib/public/UserStatus/IUserStatus.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return string|null
86 86
 	 * @since 20.0.0
87 87
 	 */
88
-	public function getMessage():?string;
88
+	public function getMessage(): ?string;
89 89
 
90 90
 	/**
91 91
 	 * Get a custom icon provided by the user
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return string|null
94 94
 	 * @since 20.0.0
95 95
 	 */
96
-	public function getIcon():?string;
96
+	public function getIcon(): ?string;
97 97
 
98 98
 	/**
99 99
 	 * Gets the time that the custom status will be cleared at
@@ -101,5 +101,5 @@  discard block
 block discarded – undo
101 101
 	 * @return DateTimeImmutable|null
102 102
 	 * @since 20.0.0
103 103
 	 */
104
-	public function getClearAt():?DateTimeImmutable;
104
+	public function getClearAt(): ?DateTimeImmutable;
105 105
 }
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -16,119 +16,119 @@
 block discarded – undo
16 16
  * @since 20.0.0
17 17
  */
18 18
 interface IUserStatus {
19
-	/**
20
-	 * @var string
21
-	 * @since 20.0.0
22
-	 */
23
-	public const ONLINE = 'online';
24
-
25
-	/**
26
-	 * @var string
27
-	 * @since 20.0.0
28
-	 */
29
-	public const AWAY = 'away';
30
-
31
-	/**
32
-	 * @var string
33
-	 * @since 20.0.0
34
-	 */
35
-	public const DND = 'dnd';
36
-
37
-	/**
38
-	 * @var string
39
-	 * @since 28.0.0
40
-	 */
41
-	public const BUSY = 'busy';
42
-
43
-	/**
44
-	 * @var string
45
-	 * @since 20.0.0
46
-	 */
47
-	public const OFFLINE = 'offline';
48
-
49
-	/**
50
-	 * @var string
51
-	 * @since 20.0.0
52
-	 */
53
-	public const INVISIBLE = 'invisible';
54
-
55
-	/**
56
-	 * @var string
57
-	 * @since 25.0.0
58
-	 */
59
-	public const MESSAGE_CALL = 'call';
60
-
61
-	/**
62
-	 * @var string
63
-	 * @since 25.0.0
64
-	 */
65
-	public const MESSAGE_AVAILABILITY = 'availability';
66
-
67
-	/**
68
-	 * @var string
69
-	 * @since 28.0.1
70
-	 */
71
-	public const MESSAGE_OUT_OF_OFFICE = 'out-of-office';
72
-
73
-	/**
74
-	 * @var string
75
-	 * @since 28.0.0
76
-	 */
77
-	public const MESSAGE_VACATION = 'vacationing';
78
-
79
-	/**
80
-	 * @var string
81
-	 * @since 28.0.0
82
-	 */
83
-	public const MESSAGE_CALENDAR_BUSY = 'meeting';
84
-
85
-	/**
86
-	 * @var string
87
-	 * @since 28.0.0
88
-	 */
89
-	public const MESSAGE_CALENDAR_BUSY_TENTATIVE = 'busy-tentative';
90
-
91
-	/**
92
-	 * Get the user this status is connected to
93
-	 *
94
-	 * @return string
95
-	 * @since 20.0.0
96
-	 */
97
-	public function getUserId():string;
98
-
99
-	/**
100
-	 * Get the status
101
-	 *
102
-	 * It will return one of the constants defined above.
103
-	 * It will never return invisible. In case a user marked
104
-	 * themselves as invisible, it will return offline.
105
-	 *
106
-	 * @return string See IUserStatus constants
107
-	 * @since 20.0.0
108
-	 */
109
-	public function getStatus():string;
110
-
111
-	/**
112
-	 * Get a custom message provided by the user
113
-	 *
114
-	 * @return string|null
115
-	 * @since 20.0.0
116
-	 */
117
-	public function getMessage():?string;
118
-
119
-	/**
120
-	 * Get a custom icon provided by the user
121
-	 *
122
-	 * @return string|null
123
-	 * @since 20.0.0
124
-	 */
125
-	public function getIcon():?string;
126
-
127
-	/**
128
-	 * Gets the time that the custom status will be cleared at
129
-	 *
130
-	 * @return DateTimeImmutable|null
131
-	 * @since 20.0.0
132
-	 */
133
-	public function getClearAt():?DateTimeImmutable;
19
+    /**
20
+     * @var string
21
+     * @since 20.0.0
22
+     */
23
+    public const ONLINE = 'online';
24
+
25
+    /**
26
+     * @var string
27
+     * @since 20.0.0
28
+     */
29
+    public const AWAY = 'away';
30
+
31
+    /**
32
+     * @var string
33
+     * @since 20.0.0
34
+     */
35
+    public const DND = 'dnd';
36
+
37
+    /**
38
+     * @var string
39
+     * @since 28.0.0
40
+     */
41
+    public const BUSY = 'busy';
42
+
43
+    /**
44
+     * @var string
45
+     * @since 20.0.0
46
+     */
47
+    public const OFFLINE = 'offline';
48
+
49
+    /**
50
+     * @var string
51
+     * @since 20.0.0
52
+     */
53
+    public const INVISIBLE = 'invisible';
54
+
55
+    /**
56
+     * @var string
57
+     * @since 25.0.0
58
+     */
59
+    public const MESSAGE_CALL = 'call';
60
+
61
+    /**
62
+     * @var string
63
+     * @since 25.0.0
64
+     */
65
+    public const MESSAGE_AVAILABILITY = 'availability';
66
+
67
+    /**
68
+     * @var string
69
+     * @since 28.0.1
70
+     */
71
+    public const MESSAGE_OUT_OF_OFFICE = 'out-of-office';
72
+
73
+    /**
74
+     * @var string
75
+     * @since 28.0.0
76
+     */
77
+    public const MESSAGE_VACATION = 'vacationing';
78
+
79
+    /**
80
+     * @var string
81
+     * @since 28.0.0
82
+     */
83
+    public const MESSAGE_CALENDAR_BUSY = 'meeting';
84
+
85
+    /**
86
+     * @var string
87
+     * @since 28.0.0
88
+     */
89
+    public const MESSAGE_CALENDAR_BUSY_TENTATIVE = 'busy-tentative';
90
+
91
+    /**
92
+     * Get the user this status is connected to
93
+     *
94
+     * @return string
95
+     * @since 20.0.0
96
+     */
97
+    public function getUserId():string;
98
+
99
+    /**
100
+     * Get the status
101
+     *
102
+     * It will return one of the constants defined above.
103
+     * It will never return invisible. In case a user marked
104
+     * themselves as invisible, it will return offline.
105
+     *
106
+     * @return string See IUserStatus constants
107
+     * @since 20.0.0
108
+     */
109
+    public function getStatus():string;
110
+
111
+    /**
112
+     * Get a custom message provided by the user
113
+     *
114
+     * @return string|null
115
+     * @since 20.0.0
116
+     */
117
+    public function getMessage():?string;
118
+
119
+    /**
120
+     * Get a custom icon provided by the user
121
+     *
122
+     * @return string|null
123
+     * @since 20.0.0
124
+     */
125
+    public function getIcon():?string;
126
+
127
+    /**
128
+     * Gets the time that the custom status will be cleared at
129
+     *
130
+     * @return DateTimeImmutable|null
131
+     * @since 20.0.0
132
+     */
133
+    public function getClearAt():?DateTimeImmutable;
134 134
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Service/UserGlobalStoragesService.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 		$result = [];
117 117
 		foreach ($storagesByMountpoint as $storageList) {
118
-			$storage = array_reduce($storageList, function ($carry, $item) {
118
+			$storage = array_reduce($storageList, function($carry, $item) {
119 119
 				if (isset($carry)) {
120 120
 					$carryPriorityType = $this->getPriorityType($carry);
121 121
 					$itemPriorityType = $this->getPriorityType($item);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 		$groupIds = $this->groupManager->getUserGroupIds($user);
192 192
 		$mounts = $this->dbConfig->getMountsForUser($user->getUID(), $groupIds);
193 193
 		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
194
-		$configs = array_filter($configs, function ($config) {
194
+		$configs = array_filter($configs, function($config) {
195 195
 			return $config instanceof StorageConfig;
196 196
 		});
197 197
 
198
-		$keys = array_map(function (StorageConfig $config) {
198
+		$keys = array_map(function(StorageConfig $config) {
199 199
 			return $config->getId();
200 200
 		}, $configs);
201 201
 
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -18,169 +18,169 @@
 block discarded – undo
18 18
  * Read-only access available, attempting to write will throw DomainException
19 19
  */
20 20
 class UserGlobalStoragesService extends GlobalStoragesService {
21
-	use UserTrait;
22
-
23
-	/**
24
-	 * @param BackendService $backendService
25
-	 * @param DBConfigService $dbConfig
26
-	 * @param IUserSession $userSession
27
-	 * @param IGroupManager $groupManager
28
-	 * @param IUserMountCache $userMountCache
29
-	 * @param IEventDispatcher $eventDispatcher
30
-	 */
31
-	public function __construct(
32
-		BackendService $backendService,
33
-		DBConfigService $dbConfig,
34
-		IUserSession $userSession,
35
-		protected IGroupManager $groupManager,
36
-		IUserMountCache $userMountCache,
37
-		IEventDispatcher $eventDispatcher,
38
-	) {
39
-		parent::__construct($backendService, $dbConfig, $userMountCache, $eventDispatcher);
40
-		$this->userSession = $userSession;
41
-	}
42
-
43
-	/**
44
-	 * Replace config hash ID with real IDs, for migrating legacy storages
45
-	 *
46
-	 * @param StorageConfig[] $storages Storages with real IDs
47
-	 * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs
48
-	 */
49
-	protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) {
50
-		// as a read-only view, storage IDs don't need to be real
51
-		foreach ($storagesWithConfigHash as $storage) {
52
-			$storages[$storage->getId()] = $storage;
53
-		}
54
-	}
55
-
56
-	protected function readDBConfig() {
57
-		$userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID());
58
-		$globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null);
59
-		$groups = $this->groupManager->getUserGroupIds($this->getUser());
60
-		if (count($groups) !== 0) {
61
-			$groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups);
62
-		} else {
63
-			$groupMounts = [];
64
-		}
65
-		return array_merge($userMounts, $groupMounts, $globalMounts);
66
-	}
67
-
68
-	public function addStorage(StorageConfig $newStorage) {
69
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
70
-	}
71
-
72
-	public function updateStorage(StorageConfig $updatedStorage) {
73
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
74
-	}
75
-
76
-	/**
77
-	 * @param integer $id
78
-	 */
79
-	public function removeStorage($id) {
80
-		throw new \DomainException('UserGlobalStoragesService writing disallowed');
81
-	}
82
-
83
-	/**
84
-	 * Get unique storages, in case two are defined with the same mountpoint
85
-	 * Higher priority storages take precedence
86
-	 *
87
-	 * @return StorageConfig[]
88
-	 */
89
-	public function getUniqueStorages() {
90
-		$storages = $this->getStorages();
91
-
92
-		$storagesByMountpoint = [];
93
-		foreach ($storages as $storage) {
94
-			$storagesByMountpoint[$storage->getMountPoint()][] = $storage;
95
-		}
96
-
97
-		$result = [];
98
-		foreach ($storagesByMountpoint as $storageList) {
99
-			$storage = array_reduce($storageList, function ($carry, $item) {
100
-				if (isset($carry)) {
101
-					$carryPriorityType = $this->getPriorityType($carry);
102
-					$itemPriorityType = $this->getPriorityType($item);
103
-					if ($carryPriorityType > $itemPriorityType) {
104
-						return $carry;
105
-					} elseif ($carryPriorityType === $itemPriorityType) {
106
-						if ($carry->getPriority() > $item->getPriority()) {
107
-							return $carry;
108
-						}
109
-					}
110
-				}
111
-				return $item;
112
-			});
113
-			$result[$storage->getID()] = $storage;
114
-		}
115
-
116
-		return $result;
117
-	}
118
-
119
-	/**
120
-	 * Get a priority 'type', where a bigger number means higher priority
121
-	 * user applicable > group applicable > 'all'
122
-	 *
123
-	 * @param StorageConfig $storage
124
-	 * @return int
125
-	 */
126
-	protected function getPriorityType(StorageConfig $storage) {
127
-		$applicableUsers = $storage->getApplicableUsers();
128
-		$applicableGroups = $storage->getApplicableGroups();
129
-
130
-		if ($applicableUsers && $applicableUsers[0] !== 'all') {
131
-			return 2;
132
-		}
133
-		if ($applicableGroups) {
134
-			return 1;
135
-		}
136
-		return 0;
137
-	}
138
-
139
-	protected function isApplicable(StorageConfig $config) {
140
-		$applicableUsers = $config->getApplicableUsers();
141
-		$applicableGroups = $config->getApplicableGroups();
142
-
143
-		if (count($applicableUsers) === 0 && count($applicableGroups) === 0) {
144
-			return true;
145
-		}
146
-		if (in_array($this->getUser()->getUID(), $applicableUsers, true)) {
147
-			return true;
148
-		}
149
-		$groupIds = $this->groupManager->getUserGroupIds($this->getUser());
150
-		foreach ($groupIds as $groupId) {
151
-			if (in_array($groupId, $applicableGroups, true)) {
152
-				return true;
153
-			}
154
-		}
155
-		return false;
156
-	}
157
-
158
-
159
-	/**
160
-	 * Gets all storages for the user, admin, personal, global, etc
161
-	 *
162
-	 * @param IUser|null $user user to get the storages for, if not set the currently logged in user will be used
163
-	 * @return StorageConfig[] array of storage configs
164
-	 */
165
-	public function getAllStoragesForUser(?IUser $user = null) {
166
-		if (is_null($user)) {
167
-			$user = $this->getUser();
168
-		}
169
-		if (is_null($user)) {
170
-			return [];
171
-		}
172
-		$groupIds = $this->groupManager->getUserGroupIds($user);
173
-		$mounts = $this->dbConfig->getMountsForUser($user->getUID(), $groupIds);
174
-		$configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
175
-		$configs = array_filter($configs, function ($config) {
176
-			return $config instanceof StorageConfig;
177
-		});
178
-
179
-		$keys = array_map(function (StorageConfig $config) {
180
-			return $config->getId();
181
-		}, $configs);
182
-
183
-		$storages = array_combine($keys, $configs);
184
-		return array_filter($storages, [$this, 'validateStorage']);
185
-	}
21
+    use UserTrait;
22
+
23
+    /**
24
+     * @param BackendService $backendService
25
+     * @param DBConfigService $dbConfig
26
+     * @param IUserSession $userSession
27
+     * @param IGroupManager $groupManager
28
+     * @param IUserMountCache $userMountCache
29
+     * @param IEventDispatcher $eventDispatcher
30
+     */
31
+    public function __construct(
32
+        BackendService $backendService,
33
+        DBConfigService $dbConfig,
34
+        IUserSession $userSession,
35
+        protected IGroupManager $groupManager,
36
+        IUserMountCache $userMountCache,
37
+        IEventDispatcher $eventDispatcher,
38
+    ) {
39
+        parent::__construct($backendService, $dbConfig, $userMountCache, $eventDispatcher);
40
+        $this->userSession = $userSession;
41
+    }
42
+
43
+    /**
44
+     * Replace config hash ID with real IDs, for migrating legacy storages
45
+     *
46
+     * @param StorageConfig[] $storages Storages with real IDs
47
+     * @param StorageConfig[] $storagesWithConfigHash Storages with config hash IDs
48
+     */
49
+    protected function setRealStorageIds(array &$storages, array $storagesWithConfigHash) {
50
+        // as a read-only view, storage IDs don't need to be real
51
+        foreach ($storagesWithConfigHash as $storage) {
52
+            $storages[$storage->getId()] = $storage;
53
+        }
54
+    }
55
+
56
+    protected function readDBConfig() {
57
+        $userMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_USER, $this->getUser()->getUID());
58
+        $globalMounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null);
59
+        $groups = $this->groupManager->getUserGroupIds($this->getUser());
60
+        if (count($groups) !== 0) {
61
+            $groupMounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, $groups);
62
+        } else {
63
+            $groupMounts = [];
64
+        }
65
+        return array_merge($userMounts, $groupMounts, $globalMounts);
66
+    }
67
+
68
+    public function addStorage(StorageConfig $newStorage) {
69
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
70
+    }
71
+
72
+    public function updateStorage(StorageConfig $updatedStorage) {
73
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
74
+    }
75
+
76
+    /**
77
+     * @param integer $id
78
+     */
79
+    public function removeStorage($id) {
80
+        throw new \DomainException('UserGlobalStoragesService writing disallowed');
81
+    }
82
+
83
+    /**
84
+     * Get unique storages, in case two are defined with the same mountpoint
85
+     * Higher priority storages take precedence
86
+     *
87
+     * @return StorageConfig[]
88
+     */
89
+    public function getUniqueStorages() {
90
+        $storages = $this->getStorages();
91
+
92
+        $storagesByMountpoint = [];
93
+        foreach ($storages as $storage) {
94
+            $storagesByMountpoint[$storage->getMountPoint()][] = $storage;
95
+        }
96
+
97
+        $result = [];
98
+        foreach ($storagesByMountpoint as $storageList) {
99
+            $storage = array_reduce($storageList, function ($carry, $item) {
100
+                if (isset($carry)) {
101
+                    $carryPriorityType = $this->getPriorityType($carry);
102
+                    $itemPriorityType = $this->getPriorityType($item);
103
+                    if ($carryPriorityType > $itemPriorityType) {
104
+                        return $carry;
105
+                    } elseif ($carryPriorityType === $itemPriorityType) {
106
+                        if ($carry->getPriority() > $item->getPriority()) {
107
+                            return $carry;
108
+                        }
109
+                    }
110
+                }
111
+                return $item;
112
+            });
113
+            $result[$storage->getID()] = $storage;
114
+        }
115
+
116
+        return $result;
117
+    }
118
+
119
+    /**
120
+     * Get a priority 'type', where a bigger number means higher priority
121
+     * user applicable > group applicable > 'all'
122
+     *
123
+     * @param StorageConfig $storage
124
+     * @return int
125
+     */
126
+    protected function getPriorityType(StorageConfig $storage) {
127
+        $applicableUsers = $storage->getApplicableUsers();
128
+        $applicableGroups = $storage->getApplicableGroups();
129
+
130
+        if ($applicableUsers && $applicableUsers[0] !== 'all') {
131
+            return 2;
132
+        }
133
+        if ($applicableGroups) {
134
+            return 1;
135
+        }
136
+        return 0;
137
+    }
138
+
139
+    protected function isApplicable(StorageConfig $config) {
140
+        $applicableUsers = $config->getApplicableUsers();
141
+        $applicableGroups = $config->getApplicableGroups();
142
+
143
+        if (count($applicableUsers) === 0 && count($applicableGroups) === 0) {
144
+            return true;
145
+        }
146
+        if (in_array($this->getUser()->getUID(), $applicableUsers, true)) {
147
+            return true;
148
+        }
149
+        $groupIds = $this->groupManager->getUserGroupIds($this->getUser());
150
+        foreach ($groupIds as $groupId) {
151
+            if (in_array($groupId, $applicableGroups, true)) {
152
+                return true;
153
+            }
154
+        }
155
+        return false;
156
+    }
157
+
158
+
159
+    /**
160
+     * Gets all storages for the user, admin, personal, global, etc
161
+     *
162
+     * @param IUser|null $user user to get the storages for, if not set the currently logged in user will be used
163
+     * @return StorageConfig[] array of storage configs
164
+     */
165
+    public function getAllStoragesForUser(?IUser $user = null) {
166
+        if (is_null($user)) {
167
+            $user = $this->getUser();
168
+        }
169
+        if (is_null($user)) {
170
+            return [];
171
+        }
172
+        $groupIds = $this->groupManager->getUserGroupIds($user);
173
+        $mounts = $this->dbConfig->getMountsForUser($user->getUID(), $groupIds);
174
+        $configs = array_map([$this, 'getStorageConfigFromDBMount'], $mounts);
175
+        $configs = array_filter($configs, function ($config) {
176
+            return $config instanceof StorageConfig;
177
+        });
178
+
179
+        $keys = array_map(function (StorageConfig $config) {
180
+            return $config->getId();
181
+        }, $configs);
182
+
183
+        $storages = array_combine($keys, $configs);
184
+        return array_filter($storages, [$this, 'validateStorage']);
185
+    }
186 186
 }
Please login to merge, or discard this patch.