Skip to content

Commit 9e632cc

Browse files
CarlSchwanbackportbot[bot]
authored andcommitted
refactor(urlgenerator): Move getLogoutUrl from OC_User to IUrlGenerator
refactor(urlgenerator): Move getLogoutUrl from OC_User to IUrlGenerator And some minor cleanup of both IApacheBackend and UrlGenerator to properly type non-empty-string Signed-off-by: Carl Schwan <carlschwan@kde.org> [skip ci]
1 parent 4af378d commit 9e632cc

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

lib/private/URLGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99
namespace OC;
1010

1111
use OC\Route\Router;
12+
use OC\Security\CSRF\CsrfTokenManager;
1213
use OCA\Theming\ThemingDefaults;
1314
use OCP\App\AppPathNotFoundException;
1415
use OCP\App\IAppManager;
16+
use OCP\Authentication\IApacheBackend;
1517
use OCP\ICacheFactory;
1618
use OCP\IConfig;
1719
use OCP\INavigationManager;
1820
use OCP\IRequest;
1921
use OCP\IURLGenerator;
22+
use OCP\IUser;
23+
use OCP\IUserManager;
2024
use OCP\IUserSession;
2125
use RuntimeException;
2226

lib/public/Authentication/IApacheBackend.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ interface IApacheBackend {
1919
/**
2020
* In case the user has been authenticated by a module true is returned.
2121
*
22-
* @return boolean whether the module reports a user as currently logged in.
22+
* @return bool whether the module reports a user as currently logged in.
2323
* @since 6.0.0
2424
*/
25-
public function isSessionActive();
25+
public function isSessionActive(): bool;
2626

2727
/**
2828
* Gets the current logout URL
2929
*
30-
* @return string
30+
* @return non-empty-string
3131
* @since 12.0.3
3232
*/
33-
public function getLogoutUrl();
33+
public function getLogoutUrl(): string;
3434

3535
/**
3636
* Return the id of the current user
3737
* @return string
3838
* @since 6.0.0
3939
*/
40-
public function getCurrentUserId();
40+
public function getCurrentUserId(): string;
4141
}

lib/public/IURLGenerator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface IURLGenerator {
3535

3636
/**
3737
* Returns the URL for a route
38-
* @param string $routeName the name of the route
38+
* @param non-empty-string $routeName the name of the route
3939
* @param array $arguments an array with arguments which will be filled into the url
4040
* @return string the url
4141
* @since 6.0.0
@@ -44,9 +44,9 @@ public function linkToRoute(string $routeName, array $arguments = []): string;
4444

4545
/**
4646
* Returns the absolute URL for a route
47-
* @param string $routeName the name of the route
47+
* @param non-empty-string $routeName the name of the route
4848
* @param array $arguments an array with arguments which will be filled into the url
49-
* @return string the absolute url
49+
* @return non-empty-string the absolute url
5050
* @since 8.0.0
5151
*/
5252
public function linkToRouteAbsolute(string $routeName, array $arguments = []): string;
@@ -60,7 +60,7 @@ public function linkToRouteAbsolute(string $routeName, array $arguments = []): s
6060
public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string;
6161

6262
/**
63-
* Returns an URL for an image or file
63+
* Returns a URL for an image or file
6464
* @param string $appName the name of the app
6565
* @param string $file the name of the file
6666
* @param array $args array with param=>value, will be appended to the returned url
@@ -82,9 +82,9 @@ public function imagePath(string $appName, string $file): string;
8282

8383

8484
/**
85-
* Makes an URL absolute
85+
* Makes a URL absolute
8686
* @param string $url the url in the ownCloud host
87-
* @return string the absolute version of the url
87+
* @return non-empty-string the absolute version of the url
8888
* @since 6.0.0
8989
*/
9090
public function getAbsoluteURL(string $url): string;
@@ -105,7 +105,7 @@ public function linkToDocs(string $key): string;
105105
public function linkToDefaultPageUrl(): string;
106106

107107
/**
108-
* @return string base url of the current request
108+
* @return non-empty-string base url of the current request
109109
* @since 13.0.0
110110
*/
111111
public function getBaseUrl(): string;

0 commit comments

Comments
 (0)