<commit_before><?php
namespace Sy\Component\Html\Form;

use Sy\Component\Html\Element as HtmlElement;

class Element extends HtmlElement {

	private $options;
	private $error;

	public function __construct($tagName = '') {
		parent::__construct($tagName);
		$this->setTemplateFile(__DIR__ . '/templates/Element.tpl', 'php');
		$this->options = array('label-position' => 'before', 'error-position' => 'before', 'error-class' => 'error');
		$this->error = false;
	}

	/**
	 * Set the element attribute
	 *
	 * @param string $name attribute name
	 * @param string $value attribute value
	 */
	public function setAttribute($name, $value) {
		if ($name == 'name')
			$this->setName($value);
		else
			parent::setAttribute($name, $value);
	}<commit_msg>add method addClass in Form\Element in replacement of addAttribute method<commit_after><?php
namespace Sy\Component\Html\Form;

use Sy\Component\Html\Element as HtmlElement;

class Element extends HtmlElement {

	private $options;
	private $error;

	public function __construct($tagName = '') {
		parent::__construct($tagName);
		$this->setTemplateFile(__DIR__ . '/templates/Element.tpl', 'php');
		$this->options = array('label-position' => 'before', 'error-position' => 'before', 'error-class' => 'error');
		$this->error = false;
	}

	/**
	 * Set the element attribute
	 *
	 * @param string $name attribute name
	 * @param string $value attribute value
	 */
	public function setAttribute($name, $value) {
		if ($name == 'name')
			$this->setName($value);
		else
			parent::setAttribute($name, $value);
	}

	/**
	 * Add a class to the element
	 *
	 * @param string $class
	 */
	public function addClass($class) {
		$actual = $this->getAttribute('class');
		$class = is_null($actual) ? $class : $actual . ' ' . $class;
		$this->setAttribute('class', $class);
	}
{'fraction_non_alphanumeric': 0.16528468767274737, 'fraction_numerical': 0.0, 'mean_word_length': 4.339233038348082, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4027123', 'n_tokens_mistral': 593, 'n_tokens_neox': 555, 'n_words': 142}