<commit_before><?php

namespace wcf\system\option\user;

use wcf\data\user\option\UserOption;
use wcf\data\user\User;
use wcf\util\StringUtil;

/**
 * User option output implementation for the output of an url.
 *
 * @author  <NAME>
 * @copyright   2001-2020 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Option\User
 * @since       5.4
 */
class LabeledUrlUserOptionOutput implements IUserOptionOutput
{
    /**
     * @inheritDoc
     */
    public function getOutput(User $user, UserOption $option, $value)
    {
        return StringUtil::getAnchorTag(self::getURL($option, $value), $value, true, true);
    }

    /**
     * Formats the URL.
     */
    private static function getURL(UserOption $option, string $value): string
    {
        return \sprintf($option->labeledUrl, \rawurlencode($value));
    }
}<commit_msg>Surpress output of empty labeled url user option fields<commit_after><?php

namespace wcf\system\option\user;

use wcf\data\user\option\UserOption;
use wcf\data\user\User;
use wcf\util\StringUtil;

/**
 * User option output implementation for the output of an url.
 *
 * @author  <NAME>
 * @copyright   2001-2020 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Option\User
 * @since       5.4
 */
class LabeledUrlUserOptionOutput implements IUserOptionOutput
{
    /**
     * @inheritDoc
     */
    public function getOutput(User $user, UserOption $option, $value)
    {
        if ($value) {
            return StringUtil::getAnchorTag(self::getURL($option, $value), $value, true, true);
        }

        return '';
    }

    /**
     * Formats the URL.
     */
    private static function getURL(UserOption $option, string $value): string
    {
        return \sprintf($option->labeledUrl, \rawurlencode($value));
    }
}
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.010245901639344262, 'mean_word_length': 3.15531914893617, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3960314', 'n_tokens_mistral': 617, 'n_tokens_neox': 594, 'n_words': 147}