You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CloudId.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
  5. *
  6. * @author Robin Appelman <robin@icewind.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OC\Federation;
  25. use OCP\Federation\ICloudId;
  26. class CloudId implements ICloudId {
  27. /** @var string */
  28. private $id;
  29. /** @var string */
  30. private $user;
  31. /** @var string */
  32. private $remote;
  33. /**
  34. * CloudId constructor.
  35. *
  36. * @param string $id
  37. * @param string $user
  38. * @param string $remote
  39. */
  40. public function __construct(string $id, string $user, string $remote) {
  41. $this->id = $id;
  42. $this->user = $user;
  43. $this->remote = $remote;
  44. }
  45. /**
  46. * The full remote cloud id
  47. *
  48. * @return string
  49. */
  50. public function getId(): string {
  51. return $this->id;
  52. }
  53. public function getDisplayId(): string {
  54. return str_replace('https://', '', str_replace('http://', '', $this->getId()));
  55. }
  56. /**
  57. * The username on the remote server
  58. *
  59. * @return string
  60. */
  61. public function getUser(): string {
  62. return $this->user;
  63. }
  64. /**
  65. * The base address of the remote server
  66. *
  67. * @return string
  68. */
  69. public function getRemote(): string {
  70. return $this->remote;
  71. }
  72. }