Completed
Push — master ( 034246...d4e9a8 )
by
unknown
19:42 queued 13s
created
apps/dav/lib/Migration/Version1011Date20190725113607.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,55 +37,55 @@
 block discarded – undo
37 37
  */
38 38
 class Version1011Date20190725113607 extends SimpleMigrationStep {
39 39
 
40
-	/**
41
-	 * @param IOutput $output
42
-	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
43
-	 * @param array $options
44
-	 * @return null|ISchemaWrapper
45
-	 * @since 13.0.0
46
-	 */
47
-	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
48
-		/** @var ISchemaWrapper $schema */
49
-		$schema = $schemaClosure();
40
+    /**
41
+     * @param IOutput $output
42
+     * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
43
+     * @param array $options
44
+     * @return null|ISchemaWrapper
45
+     * @since 13.0.0
46
+     */
47
+    public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
48
+        /** @var ISchemaWrapper $schema */
49
+        $schema = $schemaClosure();
50 50
 
51
-		$types = ['resource', 'room'];
52
-		foreach ($types as $type) {
53
-			if (!$schema->hasTable($this->getMetadataTableName($type))) {
54
-				$table = $schema->createTable($this->getMetadataTableName($type));
51
+        $types = ['resource', 'room'];
52
+        foreach ($types as $type) {
53
+            if (!$schema->hasTable($this->getMetadataTableName($type))) {
54
+                $table = $schema->createTable($this->getMetadataTableName($type));
55 55
 
56
-				$table->addColumn('id', Types::BIGINT, [
57
-					'autoincrement' => true,
58
-					'notnull' => true,
59
-					'length' => 11,
60
-					'unsigned' => true,
61
-				]);
62
-				$table->addColumn($type . '_id', Types::BIGINT, [
63
-					'notnull' => true,
64
-					'length' => 11,
65
-					'unsigned' => true,
66
-				]);
67
-				$table->addColumn('key', Types::STRING, [
68
-					'notnull' => true,
69
-					'length' => 255,
70
-				]);
71
-				$table->addColumn('value', Types::STRING, [
72
-					'notnull' => false,
73
-					'length' => 4000,
74
-				]);
56
+                $table->addColumn('id', Types::BIGINT, [
57
+                    'autoincrement' => true,
58
+                    'notnull' => true,
59
+                    'length' => 11,
60
+                    'unsigned' => true,
61
+                ]);
62
+                $table->addColumn($type . '_id', Types::BIGINT, [
63
+                    'notnull' => true,
64
+                    'length' => 11,
65
+                    'unsigned' => true,
66
+                ]);
67
+                $table->addColumn('key', Types::STRING, [
68
+                    'notnull' => true,
69
+                    'length' => 255,
70
+                ]);
71
+                $table->addColumn('value', Types::STRING, [
72
+                    'notnull' => false,
73
+                    'length' => 4000,
74
+                ]);
75 75
 
76
-				$table->setPrimaryKey(['id']);
77
-				$table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk');
78
-			}
79
-		}
76
+                $table->setPrimaryKey(['id']);
77
+                $table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk');
78
+            }
79
+        }
80 80
 
81
-		return $schema;
82
-	}
81
+        return $schema;
82
+    }
83 83
 
84
-	/**
85
-	 * @param string $type
86
-	 * @return string
87
-	 */
88
-	private function getMetadataTableName(string $type):string {
89
-		return 'calendar_' . $type . 's_md';
90
-	}
84
+    /**
85
+     * @param string $type
86
+     * @return string
87
+     */
88
+    private function getMetadataTableName(string $type):string {
89
+        return 'calendar_' . $type . 's_md';
90
+    }
91 91
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 					'length' => 11,
60 60
 					'unsigned' => true,
61 61
 				]);
62
-				$table->addColumn($type . '_id', Types::BIGINT, [
62
+				$table->addColumn($type.'_id', Types::BIGINT, [
63 63
 					'notnull' => true,
64 64
 					'length' => 11,
65 65
 					'unsigned' => true,
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				]);
75 75
 
76 76
 				$table->setPrimaryKey(['id']);
77
-				$table->addIndex([$type . '_id', 'key'], $this->getMetadataTableName($type) . '_idk');
77
+				$table->addIndex([$type.'_id', 'key'], $this->getMetadataTableName($type).'_idk');
78 78
 			}
79 79
 		}
