public function testSettingXmlRpcClientSetsUriOfItsHttpClient() { $this->_gravatarXmlRpc->setXmlRpcClient(new Zend_XmlRpc_Client('http://foo')); $uri = $this->_gravatarXmlRpc->getXmlRpcClient()->getHttpClient()->getUri(); $this->assertContains($uri->getHost(), NP_Service_Gravatar_XmlRpc::SECURE_XMLRPC_SERVER); $this->assertEquals('user=' . NP_Service_Gravatar_Utility::emailHash($this->_gravatarXmlRpc->getEmail()), $uri->getQuery()); }
/** * Sets $_thumbnailUrl. * * @param string|Zend_Uri_Http $thumbnailUrl * @return NP_Service_Gravatar_Profiles_Profile */ public function setThumbnailUrl($thumbnailUrl) { $this->_thumbnailUrl = NP_Service_Gravatar_Utility::normalizeUri($thumbnailUrl); return $this; }
/** * Sets $_url. * * @param string|Zend_Uri_Http $url * @return NP_Service_Gravatar_Profiles_Profile_Background */ public function setUrl($url) { $this->_url = NP_Service_Gravatar_Utility::normalizeUri($url); return $this; }
/** * Sets $_value. * * @param string|Zend_Uri_Http $value * @return NP_Service_Gravatar_Profiles_Profile_Url */ public function setValue($value) { $this->_value = NP_Service_Gravatar_Utility::normalizeUri($value); return $this; }
/** * Defined by NP_Service_Gravatar_Profiles_Profile_TypeValue. * * Sets $_value. * * @param string|Zend_Uri_Http $value * @return NP_Service_Gravatar_Profiles_Profile_Photo */ public function setValue($value) { //Making sure that $_value is Zend_Uri_Http instance. $this->_value = NP_Service_Gravatar_Utility::normalizeUri($value); return $this; }
/** * Generates and returns server uri to be used by * $_xmlRpcClient. * * @return string */ protected function _getServerUri() { require_once 'NP/Service/Gravatar/Utility.php'; return self::SECURE_XMLRPC_SERVER . '?user=' . NP_Service_Gravatar_Utility::emailHash($this->getEmail()); }
/** * Sets $_primary. * * @param string|bool $primary * @return NP_Service_Gravatar_Profiles_Profile_Email */ public function setPrimary($primary) { $this->_primary = NP_Service_Gravatar_Utility::normalizeBool($primary); return $this; }
/** * Gets profile info of some Gravatar's user, based on his/her * email address. Return value is NP_Gravatar_Profile instance, * in case $_responseFormat implements * NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface * interface. Otherwise, or in case $rawResponse flag is set to * boolean true, Zend_Http_Response instance is returned. * * @param string $email * @param bool $rawResponse Whether raw response object should be returned. * @return NP_Gravatar_Profile|Zend_Http_Response */ public function getProfileInfo($email, $rawResponse = false) { $email = strtolower(trim((string) $email)); $hash = NP_Service_Gravatar_Utility::emailHash($email); $response = $this->getHttpClient()->setMethod(Zend_Http_Client::GET)->setUri(self::GRAVATAR_SERVER . '/' . $hash . '.' . $this->_responseFormat)->request(); $reflected = new ReflectionObject($this->_responseFormat); if ($reflected->implementsInterface('NP_Service_Gravatar_Profiles_ResponseFormat_ParserInterface') && !$rawResponse) { return $this->_responseFormat->profileFromHttpResponse($response); } else { return $response; } }
/** * Sets $_verified. * * @param string|bool $verified * @return NP_Service_Gravatar_Profiles_Profile_Account */ public function setVerified($verified) { $this->_verified = NP_Service_Gravatar_Utility::normalizeBool($verified); return $this; }