<commit_before><?php
/**
 *
 * @author    <NAME> <<EMAIL>>
 * @license   http://opensource.org/licenses/mit-license.php MIT
 * @package   Form
 * @link      www.ppiframework.com
 */
abstract class PPI_Form_Tag {

	/**
	 * @var array
	 */
	protected $_attributes = array();


	/**
	 * Getter and setter for attributes
	 *
	 * @param string $name The attribute name
	 * @param string $value The attribute value
	 * @return mixed
	 */
	public function attr($name, $value = '') {

		if(empty($value)) {
			return isset($this->_attributes[$name]) ? $this->_attributes[$name] : '';
		} else {
			$this->_attributes[$name] = $value;
		}
	}

	/**
	 * Check if an attribute exists
	 *
	 * @param string $attr
	 * @return bool
	 */
	public function hasAttr($attr) {
		return isset($this->_attributes[$attr]);
	}

	/**
	 * Build up the attributes
	 *
	 * @return string
	 */
	protected function buildAttrs() {

		$attrs = array();
		foreach($this->_attributes as $key => $name) {
			$attrs[] = $this->buildAttr($key);
		}
		return implode(' ', $attrs);
	}

	/**
	 * Build an attribute
	 *
	 * @param string $name
	 * @return string
	 */
	protected function buildAttr($name) {
		return sprintf('%s="%s"', $name, $this->escape($this->attr($name)));
	}

	/**
	 * Escape an attributes value
	 *
	 * @param string $value
	 * @return string
	 */
	public function escape($value) {
		return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
	}


}<commit_msg>Made ->attr(), ->hasAttr() public methods<commit_after><?php
/**
 *
 * @author    <NAME> <<EMAIL>>
 * @license   http://opensource.org/licenses/mit-license.php MIT
 * @package   Form
 * @link      www.pp<EMAIL>
 */
abstract class PPI_Form_Tag {

	/**
	 * @var array
	 */
	protected $_attributes = array();


	/**
	 * Getter and setter for attributes
	 *
	 * @param string $name The attribute name
	 * @param string $value The attribute value
	 * @return mixed
	 */
	public function attr($name, $value = '') {

		if(empty($value)) {
			return isset($this->_attributes[$name]) ? $this->_attributes[$name] : '';
		} else {
			$this->_attributes[$name] = $value;
		}
	}

	/**
	 * Check if an attribute exists
	 *
	 * @param string $attr
	 * @return bool
	 */
	public function hasAttr($attr) {
		return isset($this->_attributes[$attr]);
	}

	/**
	 * Build up the attributes
	 *
	 * @return string
	 */
	protected function buildAttrs() {

		$attrs = array();
		foreach($this->_attributes as $key => $name) {
			$attrs[] = $this->buildAttr($key);
		}
		return implode(' ', $attrs);
	}

	/**
	 * Build an attribute
	 *
	 * @param string $name
	 * @return string
	 */
	protected function buildAttr($name) {
		return sprintf('%s="%s"', $name, $this->escape($this->attr($name)));
	}

	/**
	 * Escape an attributes value
	 *
	 * @param string $value
	 * @return string
	 */
	protected function escape($value) {
		return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
	}


}
{'fraction_non_alphanumeric': 0.1766735679779158, 'fraction_numerical': 0.0006901311249137336, 'mean_word_length': 3.177233429394813, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3652209', 'n_tokens_mistral': 1028, 'n_tokens_neox': 924, 'n_words': 234}