/** * {@inheritdoc} */ public function format(StatusInterface $status) { return $status->setText(preg_replace_callback('#(?P<all>(?P<href>href=("|\'))?(?P<link>https?://(?P<name>[^\\s]+)))#', function ($matches) { if ($matches['href']) { return $matches['all']; } return sprintf('<a href="%s">%s</a>', $matches['link'], $matches['name']); }, $status->getText())); }
/** * {@inheritdoc} */ public function format(StatusInterface $status) { return $status->setText(preg_replace('/#(\\w+)/', sprintf('<a href="' . self::HASHTAG_URL . '">#%s</a>', '$1', '$1'), $status->getText())); }
/** * {@inheritdoc} */ public function isValid(StatusInterface $status) { return 0 !== strpos($status->getText(), '@'); }