80 80
 
@@ -86,6 +86,6 @@  discard block
 block discarded – undo
86 86
 	 * @return string
87 87
 	 */
88 88
 	private function getMetadataTableName(string $type):string {
89
-		return 'calendar_' . $type . 's_md';
89
+		return 'calendar_'.$type.'s_md';
90 90
 	}
91 91
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Bootstrap/FunctionInjector.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 
44 44
 	public function injectFn(callable $fn) {
45 45
 		$reflected = new ReflectionFunction(Closure::fromCallable($fn));
46
-		return $fn(...array_map(function (ReflectionParameter $param) {
46
+		return $fn(...array_map(function(ReflectionParameter $param) {
47 47
 			// First we try by type (more likely these days)
48 48
 			if (($type = $param->getType()) !== null) {
49 49
 				try {
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,36 +33,36 @@
 block discarded – undo
33 33
 use function array_map;
34 34
 
35 35
 class FunctionInjector {
36
-	/** @var ContainerInterface */
37
-	private $container;
36
+    /** @var ContainerInterface */
37
+    private $container;
38 38
 
39
-	public function __construct(ContainerInterface $container) {
40
-		$this->container = $container;
41
-	}
39
+    public function __construct(ContainerInterface $container) {
40
+        $this->container = $container;
41
+    }
42 42
 
43
-	public function injectFn(callable $fn) {
44
-		$reflected = new ReflectionFunction(Closure::fromCallable($fn));
45
-		return $fn(...array_map(function (ReflectionParameter $param) {
46
-			// First we try by type (more likely these days)
47
-			if (($type = $param->getType()) !== null) {
48
-				try {
49
-					return $this->container->get($type->getName());
50
-				} catch (QueryException $ex) {
51
-					// Ignore and try name as well
52
-				}
53
-			}
54
-			// Second we try by name (mostly for primitives)
55
-			try {
56
-				return $this->container->get($param->getName());
57
-			} catch (QueryException $ex) {
58
-				// As a last resort we pass `null` if allowed
59
-				if ($type !== null && $type->allowsNull()) {
60
-					return null;
61
-				}
43
+    public function injectFn(callable $fn) {
44
+        $reflected = new ReflectionFunction(Closure::fromCallable($fn));
45
+        return $fn(...array_map(function (ReflectionParameter $param) {
46
+            // First we try by type (more likely these days)
47
+            if (($type = $param->getType()) !== null) {
48
+                try {
49
+                    return $this->container->get($type->getName());
50
+                } catch (QueryException $ex) {
51
+                    // Ignore and try name as well
52
+                }
53
+            }
54
+            // Second we try by name (mostly for primitives)
55
+            try {
56
+                return $this->container->get($param->getName());
57
+            } catch (QueryException $ex) {
58
+                // As a last resort we pass `null` if allowed
59
+                if ($type !== null && $type->allowsNull()) {
60
+                    return null;
61
+                }
62 62
 
63
-				// Nothing worked, time to bail out
64
-				throw $ex;
65
-			}
66
-		}, $reflected->getParameters()));
67
-	}
63
+                // Nothing worked, time to bail out
64
+                throw $ex;
65
+            }
66
+        }, $reflected->getParameters()));
67
+    }
68 68
 }
Please login to merge, or discard this patch.
lib/public/Lock/LockedException.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
 		if ($readablePath) {
61 61
 			$message = "\"$path\"(\"$readablePath\") is locked";
62 62
 		} else {
63
-			$message = '"' . $path . '" is locked';
63
+			$message = '"'.$path.'" is locked';
64 64
 		}
65 65
 		$this->existingLock = $existingLock;
66 66
 		if ($existingLock) {
67
-			$message .= ', existing lock on file: ' . $existingLock;
67
+			$message .= ', existing lock on file: '.$existingLock;
68 68
 		}
69 69
 		parent::__construct($message, 0, $previous);
70 70
 		$this->path = $path;
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -14,64 +14,64 @@
 block discarded – undo
14 14
  * @since 8.1.0
15 15
  */
16 16
 class LockedException extends \Exception {
17
-	/**
18
-	 * Locked path
19
-	 *
20
-	 * @var string
21
-	 */
22
-	private $path;
17
+    /**
18
+     * Locked path
19
+     *
20
+     * @var string
21
+     */
22
+    private $path;
23 23
 
24
-	/** @var string|null */
25
-	private $existingLock;
24
+    /** @var string|null */
25
+    private $existingLock;
26 26
 
27
-	private ?string $readablePath;
27
+    private ?string $readablePath;
28 28
 
29
-	/**
30
-	 * LockedException constructor.
31
-	 *
32
-	 * @param string $path locked path
33
-	 * @param \Exception|null $previous previous exception for cascading
34
-	 * @param string $existingLock since 14.0.0
35
-	 * @param string $readablePath since 20.0.0
36
-	 * @since 8.1.0
37
-	 */
38
-	public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $readablePath = null) {
39
-		$this->readablePath = $readablePath;
40
-		if ($readablePath) {
41
-			$message = "\"$path\"(\"$readablePath\") is locked";
42
-		} else {
43
-			$message = '"' . $path . '" is locked';
44
-		}
45
-		$this->existingLock = $existingLock;
46
-		if ($existingLock) {
47
-			$message .= ', existing lock on file: ' . $existingLock;
48
-		}
49
-		parent::__construct($message, 0, $previous);
50
-		$this->path = $path;
51
-	}
29
+    /**
30
+     * LockedException constructor.
31
+     *
32
+     * @param string $path locked path
33
+     * @param \Exception|null $previous previous exception for cascading
34
+     * @param string $existingLock since 14.0.0
35
+     * @param string $readablePath since 20.0.0
36
+     * @since 8.1.0
37
+     */
38
+    public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $readablePath = null) {
39
+        $this->readablePath = $readablePath;
40
+        if ($readablePath) {
41
+            $message = "\"$path\"(\"$readablePath\") is locked";
42
+        } else {
43
+            $message = '"' . $path . '" is locked';
44
+        }
45
+        $this->existingLock = $existingLock;
46
+        if ($existingLock) {
47
+            $message .= ', existing lock on file: ' . $existingLock;
48
+        }
49
+        parent::__construct($message, 0, $previous);
50
+        $this->path = $path;
51
+    }
52 52
 
53
-	/**
54
-	 * @return string
55
-	 * @since 8.1.0
56
-	 */
57
-	public function getPath(): string {
58
-		return $this->path;
59
-	}
53
+    /**
54
+     * @return string
55
+     * @since 8.1.0
56
+     */
57
+    public function getPath(): string {
58
+        return $this->path;
59
+    }
60 60
 
61
-	/**
62
-	 * @return string
63
-	 * @since 19.0.0
64
-	 */
65
-	public function getExistingLock(): ?string {
66
-		return $this->existingLock;
67
-	}
61
+    /**
62
+     * @return string
63
+     * @since 19.0.0
64
+     */
65
+    public function getExistingLock(): ?string {
66
+        return $this->existingLock;
67
+    }
68 68
 
69
-	/**
70
-	 * @return ?string
71
-	 * @since 32.0.0
72
-	 */
73
-	public function getReadablePath(): ?string {
74
-		return $this->readablePath;
75
-	}
69
+    /**
70
+     * @return ?string
71
+     * @since 32.0.0
72
+     */
73
+    public function getReadablePath(): ?string {
74
+        return $this->readablePath;
75
+    }
76 76
 
77 77
 }
Please login to merge, or discard this patch.
apps/sharebymail/lib/AppInfo/Application.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 use OCP\AppFramework\Bootstrap\IRegistrationContext;
36 36
 
37 37
 class Application extends App implements IBootstrap {
38
-	public const APP_ID = 'sharebymail';
38
+    public const APP_ID = 'sharebymail';
39 39
 
40
-	public function __construct() {
41
-		parent::__construct(self::APP_ID);
42
-	}
40
+    public function __construct() {
41
+        parent::__construct(self::APP_ID);
42
+    }
43 43
 
44
-	public function register(IRegistrationContext $context): void {
45
-		$context->registerCapability(Capabilities::class);
46
-	}
44
+    public function register(IRegistrationContext $context): void {
45
+        $context->registerCapability(Capabilities::class);
46
+    }
47 47
 
48
-	public function boot(IBootContext $context): void {
49
-	}
48
+    public function boot(IBootContext $context): void {
49
+    }
50 50
 }
Please login to merge, or discard this patch.
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.