Exemple #1
0
 /**
  * Import information from a user element into this user.
  * @param \DOMElement $user The user element to parse.
  */
 protected function parse(DOMElement $user)
 {
     $this->setUsername($user->getElementsByTagName('user_name')->item(0)->nodeValue);
     $this->setAvatarUrl($user->getElementsByTagName('user_avatar_url')->item(0)->nodeValue);
     $this->setEmail($user->getElementsByTagName('user_email')->item(0)->nodeValue);
     $website = $user->getElementsByTagName('user_website')->item(0)->nodeValue;
     $this->setWebsiteUrl($website === '' ? null : $website);
     $location = $user->getElementsByTagName('user_location')->item(0)->nodeValue;
     $this->setLocation($location === '' ? null : $location);
     $this->setType($user->getElementsByTagName('user_account_type')->item(0)->nodeValue);
     $this->setDefaults(Defaults::fromXml($user));
 }
Exemple #2
0
 /**
  * Create a new defaults instance from user XML.
  * @param \DOMElement $element The `<user>` node to parse.
  * @return \Brush\Accounts\Defaults The created settings container.
  */
 public static final function fromXml(DOMElement $element)
 {
     $defaults = new Defaults();
     $defaults->parse($element);
     return $defaults;
 }