Passed
Push — master ( 1a33a4...aa81b8 )
by Christoph
15:00 queued 13s
created
lib/public/Talk/IBroker.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -37,49 +37,49 @@
 block discarded – undo
37 37
  */
38 38
 interface IBroker {
39 39
 
40
-	/**
41
-	 * Check if the Talk backend is available
42
-	 *
43
-	 * @return bool
44
-	 * @since 24.0.0
45
-	 */
46
-	public function hasBackend(): bool;
40
+    /**
41
+     * Check if the Talk backend is available
42
+     *
43
+     * @return bool
44
+     * @since 24.0.0
45
+     */
46
+    public function hasBackend(): bool;
47 47
 
48
-	/**
49
-	 * Create a new instance of the objects object for specifics of a new conversation
50
-	 *
51
-	 * @return IConversationOptions
52
-	 * @throws NoBackendException when Talk is not available
53
-	 * @since 24.0.0
54
-	 */
55
-	public function newConversationOptions(): IConversationOptions;
48
+    /**
49
+     * Create a new instance of the objects object for specifics of a new conversation
50
+     *
51
+     * @return IConversationOptions
52
+     * @throws NoBackendException when Talk is not available
53
+     * @since 24.0.0
54
+     */
55
+    public function newConversationOptions(): IConversationOptions;
56 56
 
57
-	/**
58
-	 * Create a new conversation
59
-	 *
60
-	 * The conversation is private by default. Use the options parameter to make
61
-	 * it public.
62
-	 *
63
-	 * @param string $name
64
-	 * @param IUser[] $moderators
65
-	 * @param IConversationOptions|null $options optional configuration for the conversation
66
-	 *
67
-	 * @return IConversation
68
-	 * @throws NoBackendException when Talk is not available
69
-	 * @since 24.0.0
70
-	 */
71
-	public function createConversation(string $name,
72
-									   array $moderators,
73
-									   IConversationOptions $options = null): IConversation;
57
+    /**
58
+     * Create a new conversation
59
+     *
60
+     * The conversation is private by default. Use the options parameter to make
61
+     * it public.
62
+     *
63
+     * @param string $name
64
+     * @param IUser[] $moderators
65
+     * @param IConversationOptions|null $options optional configuration for the conversation
66
+     *
67
+     * @return IConversation
68
+     * @throws NoBackendException when Talk is not available
69
+     * @since 24.0.0
70
+     */
71
+    public function createConversation(string $name,
72
+                                        array $moderators,
73
+                                        IConversationOptions $options = null): IConversation;
74 74
 
75
-	/**
76
-	 * Delete a conversation by id
77
-	 *
78
-	 * @param string $id conversation id
79
-	 *
80
-	 * @return void
81
-	 * @throws NoBackendException when Talk is not available
82
-	 * @since 26.0.0
83
-	 */
84
-	public function deleteConversation(string $id): void;
75
+    /**
76
+     * Delete a conversation by id
77
+     *
78
+     * @param string $id conversation id
79
+     *
80
+     * @return void
81
+     * @throws NoBackendException when Talk is not available
82
+     * @since 26.0.0
83
+     */
84
+    public function deleteConversation(string $id): void;
85 85
 }
Please login to merge, or discard this patch.
lib/public/Talk/ITalkBackend.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,25 +38,25 @@
 block discarded – undo
38 38
  */
39 39
 interface ITalkBackend {
40 40
 
41
-	/**
42
-	 * @param string $name
43
-	 * @param IUser[] $moderators
44
-	 * @param IConversationOptions $options configuration for the conversation
45
-	 *
46
-	 * @return IConversation
47
-	 * @since 24.0.0
48
-	 */
49
-	public function createConversation(string $name,
50
-									   array $moderators,
51
-									   IConversationOptions $options): IConversation;
41
+    /**
42
+     * @param string $name
43
+     * @param IUser[] $moderators
44
+     * @param IConversationOptions $options configuration for the conversation
45
+     *
46
+     * @return IConversation
47
+     * @since 24.0.0
48
+     */
49
+    public function createConversation(string $name,
50
+                                        array $moderators,
51
+                                        IConversationOptions $options): IConversation;
52 52
 
53
-	/**
54
-	 * Delete a conversation by id
55
-	 *
56
-	 * @param string $id conversation id
57
-	 *
58
-	 * @return void
59
-	 * @since 26.0.0
60
-	 */
61
-	public function deleteConversation(string $id): void;
53
+    /**
54
+     * Delete a conversation by id
55
+     *
56
+     * @param string $id conversation id
57
+     *
58
+     * @return void
59
+     * @since 26.0.0
60
+     */
61
+    public function deleteConversation(string $id): void;
62 62
 }
Please login to merge, or discard this patch.
lib/public/Talk/IConversation.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
  */
31 31
 interface IConversation {
32 32
 
33
-	/**
34
-	 * Get the unique token that identifies this conversation
35
-	 *
36
-	 * @return string
37
-	 * @since 26.0.0
38
-	 */
39
-	public function getId(): string;
33
+    /**
34
+     * Get the unique token that identifies this conversation
35
+     *
36
+     * @return string
37
+     * @since 26.0.0
38
+     */
39
+    public function getId(): string;
40 40
 
41
-	/**
42
-	 * Get the absolute URL to this conversation
43
-	 *
44
-	 * @return string
45
-	 * @since 24.0.0
46
-	 */
47
-	public function getAbsoluteUrl(): string;
41
+    /**
42
+     * Get the absolute URL to this conversation
43
+     *
44
+     * @return string
45
+     * @since 24.0.0
46
+     */
47
+    public function getAbsoluteUrl(): string;
48 48
 }
