/** * Internal method retrieving an account from its email * * @param email (string) The mail account from which retrieve the account * If email is null, the first account is considered * * @return (SimpleXMLElement) The SimpleXML representation of the account * * @throws AllopassApiConfAccountNotFoundException If an email is provided but can't be found */ private function _retrieveAccount($email) { // aMember code // use $email variable to pass XML $this->_xml = AllopassApiTools::xmlParseString($email); if (!is_object($this->_xml)) { throw new AllopassApiConfFileCorruptedException(); } $this->_checkFile(); $email = null; // clear variable to make following code work correct ///// $accounts = $this->_xml->accounts->children(); if ($email === null) { return $accounts[0]; } else { foreach ($accounts as $account) { if ($account->attributes()->email == $email) { return $account; } } throw new AllopassApiConfAccountNotFoundException(); } }
/** * Constructor * * @param signature (string) Expected response signature * @param headers (string) HTTP headers of the response * @param body (string) Raw data of the response */ public function __construct($signature, $headers, $body) { parent::__construct($signature, $headers, $body); $this->_xml = AllopassApiTools::xmlParseString($this->_body); $this->_verify(); }