Passed
Push — master ( 06eb23...0807e2 )
by Morris
17:38 queued 17s
created
lib/private/AppFramework/Bootstrap/Coordinator.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -42,143 +42,143 @@
 block discarded – undo
42 42
 
43 43
 class Coordinator {
44 44
 
45
-	/** @var IServerContainer */
46
-	private $serverContainer;
47
-
48
-	/** @var Registry */
49
-	private $registry;
50
-
51
-	/** @var IManager */
52
-	private $dashboardManager;
53
-
54
-	/** @var IEventDispatcher */
55
-	private $eventDispatcher;
56
-
57
-	/** @var ILogger */
58
-	private $logger;
59
-
60
-	/** @var RegistrationContext|null */
61
-	private $registrationContext;
62
-
63
-	/** @var string[] */
64
-	private $bootedApps = [];
65
-
66
-	public function __construct(IServerContainer $container,
67
-								Registry $registry,
68
-								IManager $dashboardManager,
69
-								IEventDispatcher $eventListener,
70
-								ILogger $logger) {
71
-		$this->serverContainer = $container;
72
-		$this->registry = $registry;
73
-		$this->dashboardManager = $dashboardManager;
74
-		$this->eventDispatcher = $eventListener;
75
-		$this->logger = $logger;
76
-	}
77
-
78
-	public function runRegistration(): void {
79
-		if ($this->registrationContext !== null) {
80
-			throw new RuntimeException('Registration has already been run');
81
-		}
82
-
83
-		$this->registrationContext = new RegistrationContext($this->logger);
84
-		$apps = [];
85
-		foreach (OC_App::getEnabledApps() as $appId) {
86
-			/*
45
+    /** @var IServerContainer */
46
+    private $serverContainer;
47
+
48
+    /** @var Registry */
49
+    private $registry;
50
+
51
+    /** @var IManager */
52
+    private $dashboardManager;
53
+
54
+    /** @var IEventDispatcher */
55
+    private $eventDispatcher;
56
+
57
+    /** @var ILogger */
58
+    private $logger;
59
+
60
+    /** @var RegistrationContext|null */
61
+    private $registrationContext;
62
+
63
+    /** @var string[] */
64
+    private $bootedApps = [];
65
+
66
+    public function __construct(IServerContainer $container,
67
+                                Registry $registry,
68
+                                IManager $dashboardManager,
69
+                                IEventDispatcher $eventListener,
70
+                                ILogger $logger) {
71
+        $this->serverContainer = $container;
72
+        $this->registry = $registry;
73
+        $this->dashboardManager = $dashboardManager;
74
+        $this->eventDispatcher = $eventListener;
75
+        $this->logger = $logger;
76
+    }
77
+
78
+    public function runRegistration(): void {
79
+        if ($this->registrationContext !== null) {
80
+            throw new RuntimeException('Registration has already been run');
81
+        }
82
+
83
+        $this->registrationContext = new RegistrationContext($this->logger);
84
+        $apps = [];
85
+        foreach (OC_App::getEnabledApps() as $appId) {
86
+            /*
87 87
 			 * First, we have to enable the app's autoloader
88 88
 			 *
89 89
 			 * @todo use $this->appManager->getAppPath($appId) here
90 90
 			 */
91
-			$path = OC_App::getAppPath($appId);
92
-			if ($path === false) {
93
-				// Ignore
94
-				continue;
95
-			}
96
-			OC_App::registerAutoloading($appId, $path);
97
-
98
-			/*
91
+            $path = OC_App::getAppPath($appId);
92
+            if ($path === false) {
93
+                // Ignore
94
+                continue;
95
+            }
96
+            OC_App::registerAutoloading($appId, $path);
97
+
98
+            /*
99 99
 			 * Next we check if there is an application class and it implements
100 100
 			 * the \OCP\AppFramework\Bootstrap\IBootstrap interface
101 101
 			 */
102
-			$appNameSpace = App::buildAppNamespace($appId);
103
-			$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
104
-			if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
105
-				try {
106
-					/** @var IBootstrap|App $application */
107
-					$apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
108
-				} catch (QueryException $e) {
109
-					// Weird, but ok
110
-					continue;
111
-				}
112
-				try {
113
-					$application->register($this->registrationContext->for($appId));
114
-				} catch (Throwable $e) {
115
-					$this->logger->logException($e, [
116
-						'message' => 'Error during app service registration: ' . $e->getMessage(),
117
-						'level' => ILogger::FATAL,
118
-					]);
119
-				}
120
-			}
121
-		}
122
-
123
-		/**
124
-		 * Now that all register methods have been called, we can delegate the registrations
125
-		 * to the actual services
126
-		 */
127
-		$this->registrationContext->delegateCapabilityRegistrations($apps);
128
-		$this->registrationContext->delegateCrashReporterRegistrations($apps, $this->registry);
129
-		$this->registrationContext->delegateDashboardPanelRegistrations($apps, $this->dashboardManager);
130
-		$this->registrationContext->delegateEventListenerRegistrations($this->eventDispatcher);
131
-		$this->registrationContext->delegateContainerRegistrations($apps);
132
-		$this->registrationContext->delegateMiddlewareRegistrations($apps);
133
-	}
134
-
135
-	public function getRegistrationContext(): ?RegistrationContext {
136
-		return $this->registrationContext;
137
-	}
138
-
139
-	public function bootApp(string $appId): void {
140
-		if (isset($this->bootedApps[$appId])) {
141
-			return;
142
-		}
143
-		$this->bootedApps[$appId] = true;
144
-
145
-		$appNameSpace = App::buildAppNamespace($appId);
146
-		$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
147
-		if (!class_exists($applicationClassName)) {
148
-			// Nothing to boot
149
-			return;
150
-		}
151
-
152
-		/*
102
+            $appNameSpace = App::buildAppNamespace($appId);
103
+            $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
104
+            if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
105
+                try {
106
+                    /** @var IBootstrap|App $application */
107
+                    $apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
108
+                } catch (QueryException $e) {
109
+                    // Weird, but ok
110
+                    continue;
111
+                }
112
+                try {
113
+                    $application->register($this->registrationContext->for($appId));
114
+                } catch (Throwable $e) {
115
+                    $this->logger->logException($e, [
116
+                        'message' => 'Error during app service registration: ' . $e->getMessage(),
117
+                        'level' => ILogger::FATAL,
118
+                    ]);
119
+                }
120
+            }
121
+        }
122
+
123
+        /**
124
+         * Now that all register methods have been called, we can delegate the registrations
125
+         * to the actual services
126
+         */
127
+        $this->registrationContext->delegateCapabilityRegistrations($apps);
128
+        $this->registrationContext->delegateCrashReporterRegistrations($apps, $this->registry);
129
+        $this->registrationContext->delegateDashboardPanelRegistrations($apps, $this->dashboardManager);
130
+        $this->registrationContext->delegateEventListenerRegistrations($this->eventDispatcher);
131
+        $this->registrationContext->delegateContainerRegistrations($apps);
132
+        $this->registrationContext->delegateMiddlewareRegistrations($apps);
133
+    }
134
+
135
+    public function getRegistrationContext(): ?RegistrationContext {
136
+        return $this->registrationContext;
137
+    }
138
+
139
+    public function bootApp(string $appId): void {
140
+        if (isset($this->bootedApps[$appId])) {
141
+            return;
142
+        }
143
+        $this->bootedApps[$appId] = true;
144
+
145
+        $appNameSpace = App::buildAppNamespace($appId);
146
+        $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
147
+        if (!class_exists($applicationClassName)) {
148
+            // Nothing to boot
149
+            return;
150
+        }
151
+
152
+        /*
153 153
 		 * Now it is time to fetch an instance of the App class. For classes
154 154
 		 * that implement \OCP\AppFramework\Bootstrap\IBootstrap this means
155 155
 		 * the instance was already created for register, but any other
156 156
 		 * (legacy) code will now do their magic via the constructor.
157 157
 		 */
158
-		try {
159
-			/** @var App $application */
160
-			$application = $this->serverContainer->query($applicationClassName);
161
-			if ($application instanceof IBootstrap) {
162
-				/** @var BootContext $context */
163
-				$context = new BootContext($application->getContainer());
164
-				$application->boot($context);
165
-			}
166
-		} catch (QueryException $e) {
167
-			$this->logger->logException($e, [
168
-				'message' => "Could not boot $appId" . $e->getMessage(),
169
-			]);
170
-		} catch (Throwable $e) {
171
-			$this->logger->logException($e, [
172
-				'message' => "Could not boot $appId" . $e->getMessage(),
173
-				'level' => ILogger::FATAL,
174
-			]);
175
-		}
176
-	}
177
-
178
-	public function isBootable(string $appId) {
179
-		$appNameSpace = App::buildAppNamespace($appId);
180
-		$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
181
-		return class_exists($applicationClassName) &&
182
-			in_array(IBootstrap::class, class_implements($applicationClassName), true);
183
-	}
158
+        try {
159
+            /** @var App $application */
160
+            $application = $this->serverContainer->query($applicationClassName);
161
+            if ($application instanceof IBootstrap) {
162
+                /** @var BootContext $context */
163
+                $context = new BootContext($application->getContainer());
164
+                $application->boot($context);
165
+            }
166
+        } catch (QueryException $e) {
167
+            $this->logger->logException($e, [
168
+                'message' => "Could not boot $appId" . $e->getMessage(),
169
+            ]);
170
+        } catch (Throwable $e) {
171
+            $this->logger->logException($e, [
172
+                'message' => "Could not boot $appId" . $e->getMessage(),
173
+                'level' => ILogger::FATAL,
174
+            ]);
175
+        }
176
+    }
177
+
178
+    public function isBootable(string $appId) {
179
+        $appNameSpace = App::buildAppNamespace($appId);
180
+        $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
181
+        return class_exists($applicationClassName) &&
182
+            in_array(IBootstrap::class, class_implements($applicationClassName), true);
183
+    }
184 184
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			 * the \OCP\AppFramework\Bootstrap\IBootstrap interface
101 101
 			 */
