Passed
Push — master ( 43c829...615721 )
by Roeland
12:54 queued 33s
created
lib/private/Contacts/ContactsMenu/ActionProviderStore.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -36,76 +36,76 @@
 block discarded – undo
36 36
 
37 37
 class ActionProviderStore {
38 38
 
39
-	/** @var IServerContainer */
40
-	private $serverContainer;
41
-
42
-	/** @var AppManager */
43
-	private $appManager;
44
-
45
-	/** @var LoggerInterface */
46
-	private $logger;
47
-
48
-	public function __construct(IServerContainer $serverContainer, AppManager $appManager, LoggerInterface $logger) {
49
-		$this->serverContainer = $serverContainer;
50
-		$this->appManager = $appManager;
51
-		$this->logger = $logger;
52
-	}
53
-
54
-	/**
55
-	 * @param IUser $user
56
-	 * @return IProvider[]
57
-	 * @throws Exception
58
-	 */
59
-	public function getProviders(IUser $user): array {
60
-		$appClasses = $this->getAppProviderClasses($user);
61
-		$providerClasses = $this->getServerProviderClasses();
62
-		$allClasses = array_merge($providerClasses, $appClasses);
63
-		$providers = [];
64
-
65
-		foreach ($allClasses as $class) {
66
-			try {
67
-				$providers[] = $this->serverContainer->query($class);
68
-			} catch (QueryException $ex) {
69
-				$this->logger->error('Could not load contacts menu action provider ' . $class,
70
-					[
71
-						'app' => 'core',
72
-						'exception' => $ex,
73
-					]
74
-				);
75
-				throw new Exception('Could not load contacts menu action provider');
76
-			}
77
-		}
78
-
79
-		return $providers;
80
-	}
81
-
82
-	/**
83
-	 * @return string[]
84
-	 */
85
-	private function getServerProviderClasses(): array {
86
-		return [
87
-			EMailProvider::class,
88
-		];
89
-	}
90
-
91
-	/**
92
-	 * @param IUser $user
93
-	 * @return string[]
94
-	 */
95
-	private function getAppProviderClasses(IUser $user): array {
96
-		return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) {
97
-			$info = $this->appManager->getAppInfo($appId);
98
-
99
-			if (!isset($info['contactsmenu'])) {
100
-				// Nothing to add
101
-				return $all;
102
-			}
103
-
104
-			$providers = array_reduce($info['contactsmenu'], function ($all, $provider) {
105
-				return array_merge($all, [$provider]);
106
-			}, []);
107
-
108
-			return array_merge($all, $providers);
109
-		}, []);
110
-	}
39
+    /** @var IServerContainer */
40
+    private $serverContainer;
41
+
42
+    /** @var AppManager */
43
+    private $appManager;
44
+
45
+    /** @var LoggerInterface */
46
+    private $logger;
47
+
48
+    public function __construct(IServerContainer $serverContainer, AppManager $appManager, LoggerInterface $logger) {
49
+        $this->serverContainer = $serverContainer;
50
+        $this->appManager = $appManager;
51
+        $this->logger = $logger;
52
+    }
53
+
54
+    /**
55
+     * @param IUser $user
56
+     * @return IProvider[]
57
+     * @throws Exception
58
+     */
59
+    public function getProviders(IUser $user): array {
60
+        $appClasses = $this->getAppProviderClasses($user);
61
+        $providerClasses = $this->getServerProviderClasses();
62
+        $allClasses = array_merge($providerClasses, $appClasses);
63
+        $providers = [];
64
+
65
+        foreach ($allClasses as $class) {
66
+            try {
67
+                $providers[] = $this->serverContainer->query($class);
68
+            } catch (QueryException $ex) {
69
+                $this->logger->error('Could not load contacts menu action provider ' . $class,
70
+                    [
71
+                        'app' => 'core',
72
+                        'exception' => $ex,
73
+                    ]
74
+                );
75
+                throw new Exception('Could not load contacts menu action provider');
76
+            }
77
+        }
78
+
79
+        return $providers;
80
+    }
81
+
82
+    /**
83
+     * @return string[]
84
+     */
85
+    private function getServerProviderClasses(): array {
86
+        return [
87
+            EMailProvider::class,
88
+        ];
89
+    }
90
+
91
+    /**
92
+     * @param IUser $user
93
+     * @return string[]
94
+     */
95
+    private function getAppProviderClasses(IUser $user): array {
96
+        return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) {
97
+            $info = $this->appManager->getAppInfo($appId);
98
+
99
+            if (!isset($info['contactsmenu'])) {
100
+                // Nothing to add
101
+                return $all;
102
+            }
103
+
104
+            $providers = array_reduce($info['contactsmenu'], function ($all, $provider) {
105
+                return array_merge($all, [$provider]);
106
+            }, []);
107
+
108
+            return array_merge($all, $providers);
109
+        }, []);
110
+    }
111 111
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			try {
67 67
 				$providers[] = $this->serverContainer->query($class);
68 68
 			} catch (QueryException $ex) {
69
-				$this->logger->error('Could not load contacts menu action provider ' . $class,
69
+				$this->logger->error('Could not load contacts menu action provider '.$class,
70 70
 					[
71 71
 						'app' => 'core',
72 72
 						'exception' => $ex,
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return string[]
94 94
 	 */
95 95
 	private function getAppProviderClasses(IUser $user): array {
96
-		return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) {
96
+		return array_reduce($this->appManager->getEnabledAppsForUser($user), function($all, $appId) {
97 97
 			$info = $this->appManager->getAppInfo($appId);
98 98
 
99 99
 			if (!isset($info['contactsmenu'])) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 				return $all;
102 102
 			}
103 103
 
104
-			$providers = array_reduce($info['contactsmenu'], function ($all, $provider) {
104
+			$providers = array_reduce($info['contactsmenu'], function($all, $provider) {
105 105
 				return array_merge($all, [$provider]);
106 106
 			}, []);
107 107
 
Please login to merge, or discard this patch.