Completed
Pull Request — master (#8652)
by Julius
46:05 queued 29:24
created
core/Controller/NavigationController.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -31,76 +31,76 @@
 block discarded – undo
31 31
 
32 32
 class NavigationController extends OCSController {
33 33
 
34
-	/** @var INavigationManager */
35
-	private $navigationManager;
34
+    /** @var INavigationManager */
35
+    private $navigationManager;
36 36
 
37
-	/** @var IURLGenerator */
38
-	private $urlGenerator;
37
+    /** @var IURLGenerator */
38
+    private $urlGenerator;
39 39
 
40
-	public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) {
41
-		parent::__construct($appName, $request);
42
-		$this->navigationManager = $navigationManager;
43
-		$this->urlGenerator = $urlGenerator;
44
-	}
40
+    public function __construct(string $appName, IRequest $request, INavigationManager $navigationManager, IURLGenerator $urlGenerator) {
41
+        parent::__construct($appName, $request);
42
+        $this->navigationManager = $navigationManager;
43
+        $this->urlGenerator = $urlGenerator;
44
+    }
45 45
 
46
-	/**
47
-	 * @NoAdminRequired
48
-	 * @NoCSRFRequired
49
-	 *
50
-	 * @param bool $absolute
51
-	 * @return DataResponse
52
-	 */
53
-	public function getAppsNavigation(bool $absolute = false): DataResponse {
54
-		$navigation = $this->navigationManager->getAll();
55
-		if ($absolute) {
56
-			$navigation = $this->rewriteToAbsoluteUrls($navigation);
57
-		}
46
+    /**
47
+     * @NoAdminRequired
48
+     * @NoCSRFRequired
49
+     *
50
+     * @param bool $absolute
51
+     * @return DataResponse
52
+     */
53
+    public function getAppsNavigation(bool $absolute = false): DataResponse {
54
+        $navigation = $this->navigationManager->getAll();
55
+        if ($absolute) {
56
+            $navigation = $this->rewriteToAbsoluteUrls($navigation);
57
+        }
58 58
 
59
-		$etag = md5(json_encode($navigation));
60
-		if ($this->request->getHeader('If-None-Match') === $etag) {
61
-			return new DataResponse([], Http::STATUS_NOT_MODIFIED);
62
-		}
63
-		$response = new DataResponse($navigation);
64
-		$response->setEtag($etag);
65
-		return $response;
66
-	}
59
+        $etag = md5(json_encode($navigation));
60
+        if ($this->request->getHeader('If-None-Match') === $etag) {
61
+            return new DataResponse([], Http::STATUS_NOT_MODIFIED);
62
+        }
63
+        $response = new DataResponse($navigation);
64
+        $response->setEtag($etag);
65
+        return $response;
66
+    }
67 67
 
68
-	/**
69
-	 * @NoAdminRequired
70
-	 * @NoCSRFRequired
71
-	 *
72
-	 * @param bool $absolute
73
-	 * @return DataResponse
74
-	 */
75
-	public function getSettingsNavigation(bool $absolute = false): DataResponse {
76
-		$navigation = $this->navigationManager->getAll('settings');
77
-		if ($absolute) {
78
-			$navigation = $this->rewriteToAbsoluteUrls($navigation);
79
-		}
80
-		$etag = md5(json_encode($navigation));
81
-		if ($this->request->getHeader('If-None-Match') === $etag) {
82
-			return new DataResponse([], Http::STATUS_NOT_MODIFIED);
83
-		}
84
-		$response = new DataResponse($navigation);
85
-		$response->setEtag($etag);
86
-		return $response;
87
-	}
68
+    /**
69
+     * @NoAdminRequired
70
+     * @NoCSRFRequired
71
+     *
72
+     * @param bool $absolute
73
+     * @return DataResponse
74
+     */
75
+    public function getSettingsNavigation(bool $absolute = false): DataResponse {
76
+        $navigation = $this->navigationManager->getAll('settings');
77
+        if ($absolute) {
78
+            $navigation = $this->rewriteToAbsoluteUrls($navigation);
79
+        }
80
+        $etag = md5(json_encode($navigation));
81
+        if ($this->request->getHeader('If-None-Match') === $etag) {
82
+            return new DataResponse([], Http::STATUS_NOT_MODIFIED);
83
+        }
84
+        $response = new DataResponse($navigation);
85
+        $response->setEtag($etag);
86
+        return $response;
87
+    }
88 88
 
89
-	/**
90
-	 * Rewrite href attribute of navigation entries to an absolute URL
91
-	 *
92
-	 * @param array $navigation
93
-	 * @return array
94
-	 */
95
-	private function rewriteToAbsoluteUrls(array $navigation): array {
96
-		foreach ($navigation as &$entry) {
97
-			if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) {
98
-				$entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']);
99
-			}
100
-			if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) {
101
-				$entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']);
102
-			}
103
-		}
104
-		return $navigation;
105
-	}
89
+    /**
90
+     * Rewrite href attribute of navigation entries to an absolute URL
91
+     *
92
+     * @param array $navigation
93
+     * @return array
94
+     */
95
+    private function rewriteToAbsoluteUrls(array $navigation): array {
96
+        foreach ($navigation as &$entry) {
97
+            if (0 !== strpos($entry['href'], $this->urlGenerator->getBaseUrl())) {
98
+                $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']);
99
+            }
100
+            if (0 !== strpos($entry['icon'], $this->urlGenerator->getBaseUrl())) {
101
+                $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']);
102
+            }
103
+        }
104
+        return $navigation;
105
+    }
106 106
 }
Please login to merge, or discard this patch.