/** * @param string $socialType * @param string $username * @return string */ public function getSocialUrl($socialType, $username) { if (!$socialType || !$username) { return '#'; } return $this->socialUrlFormatter->getSocialUrl($socialType, $username); }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = array()) { $result = parent::normalize($object, $format, $context); foreach (static::$socialFields as $socialType => $fieldName) { if (!empty($result[$fieldName])) { $result[$fieldName] = $this->socialUrlFormatter->getSocialUrl($socialType, $result[$fieldName]); } } return $result; }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Unknown social network type "type" */ public function testGetSocialUrlNoSocial() { $formatter = new SocialUrlFormatter(array()); $formatter->getSocialUrl('type', 'me'); }