Please login to merge, or discard this patch.
lib/private/Talk/Broker.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -37,81 +37,81 @@
 block discarded – undo
37 37
 use Throwable;
38 38
 
39 39
 class Broker implements IBroker {
40
-	private Coordinator $coordinator;
41
-
42
-	private IServerContainer $container;
43
-
44
-	private LoggerInterface $logger;
45
-
46
-	private ?bool $hasBackend = null;
47
-
48
-	private ?ITalkBackend $backend = null;
49
-
50
-	public function __construct(Coordinator $coordinator,
51
-								IServerContainer $container,
52
-								LoggerInterface $logger) {
53
-		$this->coordinator = $coordinator;
54
-		$this->container = $container;
55
-		$this->logger = $logger;
56
-	}
57
-
58
-	public function hasBackend(): bool {
59
-		if ($this->hasBackend !== null) {
60
-			return $this->hasBackend;
61
-		}
62
-
63
-		$context = $this->coordinator->getRegistrationContext();
64
-		if ($context === null) {
65
-			// Backend requested too soon, e.g. from the bootstrap `register` method of an app
66
-			throw new RuntimeException("Not all apps have been registered yet");
67
-		}
68
-		$backendRegistration = $context->getTalkBackendRegistration();
69
-		if ($backendRegistration === null) {
70
-			// Nothing to do. Remember and exit.
71
-			return $this->hasBackend = false;
72
-		}
73
-
74
-		try {
75
-			$this->backend = $this->container->get(
76
-				$backendRegistration->getService()
77
-			);
78
-
79
-			// Remember and return
80
-			return $this->hasBackend = true;
81
-		} catch (Throwable $e) {
82
-			$this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [
83
-				'class' => $backendRegistration->getService(),
84
-				'exception' => $e,
85
-			]);
86
-
87
-			// Temporary result. Maybe the next time the backend is requested it can be loaded.
88
-			return false;
89
-		}
90
-	}
91
-
92
-	public function newConversationOptions(): IConversationOptions {
93
-		return ConversationOptions::default();
94
-	}
95
-
96
-	public function createConversation(string $name,
97
-									   array $moderators,
98
-									   IConversationOptions $options = null): IConversation {
99
-		if (!$this->hasBackend()) {
100
-			throw new NoBackendException("The Talk broker has no registered backend");
101
-		}
102
-
103
-		return $this->backend->createConversation(
104
-			$name,
105
-			$moderators,
106
-			$options ?? ConversationOptions::default()
107
-		);
108
-	}
109
-
110
-	public function deleteConversation(string $id): void {
111
-		if (!$this->hasBackend()) {
112
-			throw new NoBackendException("The Talk broker has no registered backend");
113
-		}
114
-
115
-		$this->backend->deleteConversation($id);
116
-	}
40
+    private Coordinator $coordinator;
41
+
42
+    private IServerContainer $container;
43
+
44
+    private LoggerInterface $logger;
45
+
46
+    private ?bool $hasBackend = null;
47
+
48
+    private ?ITalkBackend $backend = null;
49
+
50
+    public function __construct(Coordinator $coordinator,
51
+                                IServerContainer $container,
52
+                                LoggerInterface $logger) {
53
+        $this->coordinator = $coordinator;
54
+        $this->container = $container;
55
+        $this->logger = $logger;
56
+    }
57
+
58
+    public function hasBackend(): bool {
59
+        if ($this->hasBackend !== null) {
60
+            return $this->hasBackend;
61
+        }
62
+
63
+        $context = $this->coordinator->getRegistrationContext();
64
+        if ($context === null) {
65
+            // Backend requested too soon, e.g. from the bootstrap `register` method of an app
66
+            throw new RuntimeException("Not all apps have been registered yet");
67
+        }
68
+        $backendRegistration = $context->getTalkBackendRegistration();
69
+        if ($backendRegistration === null) {
70
+            // Nothing to do. Remember and exit.
71
+            return $this->hasBackend = false;
72
+        }
73
+
74
+        try {
75
+            $this->backend = $this->container->get(
76
+                $backendRegistration->getService()
77
+            );
78
+
79
+            // Remember and return
80
+            return $this->hasBackend = true;
81
+        } catch (Throwable $e) {
82
+            $this->logger->error("Talk backend {class} could not be loaded: " . $e->getMessage(), [
83
+                'class' => $backendRegistration->getService(),
84
+                'exception' => $e,
85
+            ]);
86
+
87
+            // Temporary result. Maybe the next time the backend is requested it can be loaded.
88
+            return false;
89
+        }
90
+    }
91
+
92
+    public function newConversationOptions(): IConversationOptions {
93
+        return ConversationOptions::default();
94
+    }
95
+
96
+    public function createConversation(string $name,
97
+                                        array $moderators,
98
+                                        IConversationOptions $options = null): IConversation {
99
+        if (!$this->hasBackend()) {
100
+            throw new NoBackendException("The Talk broker has no registered backend");
101
+        }
102
+
103
+        return $this->backend->createConversation(
104
+            $name,
105
+            $moderators,
106
+            $options ?? ConversationOptions::default()
107
+        );
108
+    }
109
+
110
+    public function deleteConversation(string $id): void {
111
+        if (!$this->hasBackend()) {
112
+            throw new NoBackendException("The Talk broker has no registered backend");
113
+        }
114
+
115
+        $this->backend->deleteConversation($id);
116
+    }
117 117
 }
Please login to merge, or discard this patch.