Passed
Push — master ( dd0b96...52dd1e )
by Roeland
11:37 queued 11s
created
lib/public/Support/CrashReport/IRegistry.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -36,50 +36,50 @@
 block discarded – undo
36 36
  */
37 37
 interface IRegistry {
38 38
 
39
-	/**
40
-	 * Register a reporter instance
41
-	 *
42
-	 * @param IReporter $reporter
43
-	 *
44
-	 * @since 13.0.0
45
-	 * @deprecated 20.0.0 use IRegistrationContext::registerCrashReporter
46
-	 * @see IRegistrationContext::registerCrashReporter()
47
-	 */
48
-	public function register(IReporter $reporter): void;
39
+    /**
40
+     * Register a reporter instance
41
+     *
42
+     * @param IReporter $reporter
43
+     *
44
+     * @since 13.0.0
45
+     * @deprecated 20.0.0 use IRegistrationContext::registerCrashReporter
46
+     * @see IRegistrationContext::registerCrashReporter()
47
+     */
48
+    public function register(IReporter $reporter): void;
49 49
 
50
-	/**
51
-	 * Delegate breadcrumb collection to all registered reporters
52
-	 *
53
-	 * @param string $message
54
-	 * @param string $category
55
-	 * @param array $context
56
-	 *
57
-	 * @deprecated used internally only
58
-	 * @since 15.0.0
59
-	 */
60
-	public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
50
+    /**
51
+     * Delegate breadcrumb collection to all registered reporters
52
+     *
53
+     * @param string $message
54
+     * @param string $category
55
+     * @param array $context
56
+     *
57
+     * @deprecated used internally only
58
+     * @since 15.0.0
59
+     */
60
+    public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
61 61
 
62
-	/**
63
-	 * Delegate crash reporting to all registered reporters
64
-	 *
65
-	 * @param Exception|Throwable $exception
66
-	 * @param array $context
67
-	 *
68
-	 * @deprecated used internally only
69
-	 * @since 13.0.0
70
-	 */
71
-	public function delegateReport($exception, array $context = []);
62
+    /**
63
+     * Delegate crash reporting to all registered reporters
64
+     *
65
+     * @param Exception|Throwable $exception
66
+     * @param array $context
67
+     *
68
+     * @deprecated used internally only
69
+     * @since 13.0.0
70
+     */
71
+    public function delegateReport($exception, array $context = []);
72 72
 
73
-	/**
74
-	 * Delegate a message to all reporters that implement IMessageReporter
75
-	 *
76
-	 * @param string $message
77
-	 * @param array $context
78
-	 *
79
-	 * @return void
80
-	 *
81
-	 * @deprecated used internally only
82
-	 * @since 17.0.0
83
-	 */
84
-	public function delegateMessage(string $message, array $context = []): void;
73
+    /**
74
+     * Delegate a message to all reporters that implement IMessageReporter
75
+     *
76
+     * @param string $message
77
+     * @param array $context
78
+     *
79
+     * @return void
80
+     *
81
+     * @deprecated used internally only
82
+     * @since 17.0.0
83
+     */
84
+    public function delegateMessage(string $message, array $context = []): void;
85 85
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Bootstrap/IRegistrationContext.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -37,82 +37,82 @@
 block discarded – undo
37 37
  */
38 38
 interface IRegistrationContext {
39 39
 
40
-	/**
41
-	 * @param string $capability
42
-	 * @see IAppContainer::registerCapability
43
-	 *
44
-	 * @since 20.0.0
45
-	 */
46
-	public function registerCapability(string $capability): void;
40
+    /**
41
+     * @param string $capability
42
+     * @see IAppContainer::registerCapability
43
+     *
44
+     * @since 20.0.0
45
+     */
46
+    public function registerCapability(string $capability): void;
47 47
 
48
-	/**
49
-	 * Register an implementation of \OCP\Support\CrashReport\IReporter that
50
-	 * will receive unhandled exceptions and throwables
51
-	 *
52
-	 * @param string $reporterClass
53
-	 * @return void
54
-	 * @since 20.0.0
55
-	 */
56
-	public function registerCrashReporter(string $reporterClass): void;
48
+    /**
49
+     * Register an implementation of \OCP\Support\CrashReport\IReporter that
50
+     * will receive unhandled exceptions and throwables
51
+     *
52
+     * @param string $reporterClass
53
+     * @return void
54
+     * @since 20.0.0
55
+     */
56
+    public function registerCrashReporter(string $reporterClass): void;
57 57
 
58
-	/**
59
-	 * Register a service
60
-	 *
61
-	 * @param string $name
62
-	 * @param callable $factory
63
-	 * @param bool $shared
64
-	 *
65
-	 * @return void
66
-	 * @see IContainer::registerService()
67
-	 *
68
-	 * @since 20.0.0
69
-	 */
70
-	public function registerService(string $name, callable $factory, bool $shared = true): void;
58
+    /**
59
+     * Register a service
60
+     *
61
+     * @param string $name
62
+     * @param callable $factory
63
+     * @param bool $shared
64
+     *
65
+     * @return void
66
+     * @see IContainer::registerService()
67
+     *
68
+     * @since 20.0.0
69
+     */
70
+    public function registerService(string $name, callable $factory, bool $shared = true): void;
71 71
 
72
-	/**
73
-	 * @param string $alias
74
-	 * @param string $target
75
-	 *
76
-	 * @return void
77
-	 * @see IContainer::registerAlias()
78
-	 *
79
-	 * @since 20.0.0
80
-	 */
81
-	public function registerServiceAlias(string $alias, string $target): void;
72
+    /**
73
+     * @param string $alias
74
+     * @param string $target
75
+     *
76
+     * @return void
77
+     * @see IContainer::registerAlias()
78
+     *
79
+     * @since 20.0.0
80
+     */
81
+    public function registerServiceAlias(string $alias, string $target): void;
82 82
 
83
-	/**
84
-	 * @param string $name
85
-	 * @param mixed $value
86
-	 *
87
-	 * @return void
88
-	 * @see IContainer::registerParameter()
89
-	 *
90
-	 * @since 20.0.0
91
-	 */
92
-	public function registerParameter(string $name, $value): void;
83
+    /**
84
+     * @param string $name
85
+     * @param mixed $value
86
+     *
87
+     * @return void
88
+     * @see IContainer::registerParameter()
89
+     *
90
+     * @since 20.0.0
91
+     */
92
+    public function registerParameter(string $name, $value): void;
93 93
 
94
-	/**
95
-	 * Register a service listener
96
-	 *
97
-	 * This is equivalent to calling IEventDispatcher::addServiceListener
98
-	 *
99
-	 * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
100
-	 * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
101
-	 * @param int $priority
102
-	 *
103
-	 * @see IEventDispatcher::addServiceListener()
104
-	 *
105
-	 * @since 20.0.0
106
-	 */
107
-	public function registerEventListener(string $event, string $listener, int $priority = 0): void;
94
+    /**
95
+     * Register a service listener
96
+     *
97
+     * This is equivalent to calling IEventDispatcher::addServiceListener
98
+     *
99
+     * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
100
+     * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
101
+     * @param int $priority
102
+     *
103
+     * @see IEventDispatcher::addServiceListener()
104
+     *
105
+     * @since 20.0.0
106
+     */
107
+    public function registerEventListener(string $event, string $listener, int $priority = 0): void;
108 108
 
109
-	/**
110
-	 * @param string $class
111
-	 *
112
-	 * @return void
113
-	 * @see IAppContainer::registerMiddleWare()
114
-	 *
115
-	 * @since 20.0.0
116
-	 */
117
-	public function registerMiddleware(string $class): void;
109
+    /**
110
+     * @param string $class
111
+     *
112
+     * @return void
113
+     * @see IAppContainer::registerMiddleWare()
114
+     *
115
+     * @since 20.0.0
116
+     */
117
+    public function registerMiddleware(string $class): void;
118 118
 }
Please login to merge, or discard this patch.
lib/private/Support/CrashReport/Registry.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -39,119 +39,119 @@
 block discarded – undo
39 39
 
40 40
 class Registry implements IRegistry {
41 41
 
42
-	/** @var string[] */
43
-	private $lazyReporters = [];
44
-
45
-	/** @var IReporter[] */
46
-	private $reporters = [];
47
-
48
-	/** @var IServerContainer */
49
-	private $serverContainer;
50
-
51
-	/** @var ILogger */
52
-	private $logger;
53
-
54
-	public function __construct(IServerContainer $serverContainer) {
55
-		$this->serverContainer = $serverContainer;
56
-	}
57
-
58
-	/**
59
-	 * Register a reporter instance
60
-	 *
61
-	 * @param IReporter $reporter
62
-	 */
63
-	public function register(IReporter $reporter): void {
64
-		$this->reporters[] = $reporter;
65
-	}
66
-
67
-	public function registerLazy(string $class): void {
68
-		$this->lazyReporters[] = $class;
69
-	}
70
-
71
-	/**
72
-	 * Delegate breadcrumb collection to all registered reporters
73
-	 *
74
-	 * @param string $message
75
-	 * @param string $category
76
-	 * @param array $context
77
-	 *
78
-	 * @since 15.0.0
79
-	 */
80
-	public function delegateBreadcrumb(string $message, string $category, array $context = []): void {
81
-		$this->loadLazyProviders();
82
-
83
-		foreach ($this->reporters as $reporter) {
84
-			if ($reporter instanceof ICollectBreadcrumbs) {
85
-				$reporter->collect($message, $category, $context);
86
-			}
87
-		}
88
-	}
89
-
90
-	/**
91
-	 * Delegate crash reporting to all registered reporters
92
-	 *
93
-	 * @param Exception|Throwable $exception
94
-	 * @param array $context
95
-	 */
96
-	public function delegateReport($exception, array $context = []): void {
97
-		$this->loadLazyProviders();
98
-
99
-		foreach ($this->reporters as $reporter) {
100
-			$reporter->report($exception, $context);
101
-		}
102
-	}
103
-
104
-	/**
105
-	 * Delegate a message to all reporters that implement IMessageReporter
106
-	 *
107
-	 * @param string $message
108
-	 * @param array $context
109
-	 *
110
-	 * @return void
111
-	 */
112
-	public function delegateMessage(string $message, array $context = []): void {
113
-		$this->loadLazyProviders();
114
-
115
-		foreach ($this->reporters as $reporter) {
116
-			if ($reporter instanceof IMessageReporter) {
117
-				$reporter->reportMessage($message, $context);
118
-			}
119
-		}
120
-	}
121
-
122
-	private function loadLazyProviders(): void {
123
-		$classes = $this->lazyReporters;
124
-		foreach ($classes as $class) {
125
-			try {
126
-				/** @var IReporter $reporter */
127
-				$reporter = $this->serverContainer->query($class);
128
-			} catch (QueryException $e) {
129
-				/*
42
+    /** @var string[] */
43
+    private $lazyReporters = [];
44
+
45
+    /** @var IReporter[] */
46
+    private $reporters = [];
47
+
48
+    /** @var IServerContainer */
49
+    private $serverContainer;
50
+
51
+    /** @var ILogger */
52
+    private $logger;
53
+
54
+    public function __construct(IServerContainer $serverContainer) {
55
+        $this->serverContainer = $serverContainer;
56
+    }
57
+
58
+    /**
59
+     * Register a reporter instance
60
+     *
61
+     * @param IReporter $reporter
62
+     */
63
+    public function register(IReporter $reporter): void {
64
+        $this->reporters[] = $reporter;
65
+    }
66
+
67
+    public function registerLazy(string $class): void {
68
+        $this->lazyReporters[] = $class;
69
+    }
70
+
71
+    /**
72
+     * Delegate breadcrumb collection to all registered reporters
73
+     *
74
+     * @param string $message
75
+     * @param string $category
76
+     * @param array $context
77
+     *
78
+     * @since 15.0.0
79
+     */
80
+    public function delegateBreadcrumb(string $message, string $category, array $context = []): void {
81
+        $this->loadLazyProviders();
82
+
83
+        foreach ($this->reporters as $reporter) {
84
+            if ($reporter instanceof ICollectBreadcrumbs) {
85
+                $reporter->collect($message, $category, $context);
86
+            }
87
+        }
88
+    }
89
+
90
+    /**
91
+     * Delegate crash reporting to all registered reporters
92
+     *
93
+     * @param Exception|Throwable $exception
94
+     * @param array $context
95
+     */
96
+    public function delegateReport($exception, array $context = []): void {
97
+        $this->loadLazyProviders();
98
+
99
+        foreach ($this->reporters as $reporter) {
100
+            $reporter->report($exception, $context);
101
+        }
102
+    }
103
+
104
+    /**
105
+     * Delegate a message to all reporters that implement IMessageReporter
106
+     *
107
+     * @param string $message
108
+     * @param array $context
109
+     *
110
+     * @return void
111
+     */
112
+    public function delegateMessage(string $message, array $context = []): void {
113
+        $this->loadLazyProviders();
114
+
115
+        foreach ($this->reporters as $reporter) {
116
+            if ($reporter instanceof IMessageReporter) {
117
+                $reporter->reportMessage($message, $context);
118
+            }
119
+        }
120
+    }
121
+
122
+    private function loadLazyProviders(): void {
123
+        $classes = $this->lazyReporters;
124
+        foreach ($classes as $class) {
125
+            try {
126
+                /** @var IReporter $reporter */
127
+                $reporter = $this->serverContainer->query($class);
128
+            } catch (QueryException $e) {
129
+                /*
130 130
 				 * There is a circular dependency between the logger and the registry, so
131 131
 				 * we can not inject it. Thus the static call.
132 132
 				 */
133
-				\OC::$server->getLogger()->logException($e, [
134
-					'message' => 'Could not load lazy crash reporter: ' . $e->getMessage(),
135
-					'level' => ILogger::FATAL,
136
-				]);
137
-			}
138
-			/**
139
-			 * Try to register the loaded reporter. Theoretically it could be of a wrong
140
-			 * type, so we might get a TypeError here that we should catch.
141
-			 */
142
-			try {
143
-				$this->register($reporter);
144
-			} catch (Throwable $e) {
145
-				/*
133
+                \OC::$server->getLogger()->logException($e, [
134
+                    'message' => 'Could not load lazy crash reporter: ' . $e->getMessage(),
135
+                    'level' => ILogger::FATAL,
136
+                ]);
137
+            }
138
+            /**
139
+             * Try to register the loaded reporter. Theoretically it could be of a wrong
140
+             * type, so we might get a TypeError here that we should catch.
141
+             */
142
+            try {
143
+                $this->register($reporter);
144
+            } catch (Throwable $e) {
145
+                /*
146 146
 				 * There is a circular dependency between the logger and the registry, so
147 147
 				 * we can not inject it. Thus the static call.
148 148
 				 */
149
-				\OC::$server->getLogger()->logException($e, [
150
-					'message' => 'Could not register lazy crash reporter: ' . $e->getMessage(),
151
-					'level' => ILogger::FATAL,
152
-				]);
153
-			}
154
-		}
155
-		$this->lazyReporters = [];
156
-	}
149
+                \OC::$server->getLogger()->logException($e, [
150
+                    'message' => 'Could not register lazy crash reporter: ' . $e->getMessage(),
151
+                    'level' => ILogger::FATAL,
152
+                ]);
153
+            }
154
+        }
155
+        $this->lazyReporters = [];
156
+    }
157 157
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				 * we can not inject it. Thus the static call.
132 132
 				 */
133 133
 				\OC::$server->getLogger()->logException($e, [
134
-					'message' => 'Could not load lazy crash reporter: ' . $e->getMessage(),
134
+					'message' => 'Could not load lazy crash reporter: '.$e->getMessage(),
135 135
 					'level' => ILogger::FATAL,
136 136
 				]);
137 137
 			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 				 * we can not inject it. Thus the static call.
148 148
 				 */
149 149
 				\OC::$server->getLogger()->logException($e, [
150
-					'message' => 'Could not register lazy crash reporter: ' . $e->getMessage(),
150
+					'message' => 'Could not register lazy crash reporter: '.$e->getMessage(),
151 151
 					'level' => ILogger::FATAL,
152 152
 				]);
153 153
 			}
Please login to merge, or discard this patch.
lib/private/AppFramework/Bootstrap/Coordinator.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -40,112 +40,112 @@
 block discarded – undo
40 40
 
41 41
 class Coordinator {
42 42
 
43
-	/** @var IServerContainer */
44
-	private $serverContainer;
43
+    /** @var IServerContainer */
44
+    private $serverContainer;
45 45
 
46
-	/** @var Registry */
47
-	private $registry;
46
+    /** @var Registry */
47
+    private $registry;
48 48
 
49
-	/** @var IEventDispatcher */
50
-	private $eventDispatcher;
49
+    /** @var IEventDispatcher */
50
+    private $eventDispatcher;
51 51
 
52
-	/** @var ILogger */
53
-	private $logger;
52
+    /** @var ILogger */
53
+    private $logger;
54 54
 
55
-	public function __construct(IServerContainer $container,
56
-								Registry $registry,
57
-								IEventDispatcher $eventListener,
58
-								ILogger $logger) {
59
-		$this->serverContainer = $container;
60
-		$this->registry = $registry;
61
-		$this->eventDispatcher = $eventListener;
62
-		$this->logger = $logger;
63
-	}
55
+    public function __construct(IServerContainer $container,
56
+                                Registry $registry,
57
+                                IEventDispatcher $eventListener,
58
+                                ILogger $logger) {
59
+        $this->serverContainer = $container;
60
+        $this->registry = $registry;
61
+        $this->eventDispatcher = $eventListener;
62
+        $this->logger = $logger;
63
+    }
64 64
 
65
-	public function runRegistration(): void {
66
-		$context = new RegistrationContext($this->logger);
67
-		$apps = [];
68
-		foreach (OC_App::getEnabledApps() as $appId) {
69
-			/*
65
+    public function runRegistration(): void {
66
+        $context = new RegistrationContext($this->logger);
67
+        $apps = [];
68
+        foreach (OC_App::getEnabledApps() as $appId) {
69
+            /*
70 70
 			 * First, we have to enable the app's autoloader
71 71
 			 *
72 72
 			 * @todo use $this->appManager->getAppPath($appId) here
73 73
 			 */
74
-			$path = OC_App::getAppPath($appId);
75
-			if ($path === false) {
76
-				// Ignore
77
-				continue;
78
-			}
79
-			OC_App::registerAutoloading($appId, $path);
74
+            $path = OC_App::getAppPath($appId);
75
+            if ($path === false) {
76
+                // Ignore
77
+                continue;
78
+            }
79
+            OC_App::registerAutoloading($appId, $path);
80 80
 
81
-			/*
81
+            /*
82 82
 			 * Next we check if there is an application class and it implements
83 83
 			 * the \OCP\AppFramework\Bootstrap\IBootstrap interface
84 84
 			 */
85
-			$appNameSpace = App::buildAppNamespace($appId);
86
-			$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
87
-			if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
88
-				try {
89
-					/** @var IBootstrap|App $application */
90
-					$apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
91
-				} catch (QueryException $e) {
92
-					// Weird, but ok
93
-					continue;
94
-				}
95
-				try {
96
-					$application->register($context->for($appId));
97
-				} catch (Throwable $e) {
98
-					$this->logger->logException($e, [
99
-						'message' => 'Error during app service registration: ' . $e->getMessage(),
100
-						'level' => ILogger::FATAL,
101
-					]);
102
-				}
103
-			}
104
-		}
85
+            $appNameSpace = App::buildAppNamespace($appId);
86
+            $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
87
+            if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) {
88
+                try {
89
+                    /** @var IBootstrap|App $application */
90
+                    $apps[$appId] = $application = $this->serverContainer->query($applicationClassName);
91
+                } catch (QueryException $e) {
92
+                    // Weird, but ok
93
+                    continue;
94
+                }
95
+                try {
96
+                    $application->register($context->for($appId));
97
+                } catch (Throwable $e) {
98
+                    $this->logger->logException($e, [
99
+                        'message' => 'Error during app service registration: ' . $e->getMessage(),
100
+                        'level' => ILogger::FATAL,
101
+                    ]);
102
+                }
103
+            }
104
+        }
105 105
 
106
-		/**
107
-		 * Now that all register methods have been called, we can delegate the registrations
108
-		 * to the actual services
109
-		 */
110
-		$context->delegateCapabilityRegistrations($apps);
111
-		$context->delegateCrashReporterRegistrations($apps, $this->registry);
112
-		$context->delegateEventListenerRegistrations($this->eventDispatcher);
113
-		$context->delegateContainerRegistrations($apps);
114
-		$context->delegateMiddlewareRegistrations($apps);
115
-	}
106
+        /**
107
+         * Now that all register methods have been called, we can delegate the registrations
108
+         * to the actual services
109
+         */
110
+        $context->delegateCapabilityRegistrations($apps);
111
+        $context->delegateCrashReporterRegistrations($apps, $this->registry);
112
+        $context->delegateEventListenerRegistrations($this->eventDispatcher);
113
+        $context->delegateContainerRegistrations($apps);
114
+        $context->delegateMiddlewareRegistrations($apps);
115
+    }
116 116
 
