diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-16 16:11:51 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-16 19:25:08 +0100 |
commit | 50acde36b77f58f44f48725809143eaa27997988 (patch) | |
tree | 9b6c01b16d146b407e75a2d81cf33797ef966956 /lib/private/Federation/CloudIdManager.php | |
parent | a159d7c28c483a2b77e2f533795f6d6d1ec720fd (diff) | |
download | nextcloud-server-50acde36b77f58f44f48725809143eaa27997988.tar.gz nextcloud-server-50acde36b77f58f44f48725809143eaa27997988.zip |
Make OCP\Federation strict
* Also internal classes
* Added scalar typehints
* Added return type
* Made strict
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Federation/CloudIdManager.php')
-rw-r--r-- | lib/private/Federation/CloudIdManager.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 3b7aaae5392..0beb6cf6d29 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl> * @@ -33,7 +34,7 @@ class CloudIdManager implements ICloudIdManager { * @return ICloudId * @throws \InvalidArgumentException */ - public function resolveCloudId($cloudId) { + public function resolveCloudId(string $cloudId): ICloudId { // TODO magic here to get the url and user instead of just splitting on @ if (!$this->isValidCloudId($cloudId)) { @@ -46,7 +47,7 @@ class CloudIdManager implements ICloudIdManager { $posColon = strpos($id, ':'); if ($posSlash === false && $posColon === false) { - $invalidPos = strlen($id); + $invalidPos = \strlen($id); } else if ($posSlash === false) { $invalidPos = $posColon; } else if ($posColon === false) { @@ -77,7 +78,7 @@ class CloudIdManager implements ICloudIdManager { * @param string $remote * @return CloudId */ - public function getCloudId($user, $remote) { + public function getCloudId(string $user, string $remote): ICloudId { // TODO check what the correct url is for remote (asking the remote) return new CloudId($user. '@' . $remote, $user, $remote); } @@ -94,7 +95,7 @@ class CloudIdManager implements ICloudIdManager { * @param string $remote * @return string */ - protected function fixRemoteURL($remote) { + protected function fixRemoteURL(string $remote): string { $remote = str_replace('\\', '/', $remote); if ($fileNamePosition = strpos($remote, '/index.php')) { $remote = substr($remote, 0, $fileNamePosition); @@ -108,7 +109,7 @@ class CloudIdManager implements ICloudIdManager { * @param string $cloudId * @return bool */ - public function isValidCloudId($cloudId) { + public function isValidCloudId(string $cloudId): bool { return strpos($cloudId, '@') !== false; } } |