<commit_before><?php

namespace Datachore\Type;

class Set implements \Datachore\TypeInterface
{
	protected $_val = null;
	protected $_type = null;
	
	
	public function type($type = null)
	{
		if ($this->_type == null && $type)
		{
			if ($type instanceof \Datachore\TypeInterface)
			{
				$this->_type = $type;
			}
			else
			{
				$this->_type = \Datachore\Type::getTypeFromEnum($type);
			}
		}
		return $this->_type;
	}
	
	public function get()
	{
		// Must allocate a new Datachore\Collection here since sets are modified
		// indirectly and externally.
		if ($this->_val === null)
		{
			$this->_val = new \Datachore\Collection;
		}
		
		return $this->_val;
	}
	
	public function set($value)
	{
		if ($value == null)
		{
		}
		else if ($value instanceof \Datachore\Collection)
		{
			$this->_val = clone $value;
		}
		else if ($value instanceof Set)
		{
			$this->_val = clone $value->get();
		}
		else if (is_array($value))
		{
			$this->_val = new \Datachore\Collection;
			foreach ($value as $v)
			{
				$this->_val[] = $v;
			}
		}
		else
		{
			throw new \InvalidArgumentException("Invalid Type for Set: ".get_class($value));
		}
	}
}<commit_msg>Cleanup...<commit_after><?php

namespace Datachore\Type;

class Set implements \Datachore\TypeInterface
{
	protected $_val = null;
	protected $_type = null;
	
	
	public function type($type = null)
	{
		if ($this->_type == null && $type)
		{
			if ($type instanceof \Datachore\TypeInterface)
			{
				$this->_type = $type;
			}
			else
			{
				$this->_type = \Datachore\Type::getTypeFromEnum($type);
			}
		}
		return $this->_type;
	}
	
	public function get()
	{
		// Must allocate a new Datachore\Collection here since sets are modified
		// indirectly and externally.
		if ($this->_val === null)
		{
			$this->_val = new \Datachore\Collection;
		}
		
		return $this->_val;
	}
	
	public function set($value)
	{
		if ($value == null)
		{
			$this->_val = new \Datachore\Collection;
		}
		else if ($value instanceof \Datachore\Collection)
		{
			$this->_val = clone $value;
		}
		else if (is_array($value))
		{
			$this->_val = new \Datachore\Collection;
			foreach ($value as $v)
			{
				$this->_val[] = $v;
			}
		}
		else
		{
			throw new \InvalidArgumentException("Invalid Set Value");
		}
	}
}
{'fraction_non_alphanumeric': 0.15323294951284322, 'fraction_numerical': 0.0, 'mean_word_length': 2.809443507588533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '6134941', 'n_tokens_mistral': 933, 'n_tokens_neox': 788, 'n_words': 189}