3 namespace Wallabag\FederationBundle\Federation
;
5 use Wallabag\FederationBundle\Entity\Account
;
19 * CloudId constructor.
23 public function __construct($id) {
26 $atPos = strpos($id, '@');
27 $user = substr($id, 0, $atPos);
28 $remote = substr($id, $atPos +
1);
29 if (!empty($user) && !empty($remote)) {
31 $this->remote
= $remote;
36 * The full remote cloud id
40 public function getId() {
44 public function getDisplayId() {
45 return str_replace('https://', '', str_replace('http://', '', $this->getId()));
49 * The username on the remote server
53 public function getUser() {
58 * The base address of the remote server
62 public function getRemote() {
67 * @param Account $account
68 * @param string $domain
71 public static function getCloudIdFromAccount(Account
$account, $domain = '')
73 if ($account->getServer() !== null) {
74 return new self($account->getUsername() . '@' . $account->getServer());
76 return new self($account->getUsername() . '@' . $domain);