<commit_before><?php
/**
 * Class Links
 *
 * @filesource   Links.php
 * @created      12.10.2015
 * @package      chillerlan\bbcode\Modules\Html5
 * @author       Smiley <<EMAIL>>
 * @copyright    2015 Smiley
 * @license      MIT
 */

namespace chillerlan\bbcode\Modules\Html5;

use chillerlan\bbcode\BBTemp;
use chillerlan\bbcode\Modules\ModuleInterface;
use chillerlan\bbcode\Modules\Html5\Html5BaseModule;

/**
 *
 */
class Links extends Html5BaseModule implements ModuleInterface{

	/**
	 * @var array
	 */
	protected $tags = ['url'];

	/**
	 * Returns the processed bbcode
	 *
	 * @return string a HTML snippet
	 */
	public function transform(){
		$this->check_tag();

		$url = $this->check_url($this->bbtag() ? : $this->content);

		$host = parse_url($url, PHP_URL_HOST);
		$target = !empty($host) && $host === $_SERVER['SERVER_NAME'] || empty($host) ? 'self' : 'blank';

		return '<a'.($url ? ' href="'.$url.'" target="_'.$target.'"' : '').$this->get_title().$this->get_css_class($target).'>'.$this->content.'</a>';
	}

}
<commit_msg>fixed undefined index notice<commit_after><?php
/**
 * Class Links
 *
 * @filesource   Links.php
 * @created      12.10.2015
 * @package      chillerlan\bbcode\Modules\Html5
 * @author       Smiley <<EMAIL>>
 * @copyright    2015 Smiley
 * @license      MIT
 */

namespace chillerlan\bbcode\Modules\Html5;

use chillerlan\bbcode\BBTemp;
use chillerlan\bbcode\Modules\ModuleInterface;
use chillerlan\bbcode\Modules\Html5\Html5BaseModule;

/**
 *
 */
class Links extends Html5BaseModule implements ModuleInterface{

	/**
	 * @var array
	 */
	protected $tags = ['url'];

	/**
	 * Returns the processed bbcode
	 *
	 * @return string a HTML snippet
	 */
	public function transform(){
		$this->check_tag();

		$url = $this->check_url($this->bbtag() ? : $this->content);

		$host = parse_url($url, PHP_URL_HOST);
		$target = !empty($host) && (isset($_SERVER['SERVER_NAME']) && $host === $_SERVER['SERVER_NAME']) || empty($host) ? 'self' : 'blank';

		return '<a'.($url ? ' href="'.$url.'" target="_'.$target.'"' : '').$this->get_title().$this->get_css_class($target).'>'.$this->content.'</a>';
	}

}

{'fraction_non_alphanumeric': 0.19437939110070257, 'fraction_numerical': 0.01592505854800937, 'mean_word_length': 3.767857142857143, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '4483450', 'n_tokens_mistral': 770, 'n_tokens_neox': 729, 'n_words': 138}