<commit_before><?php namespace Hybrid;

use Laravel\HTML as Laravel_HTML;

class HTML extends Laravel_HTML 
{
	/**
	 * Generate a HTML element
	 *
	 * @static
	 * @access public
	 * @param  string $tag
	 * @param  mixed  $value
	 * @param  array  $attributes
	 * @return string
	 */
	public static function create($tag = 'div', $value = null, $attributes = array())
	{
		if (is_array($value))
		{
			$attributes = $value;
			$value      = null;
		}

		$content = '<'.$tag.static::attributes($attributes).'>';

		if ( ! is_null($value))
		{
			$content .= static::entities($value).'</'.$tag.'>';
		}
		
		return $content;
	}

	/**
	 * Build a list of HTML attributes from one or two array.
	 *
	 * @param  array   $attributes
	 * @return array
	 */
	public static function pre_attributes($attributes, $defaults = null)
	{
		// Special consideration to class, where we need to merge both string from
		// $attributes and $defaults and take union of both.
		$class = isset($defaults['class']) ? $defaults['class'] : ' ';
		$class = isset($attributes['class']) ? $attributes['class'] : '';
		$class = trim($class);

		$classes = explode(' ', $class);
		$class   = implode(' ', array_unique($classes));

		$attributes = array_merge($defaults, $attributes);

		if ($class !== '') $attributes['class'] = $class;

		return $attributes;
	}
}<commit_msg>Properly append both classes and avoid trimming not properly done<commit_after><?php namespace Hybrid;

use Laravel\HTML as Laravel_HTML;

class HTML extends Laravel_HTML 
{
	/**
	 * Generate a HTML element
	 *
	 * @static
	 * @access public
	 * @param  string $tag
	 * @param  mixed  $value
	 * @param  array  $attributes
	 * @return string
	 */
	public static function create($tag = 'div', $value = null, $attributes = array())
	{
		if (is_array($value))
		{
			$attributes = $value;
			$value      = null;
		}

		$content = '<'.$tag.static::attributes($attributes).'>';

		if ( ! is_null($value))
		{
			$content .= static::entities($value).'</'.$tag.'>';
		}
		
		return $content;
	}

	/**
	 * Build a list of HTML attributes from one or two array.
	 *
	 * @param  array   $attributes
	 * @return array
	 */
	public static function pre_attributes($attributes, $defaults = null)
	{
		// Special consideration to class, where we need to merge both string from
		// $attributes and $defaults and take union of both.
		$class1 = isset($defaults['class']) ? $defaults['class'] : '';
		$class2 = isset($attributes['class']) ? $attributes['class'] : '';
		$class  = trim($class1 .' '.$class2);

		$classes = explode(' ', $class);
		$class   = implode(' ', array_unique($classes));

		$attributes = array_merge($defaults, $attributes);

		if ($class !== '') $attributes['class'] = $class;

		return $attributes;
	}
}
{'fraction_non_alphanumeric': 0.16799709724238027, 'fraction_numerical': 0.001451378809869376, 'mean_word_length': 3.490228013029316, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '4074940', 'n_tokens_mistral': 935, 'n_tokens_neox': 847, 'n_words': 244}