CloudId.php 1.6 KB

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