117
-	public function bootApp(string $appId): void {
118
-		$appNameSpace = App::buildAppNamespace($appId);
119
-		$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
120
-		if (!class_exists($applicationClassName)) {
121
-			// Nothing to boot
122
-			return;
123
-		}
117
+    public function bootApp(string $appId): void {
118
+        $appNameSpace = App::buildAppNamespace($appId);
119
+        $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
120
+        if (!class_exists($applicationClassName)) {
121
+            // Nothing to boot
122
+            return;
123
+        }
124 124
 
125
-		/*
125
+        /*
126 126
 		 * Now it is time to fetch an instance of the App class. For classes
127 127
 		 * that implement \OCP\AppFramework\Bootstrap\IBootstrap this means
128 128
 		 * the instance was already created for register, but any other
129 129
 		 * (legacy) code will now do their magic via the constructor.
130 130
 		 */
131
-		try {
132
-			/** @var App $application */
133
-			$application = $this->serverContainer->query($applicationClassName);
134
-			if ($application instanceof IBootstrap) {
135
-				/** @var BootContext $context */
136
-				$context = new BootContext($application->getContainer());
137
-				$application->boot($context);
138
-			}
139
-		} catch (QueryException $e) {
140
-			$this->logger->logException($e, [
141
-				'message' => "Could not boot $appId" . $e->getMessage(),
142
-			]);
143
-			return;
144
-		} catch (Throwable $e) {
145
-			$this->logger->logException($e, [
146
-				'message' => "Could not boot $appId" . $e->getMessage(),
147
-				'level' => ILogger::FATAL,
148
-			]);
149
-		}
150
-	}
131
+        try {
132
+            /** @var App $application */
133
+            $application = $this->serverContainer->query($applicationClassName);
134
+            if ($application instanceof IBootstrap) {
135
+                /** @var BootContext $context */
136
+                $context = new BootContext($application->getContainer());
137
+                $application->boot($context);
138
+            }
139
+        } catch (QueryException $e) {
140
+            $this->logger->logException($e, [
141
+                'message' => "Could not boot $appId" . $e->getMessage(),
142
+            ]);
143
+            return;
144
+        } catch (Throwable $e) {
145
+            $this->logger->logException($e, [
146
+                'message' => "Could not boot $appId" . $e->getMessage(),
147
+                'level' => ILogger::FATAL,
148
+            ]);
149
+        }
150
+    }
151 151
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Bootstrap/RegistrationContext.php 2 patches
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -35,296 +35,296 @@
 block discarded – undo