102 102
 			$appNameSpace = App::buildAppNamespace($appId);
103
-			$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
103
+			$applicationClassName = $appNameSpace.'\\AppInfo\\Application';
104 104
 			if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
105 105
 				try {
106 106
 					/** @var IBootstrap|App $application */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 					$application->register($this->registrationContext->for($appId));
114 114
 				} catch (Throwable $e) {
115 115
 					$this->logger->logException($e, [
116
-						'message' => 'Error during app service registration: ' . $e->getMessage(),
116
+						'message' => 'Error during app service registration: '.$e->getMessage(),
117 117
 						'level' => ILogger::FATAL,
118 118
 					]);
119 119
 				}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		$this->bootedApps[$appId] = true;
144 144
 
145 145
 		$appNameSpace = App::buildAppNamespace($appId);
146
-		$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
146
+		$applicationClassName = $appNameSpace.'\\AppInfo\\Application';
147 147
 		if (!class_exists($applicationClassName)) {
148 148
 			// Nothing to boot
149 149
 			return;
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 			}
166 166
 		} catch (QueryException $e) {
167 167
 			$this->logger->logException($e, [
168
-				'message' => "Could not boot $appId" . $e->getMessage(),
168
+				'message' => "Could not boot $appId".$e->getMessage(),
169 169
 			]);
170 170
 		} catch (Throwable $e) {
171 171
 			$this->logger->logException($e, [
172
-				'message' => "Could not boot $appId" . $e->getMessage(),
172
+				'message' => "Could not boot $appId".$e->getMessage(),
173 173
 				'level' => ILogger::FATAL,
174 174
 			]);
175 175
 		}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
 	public function isBootable(string $appId) {
179 179
 		$appNameSpace = App::buildAppNamespace($appId);
180
-		$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
180
+		$applicationClassName = $appNameSpace.'\\AppInfo\\Application';
181 181
 		return class_exists($applicationClassName) &&
182 182
 			in_array(IBootstrap::class, class_implements($applicationClassName), true);
183 183
 	}
Please login to merge, or discard this patch.