Passed
Push — master ( 816200...411754 )
by Joas
21:43 queued 12s
created
lib/private/Contacts/ContactsMenu/Providers/LocalTimeProvider.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -37,51 +37,51 @@
 block discarded – undo
37 37
 use OCP\L10N\IFactory as IL10NFactory;
38 38
 
39 39
 class LocalTimeProvider implements IProvider {
40
-	private IActionFactory $actionFactory;
41
-	private IL10NFactory $l10nFactory;
42
-	private IURLGenerator $urlGenerator;
43
-	private IUserManager $userManager;
44
-	private ITimeFactory $timeFactory;
45
-	private IDateTimeFormatter $dateTimeFormatter;
46
-	private IConfig $config;
40
+    private IActionFactory $actionFactory;
41
+    private IL10NFactory $l10nFactory;
42
+    private IURLGenerator $urlGenerator;
43
+    private IUserManager $userManager;
44
+    private ITimeFactory $timeFactory;
45
+    private IDateTimeFormatter $dateTimeFormatter;
46
+    private IConfig $config;
47 47
 
48
-	public function __construct(
49
-		IActionFactory $actionFactory,
50
-		IL10NFactory $l10nFactory,
51
-		IURLGenerator $urlGenerator,
52
-		IUserManager $userManager,
53
-		ITimeFactory $timeFactory,
54
-		IDateTimeFormatter $dateTimeFormatter,
55
-		IConfig $config
56
-	) {
57
-		$this->actionFactory = $actionFactory;
58
-		$this->l10nFactory = $l10nFactory;
59
-		$this->urlGenerator = $urlGenerator;
60
-		$this->userManager = $userManager;
61
-		$this->timeFactory = $timeFactory;
62
-		$this->dateTimeFormatter = $dateTimeFormatter;
63
-		$this->config = $config;
64
-	}
48
+    public function __construct(
49
+        IActionFactory $actionFactory,
50
+        IL10NFactory $l10nFactory,
51
+        IURLGenerator $urlGenerator,
52
+        IUserManager $userManager,
53
+        ITimeFactory $timeFactory,
54
+        IDateTimeFormatter $dateTimeFormatter,
55
+        IConfig $config
56
+    ) {
57
+        $this->actionFactory = $actionFactory;
58
+        $this->l10nFactory = $l10nFactory;
59
+        $this->urlGenerator = $urlGenerator;
60
+        $this->userManager = $userManager;
61
+        $this->timeFactory = $timeFactory;
62
+        $this->dateTimeFormatter = $dateTimeFormatter;
63
+        $this->config = $config;
64
+    }
65 65
 
66
-	/**
67
-	 * @param IEntry $entry
68
-	 */
69
-	public function process(IEntry $entry) {
70
-		$targetUserId = $entry->getProperty('UID');
71
-		$targetUser = $this->userManager->get($targetUserId);
72
-		if (!empty($targetUser)) {
73
-			$timezone = $this->config->getUserValue($targetUser->getUID(), 'core', 'timezone') ?: date_default_timezone_get();
74
-			$dateTimeZone = new \DateTimeZone($timezone);
75
-			$localTime = $this->dateTimeFormatter->formatTime($this->timeFactory->getDateTime(), 'short', $dateTimeZone);
66
+    /**
67
+     * @param IEntry $entry
68
+     */
69
+    public function process(IEntry $entry) {
70
+        $targetUserId = $entry->getProperty('UID');
71
+        $targetUser = $this->userManager->get($targetUserId);
72
+        if (!empty($targetUser)) {
73
+            $timezone = $this->config->getUserValue($targetUser->getUID(), 'core', 'timezone') ?: date_default_timezone_get();
74
+            $dateTimeZone = new \DateTimeZone($timezone);
75
+            $localTime = $this->dateTimeFormatter->formatTime($this->timeFactory->getDateTime(), 'short', $dateTimeZone);
76 76
 
77
-			$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/recent.svg'));
78
-			$l = $this->l10nFactory->get('lib');
79
-			$profileActionText = $l->t('Local time: %s', [$localTime]);
77
+            $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/recent.svg'));
78
+            $l = $this->l10nFactory->get('lib');
79
+            $profileActionText = $l->t('Local time: %s', [$localTime]);
80 80
 
81
-			$action = $this->actionFactory->newLinkAction($iconUrl, $profileActionText, '#', 'timezone');
82
-			// Order after the profile page
83
-			$action->setPriority(19);
84
-			$entry->addAction($action);
85
-		}
86
-	}
81
+            $action = $this->actionFactory->newLinkAction($iconUrl, $profileActionText, '#', 'timezone');
82
+            // Order after the profile page
83
+            $action->setPriority(19);
84
+            $entry->addAction($action);
85
+        }
86
+    }
87 87
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/ActionProviderStore.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -39,74 +39,74 @@
 block discarded – undo
39 39
 use Psr\Log\LoggerInterface;
40 40
 
41 41
 class ActionProviderStore {
42
-	private IServerContainer $serverContainer;
43
-	private AppManager $appManager;
44
-	private LoggerInterface $logger;
42
+    private IServerContainer $serverContainer;
43
+    private AppManager $appManager;
44
+    private LoggerInterface $logger;
45 45
 
46
-	public function __construct(IServerContainer $serverContainer, AppManager $appManager, LoggerInterface $logger) {
47
-		$this->serverContainer = $serverContainer;
48
-		$this->appManager = $appManager;
49
-		$this->logger = $logger;
50
-	}
46
+    public function __construct(IServerContainer $serverContainer, AppManager $appManager, LoggerInterface $logger) {
47
+        $this->serverContainer = $serverContainer;
48
+        $this->appManager = $appManager;
49
+        $this->logger = $logger;
50
+    }
51 51
 
52
-	/**
53
-	 * @param IUser $user
54
-	 * @return IProvider[]
55
-	 * @throws Exception
56
-	 */
57
-	public function getProviders(IUser $user): array {
58
-		$appClasses = $this->getAppProviderClasses($user);
59
-		$providerClasses = $this->getServerProviderClasses();
60
-		$allClasses = array_merge($providerClasses, $appClasses);
61
-		$providers = [];
52
+    /**
53
+     * @param IUser $user
54
+     * @return IProvider[]
55
+     * @throws Exception
56
+     */
57
+    public function getProviders(IUser $user): array {
58
+        $appClasses = $this->getAppProviderClasses($user);
59
+        $providerClasses = $this->getServerProviderClasses();
60
+        $allClasses = array_merge($providerClasses, $appClasses);
61
+        $providers = [];
62 62
 
63
-		foreach ($allClasses as $class) {
64
-			try {
65
-				$providers[] = $this->serverContainer->get($class);
66
-			} catch (QueryException $ex) {
67
-				$this->logger->error(
68
-					'Could not load contacts menu action provider ' . $class,
69
-					[
70
-						'app' => 'core',
71
-						'exception' => $ex,
72
-					]
73
-				);
74
-				throw new Exception('Could not load contacts menu action provider');
75
-			}
76
-		}
63
+        foreach ($allClasses as $class) {
64
+            try {
65
+                $providers[] = $this->serverContainer->get($class);
66
+            } catch (QueryException $ex) {
67
+                $this->logger->error(
68
+                    'Could not load contacts menu action provider ' . $class,
69
+                    [
70
+                        'app' => 'core',
71
+                        'exception' => $ex,
72
+                    ]
73
+                );
74
+                throw new Exception('Could not load contacts menu action provider');
75
+            }
76
+        }
77 77
 
78
-		return $providers;
79
-	}
78
+        return $providers;
79
+    }
80 80
 
81
-	/**
82
-	 * @return string[]
83
-	 */
84
-	private function getServerProviderClasses(): array {
85
-		return [
86
-			ProfileProvider::class,
87
-			LocalTimeProvider::class,
88
-			EMailProvider::class,
89
-		];
90
-	}
81
+    /**
82
+     * @return string[]
83
+     */
84
+    private function getServerProviderClasses(): array {
85
+        return [
86
+            ProfileProvider::class,
87
+            LocalTimeProvider::class,
88
+            EMailProvider::class,
89
+        ];
90
+    }
91 91
 
92
-	/**
93
-	 * @param IUser $user
94
-	 * @return string[]
95
-	 */
96
-	private function getAppProviderClasses(IUser $user): array {
97
-		return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) {
98
-			$info = $this->appManager->getAppInfo($appId);
92
+    /**
93
+     * @param IUser $user
94
+     * @return string[]
95
+     */
96
+    private function getAppProviderClasses(IUser $user): array {
97
+        return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) {
98
+            $info = $this->appManager->getAppInfo($appId);
99 99
 
100
-			if (!isset($info['contactsmenu'])) {
101
-				// Nothing to add
102
-				return $all;
103
-			}
100
+            if (!isset($info['contactsmenu'])) {
101
+                // Nothing to add
102
+                return $all;
103
+            }
104 104
 
105
-			$providers = array_reduce($info['contactsmenu'], function ($all, $provider) {
106
-				return array_merge($all, [$provider]);
107
-			}, []);
105
+            $providers = array_reduce($info['contactsmenu'], function ($all, $provider) {
106
+                return array_merge($all, [$provider]);
107
+            }, []);
108 108
 
109
-			return array_merge($all, $providers);
110
-		}, []);
111
-	}
109
+            return array_merge($all, $providers);
110
+        }, []);
111
+    }
112 112
 }
Please login to merge, or discard this patch.