35 35
 
36 36
 class RegistrationContext {
37 37
 
38
-	/** @var array[] */
39
-	private $capabilities = [];
40
-
41
-	/** @var array[] */
42
-	private $crashReporters = [];
43
-
44
-	/** @var array[] */
45
-	private $services = [];
46
-
47
-	/** @var array[] */
48
-	private $aliases = [];
49
-
50
-	/** @var array[] */
51
-	private $parameters = [];
52
-
53
-	/** @var array[] */
54
-	private $eventListeners = [];
55
-
56
-	/** @var array[] */
57
-	private $middlewares = [];
58
-
59
-	/** @var ILogger */
60
-	private $logger;
61
-
62
-	public function __construct(ILogger $logger) {
63
-		$this->logger = $logger;
64
-	}
65
-
66
-	public function for(string $appId): IRegistrationContext {
67
-		return new class($appId, $this) implements IRegistrationContext {
68
-			/** @var string */
69
-			private $appId;
70
-
71
-			/** @var RegistrationContext */
72
-			private $context;
73
-
74
-			public function __construct(string $appId, RegistrationContext $context) {
75
-				$this->appId = $appId;
76
-				$this->context = $context;
77
-			}
78
-
79
-			public function registerCapability(string $capability): void {
80
-				$this->context->registerCapability(
81
-					$this->appId,
82
-					$capability
83
-				);
84
-			}
85
-
86
-			public function registerCrashReporter(string $reporterClass): void {
87
-				$this->context->registerCrashReporter(
88
-					$this->appId,
89
-					$reporterClass
90
-				);
91
-			}
92
-
93
-			public function registerService(string $name, callable $factory, bool $shared = true): void {
94
-				$this->context->registerService(
95
-					$this->appId,
96
-					$name,
97
-					$factory,
98
-					$shared
99
-				);
100
-			}
101
-
102
-			public function registerServiceAlias(string $alias, string $target): void {
103
-				$this->context->registerServiceAlias(
104
-					$this->appId,
105
-					$alias,
106
-					$target
107
-				);
108
-			}
109
-
110
-			public function registerParameter(string $name, $value): void {
111
-				$this->context->registerParameter(
112
-					$this->appId,
113
-					$name,
114
-					$value
115
-				);
116
-			}
117
-
118
-			public function registerEventListener(string $event, string $listener, int $priority = 0): void {
119
-				$this->context->registerEventListener(
120
-					$this->appId,
121
-					$event,
122
-					$listener,
123
-					$priority
124
-				);
125
-			}
126
-
127
-			public function registerMiddleware(string $class): void {
128
-				$this->context->registerMiddleware(
129
-					$this->appId,
130
-					$class
131
-				);
132
-			}
133
-		};
134
-	}
135
-
136
-	public function registerCapability(string $appId, string $capability): void {
137
-		$this->capabilities[] = [
138
-			'appId' => $appId,
139
-			'capability' => $capability
140
-		];
141
-	}
142
-
143
-	public function registerCrashReporter(string $appId, string $reporterClass): void {
144
-		$this->crashReporters[] = [
145
-			'appId' => $appId,
146
-			'class' => $reporterClass,
147
-		];
148
-	}
149
-
150
-	public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
151
-		$this->services[] = [
152
-			"appId" => $appId,
153
-			"name" => $name,
154
-			"factory" => $factory,
155
-			"sharred" => $shared,
156
-		];
157
-	}
158
-
159
-	public function registerServiceAlias(string $appId, string $alias, string $target): void {
160
-		$this->aliases[] = [
161
-			"appId" => $appId,
162
-			"alias" => $alias,
163
-			"target" => $target,
164
-		];
165
-	}
166
-
167
-	public function registerParameter(string $appId, string $name, $value): void {
168
-		$this->parameters[] = [
169
-			"appId" => $appId,
170
-			"name" => $name,
171
-			"value" => $value,
172
-		];
173
-	}
174
-
175
-	public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void {
176
-		$this->eventListeners[] = [
177
-			"appId" => $appId,
178
-			"event" => $event,
179
-			"listener" => $listener,
180
-			"priority" => $priority,
181
-		];
182
-	}
183
-
184
-	public function registerMiddleware(string $appId, string $class): void {
185
-		$this->middlewares[] = [
186
-			"appId" => $appId,
187
-			"class" => $class,
188
-		];
189
-	}
190
-
191
-	/**
192
-	 * @param App[] $apps
193
-	 */
194
-	public function delegateCapabilityRegistrations(array $apps): void {
195
-		foreach ($this->capabilities as $registration) {
196
-			try {
197
-				$apps[$registration['appId']]
198
-					->getContainer()
199
-					->registerCapability($registration['capability']);
200
-			} catch (Throwable $e) {
201
-				$appId = $registration['appId'];
202
-				$this->logger->logException($e, [
203
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
204
-					'level' => ILogger::ERROR,
205
-				]);
206
-			}
207
-		}
208
-	}
209
-
210
-	/**
211
-	 * @param App[] $apps
212
-	 */
213
-	public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
214
-		foreach ($this->crashReporters as $registration) {
215
-			try {
216
-				$registry->registerLazy($registration['class']);
217
-			} catch (Throwable $e) {
218
-				$appId = $registration['appId'];
219
-				$this->logger->logException($e, [
220
-					'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
221
-					'level' => ILogger::ERROR,
222
-				]);
223
-			}
224
-		}
225
-	}
226
-
227
-	public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
228
-		foreach ($this->eventListeners as $registration) {
229
-			try {
230
-				if (isset($registration['priority'])) {
231
-					$eventDispatcher->addServiceListener(
232
-						$registration['event'],
233
-						$registration['listener'],
234
-						$registration['priority']
235
-					);
236
-				} else {
237
-					$eventDispatcher->addListener(
238
-						$registration['event'],
239
-						$registration['listener']
240
-					);
241
-				}
242
-			} catch (Throwable $e) {
243
-				$appId = $registration['appId'];
244
-				$this->logger->logException($e, [
245
-					'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
246
-					'level' => ILogger::ERROR,
247
-				]);
248
-			}
249
-		}
250
-	}
251
-
252
-	/**
253
-	 * @param App[] $apps
254
-	 */
255
-	public function delegateContainerRegistrations(array $apps): void {
256
-		foreach ($this->services as $registration) {
257
-			try {
258
-				/**
259
-				 * Register the service and convert the callable into a \Closure if necessary
260
-				 */
261
-				$apps[$registration['appId']]
262
-					->getContainer()
263
-					->registerService(
264
-						$registration['name'],
265
-						Closure::fromCallable($registration['factory']),
266
-						$registration['shared'] ?? true
267
-					);
268
-			} catch (Throwable $e) {
269
-				$appId = $registration['appId'];
270
-				$this->logger->logException($e, [
271
-					'message' => "Error during service registration of $appId: " . $e->getMessage(),
272
-					'level' => ILogger::ERROR,
273
-				]);
274
-			}
275
-		}
276
-
277
-		foreach ($this->aliases as $registration) {
278
-			try {
279
-				$apps[$registration['appId']]
280
-					->getContainer()
281
-					->registerAlias(
282
-						$registration['alias'],
283
-						$registration['target']
284
-					);
285
-			} catch (Throwable $e) {
286
-				$appId = $registration['appId'];
287
-				$this->logger->logException($e, [
288
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
289
-					'level' => ILogger::ERROR,
290
-				]);
291
-			}
292
-		}
293
-
294
-		foreach ($this->parameters as $registration) {
295
-			try {
296
-				$apps[$registration['appId']]
297
-					->getContainer()
298
-					->registerParameter(
299
-						$registration['name'],
300
-						$registration['value']
301
-					);
302
-			} catch (Throwable $e) {
303
-				$appId = $registration['appId'];
304
-				$this->logger->logException($e, [
305
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
306
-					'level' => ILogger::ERROR,
307
-				]);
308
-			}
309
-		}
310
-	}
311
-
312
-	/**
313
-	 * @param App[] $apps
314
-	 */
315
-	public function delegateMiddlewareRegistrations(array $apps): void {
316
-		foreach ($this->middlewares as $middleware) {
317
-			try {
318
-				$apps[$middleware['appId']]
319
-					->getContainer()
320
-					->registerMiddleWare($middleware['class']);
321
-			} catch (Throwable $e) {
322
-				$appId = $middleware['appId'];
323
-				$this->logger->logException($e, [
324
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
325
-					'level' => ILogger::ERROR,
326
-				]);
327
-			}
328
-		}
329
-	}
38
+    /** @var array[] */
39
+    private $capabilities = [];
40
+
41
+    /** @var array[] */
42
+    private $crashReporters = [];
43
+
44
+    /** @var array[] */
45
+    private $services = [];
46
+
47
+    /** @var array[] */
48
+    private $aliases = [];
49
+
50
+    /** @var array[] */
51
+    private $parameters = [];
52
+
53
+    /** @var array[] */
54
+    private $eventListeners = [];
55
+
56
+    /** @var array[] */
57
+    private $middlewares = [];
58
+
59
+    /** @var ILogger */
60
+    private $logger;
61
+
62
+    public function __construct(ILogger $logger) {
63
+        $this->logger = $logger;
64
+    }
65
+
66
+    public function for(string $appId): IRegistrationContext {
67
+        return new class($appId, $this) implements IRegistrationContext {
68
+            /** @var string */
69
+            private $appId;
70
+
71
+            /** @var RegistrationContext */
72
+            private $context;
73
+
74
+            public function __construct(string $appId, RegistrationContext $context) {
75
+                $this->appId = $appId;
76
+                $this->context = $context;
77
+            }
78
+
79
+            public function registerCapability(string $capability): void {
80
+                $this->context->registerCapability(
81
+                    $this->appId,
82
+                    $capability
83
+                );
84
+            }
85
+
86
+            public function registerCrashReporter(string $reporterClass): void {
87
+                $this->context->registerCrashReporter(
88
+                    $this->appId,
89
+                    $reporterClass
90
+                );
91
+            }
92
+
93
+            public function registerService(string $name, callable $factory, bool $shared = true): void {
94
+                $this->context->registerService(
95
+                    $this->appId,
96
+                    $name,
97
+                    $factory,
98
+                    $shared
99
+                );
100
+            }
101
+
102
+            public function registerServiceAlias(string $alias, string $target): void {
103
+                $this->context->registerServiceAlias(
104
+                    $this->appId,
105
+                    $alias,
106
+                    $target
107
+                );
108
+            }
109
+
110
+            public function registerParameter(string $name, $value): void {
111
+                $this->context->registerParameter(
112
+                    $this->appId,
113
+                    $name,
114
+                    $value
115
+                );
116
+            }
117
+
118
+            public function registerEventListener(string $event, string $listener, int $priority = 0): void {
119
+                $this->context->registerEventListener(
120
+                    $this->appId,
121
+                    $event,
122
+                    $listener,
123
+                    $priority
124
+                );
125
+            }
126
+
127
+            public function registerMiddleware(string $class): void {
128
+                $this->context->registerMiddleware(
129
+                    $this->appId,
130
+                    $class
131
+                );
132
+            }
133
+        };
134
+    }
135
+
136
+    public function registerCapability(string $appId, string $capability): void {
137
+        $this->capabilities[] = [
138
+            'appId' => $appId,
139
+            'capability' => $capability
140
+        ];
141
+    }
142
+
143
+    public function registerCrashReporter(string $appId, string $reporterClass): void {
144
+        $this->crashReporters[] = [
145
+            'appId' => $appId,
146
+            'class' => $reporterClass,
147
+        ];
148
+    }
149
+
150
+    public function registerService(string $appId, string $name, callable $factory, bool $shared = true): void {
151
+        $this->services[] = [
152
+            "appId" => $appId,
153
+            "name" => $name,
154
+            "factory" => $factory,
155
+            "sharred" => $shared,
156
+        ];
157
+    }
158
+
159
+    public function registerServiceAlias(string $appId, string $alias, string $target): void {
160
+        $this->aliases[] = [
161
+            "appId" => $appId,
162
+            "alias" => $alias,
163
+            "target" => $target,
164
+        ];
165
+    }
166
+
167
+    public function registerParameter(string $appId, string $name, $value): void {
168
+        $this->parameters[] = [
169
+            "appId" => $appId,
170
+            "name" => $name,
171
+            "value" => $value,
172
+        ];
173
+    }
174
+
175
+    public function registerEventListener(string $appId, string $event, string $listener, int $priority = 0): void {
176
+        $this->eventListeners[] = [
177
+            "appId" => $appId,
178
+            "event" => $event,
179
+            "listener" => $listener,
180
+            "priority" => $priority,
181
+        ];
182
+    }
183
+
184
+    public function registerMiddleware(string $appId, string $class): void {
185
+        $this->middlewares[] = [
186
+            "appId" => $appId,
187
+            "class" => $class,
188
+        ];
189
+    }
190
+
191
+    /**
192
+     * @param App[] $apps
193
+     */
194
+    public function delegateCapabilityRegistrations(array $apps): void {
195
+        foreach ($this->capabilities as $registration) {
196
+            try {
197
+                $apps[$registration['appId']]
198
+                    ->getContainer()
199
+                    ->registerCapability($registration['capability']);
200
+            } catch (Throwable $e) {
201
+                $appId = $registration['appId'];
202
+                $this->logger->logException($e, [
203
+                    'message' => "Error during capability registration of $appId: " . $e->getMessage(),
204
+                    'level' => ILogger::ERROR,
205
+                ]);
206
+            }
207
+        }
208
+    }
209
+
210
+    /**
211
+     * @param App[] $apps
212
+     */
213
+    public function delegateCrashReporterRegistrations(array $apps, Registry $registry): void {
214
+        foreach ($this->crashReporters as $registration) {
215
+            try {
216
+                $registry->registerLazy($registration['class']);
217
+            } catch (Throwable $e) {
218
+                $appId = $registration['appId'];
219
+                $this->logger->logException($e, [
220
+                    'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
221
+                    'level' => ILogger::ERROR,
222
+                ]);
223
+            }
224
+        }
225
+    }
226
+
227
+    public function delegateEventListenerRegistrations(IEventDispatcher $eventDispatcher): void {
228
+        foreach ($this->eventListeners as $registration) {
229
+            try {
230
+                if (isset($registration['priority'])) {
231
+                    $eventDispatcher->addServiceListener(
232
+                        $registration['event'],
233
+                        $registration['listener'],
234
+                        $registration['priority']
235
+                    );
236
+                } else {
237
+                    $eventDispatcher->addListener(
238
+                        $registration['event'],
239
+                        $registration['listener']
240
+                    );
241
+                }
242
+            } catch (Throwable $e) {
243
+                $appId = $registration['appId'];
244
+                $this->logger->logException($e, [
245
+                    'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
246
+                    'level' => ILogger::ERROR,
247
+                ]);
248
+            }
249
+        }
250
+    }
251
+
252
+    /**
253
+     * @param App[] $apps
254
+     */
255
+    public function delegateContainerRegistrations(array $apps): void {
256
+        foreach ($this->services as $registration) {
257
+            try {
258
+                /**
259
+                 * Register the service and convert the callable into a \Closure if necessary
260
+                 */
261
+                $apps[$registration['appId']]
262
+                    ->getContainer()
263
+                    ->registerService(
264
+                        $registration['name'],
265
+                        Closure::fromCallable($registration['factory']),
266
+                        $registration['shared'] ?? true
267
+                    );
268
+            } catch (Throwable $e) {
269
+                $appId = $registration['appId'];
270
+                $this->logger->logException($e, [
271
+                    'message' => "Error during service registration of $appId: " . $e->getMessage(),
272
+                    'level' => ILogger::ERROR,
273
+                ]);
274
+            }
275
+        }
276
+
277
+        foreach ($this->aliases as $registration) {
278
+            try {
279
+                $apps[$registration['appId']]
280
+                    ->getContainer()
281
+                    ->registerAlias(
282
+                        $registration['alias'],
283
+                        $registration['target']
284
+                    );
285
+            } catch (Throwable $e) {
286
+                $appId = $registration['appId'];
287
+                $this->logger->logException($e, [
288
+                    'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
289
+                    'level' => ILogger::ERROR,
290
+                ]);
291
+            }
292
+        }
293
+
294
+        foreach ($this->parameters as $registration) {
295
+            try {
296
+                $apps[$registration['appId']]
297
+                    ->getContainer()
298
+                    ->registerParameter(
299
+                        $registration['name'],
300
+                        $registration['value']
301
+                    );
302
+            } catch (Throwable $e) {
303
+                $appId = $registration['appId'];
304
+                $this->logger->logException($e, [
305
+                    'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
306
+                    'level' => ILogger::ERROR,
307
+                ]);
308
+            }
309
+        }
310
+    }
311
+
312
+    /**
313
+     * @param App[] $apps
314
+     */
315
+    public function delegateMiddlewareRegistrations(array $apps): void {
316
+        foreach ($this->middlewares as $middleware) {
317
+            try {
318
+                $apps[$middleware['appId']]
319
+                    ->getContainer()
320
+                    ->registerMiddleWare($middleware['class']);
321
+            } catch (Throwable $e) {
322
+                $appId = $middleware['appId'];
323
+                $this->logger->logException($e, [
324
+                    'message' => "Error during capability registration of $appId: " . $e->getMessage(),
325
+                    'level' => ILogger::ERROR,
326
+                ]);
327
+            }
328
+        }
329
+    }
330 330
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		$this->logger = $logger;
64 64
 	}
65 65
 
66
-	public function for(string $appId): IRegistrationContext {
66
+	public function for (string $appId): IRegistrationContext {
67 67
 		return new class($appId, $this) implements IRegistrationContext {
68 68
 			/** @var string */
69 69
 			private $appId;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			} catch (Throwable $e) {
201 201
 				$appId = $registration['appId'];
202 202
 				$this->logger->logException($e, [
203
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
203
+					'message' => "Error during capability registration of $appId: ".$e->getMessage(),
204 204
 					'level' => ILogger::ERROR,
205 205
 				]);
206 206
 			}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			} catch (Throwable $e) {
218 218
 				$appId = $registration['appId'];
219 219
 				$this->logger->logException($e, [
220
-					'message' => "Error during crash reporter registration of $appId: " . $e->getMessage(),
220
+					'message' => "Error during crash reporter registration of $appId: ".$e->getMessage(),
221 221
 					'level' => ILogger::ERROR,
222 222
 				]);
223 223
 			}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 			} catch (Throwable $e) {
243 243
 				$appId = $registration['appId'];
244 244
 				$this->logger->logException($e, [
245
-					'message' => "Error during event listener registration of $appId: " . $e->getMessage(),
245
+					'message' => "Error during event listener registration of $appId: ".$e->getMessage(),
246 246
 					'level' => ILogger::ERROR,
247 247
 				]);
248 248
 			}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			} catch (Throwable $e) {
269 269
 				$appId = $registration['appId'];
270 270
 				$this->logger->logException($e, [
271
-					'message' => "Error during service registration of $appId: " . $e->getMessage(),
271
+					'message' => "Error during service registration of $appId: ".$e->getMessage(),
272 272
 					'level' => ILogger::ERROR,
273 273
 				]);
274 274
 			}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			} catch (Throwable $e) {
286 286
 				$appId = $registration['appId'];
287 287
 				$this->logger->logException($e, [
288
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
288
+					'message' => "Error during service alias registration of $appId: ".$e->getMessage(),
289 289
 					'level' => ILogger::ERROR,
290 290
 				]);
291 291
 			}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			} catch (Throwable $e) {
303 303
 				$appId = $registration['appId'];
304 304
 				$this->logger->logException($e, [
305
-					'message' => "Error during service alias registration of $appId: " . $e->getMessage(),
305
+					'message' => "Error during service alias registration of $appId: ".$e->getMessage(),
306 306
 					'level' => ILogger::ERROR,
307 307
 				]);
308 308
 			}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			} catch (Throwable $e) {
322 322
 				$appId = $middleware['appId'];
323 323
 				$this->logger->logException($e, [
324
-					'message' => "Error during capability registration of $appId: " . $e->getMessage(),
324
+					'message' => "Error during capability registration of $appId: ".$e->getMessage(),
325 325
 					'level' => ILogger::ERROR,
326 326
 				]);
327 327
 			}
Please login to merge, or discard this patch.