<commit_before><?php
/**
*	File Containing the Object class.
*
*	@package	Frozensheep\Synthesize
*	@author		<NAME> <<EMAIL>>
*	@license	MIT
*
*/

namespace Frozensheep\Synthesize\Type;

use Frozensheep\Synthesize\Type\Type;
use Frozensheep\Synthesize\Exception\ClassException;

/**
*	Object Class
*
*	An object data class.
*
*	@package	Frozensheep\Synthesize
*
*/
class Object extends Type {

	/**
	*	Is Valid Method
	*
	*	Checks to see if the value is valud for the given data type.
	*	@param mixed $mixValue The value to check.
	*	@return bool
	*/
	public function isValid($mixValue){
		if(is_null($mixValue)){
			return true;
		}

		if(is_object($mixValue)){
			if($this->options()->class){
				$strClass = $this->options()->class;
				if($mixValue instanceof $strClass){
					return true;
				}else{
					throw new ClassException($mixValue, $strClass);<commit_msg>Creating the object on setup so you dont have to do it manually. Needs to add a config option to not do this if you dont want it.<commit_after><?php
/**
*	File Containing the Object class.
*
*	@package	Frozensheep\Synthesize
*	@author		<NAME> <<EMAIL>>
*	@license	MIT
*
*/

namespace Frozensheep\Synthesize\Type;

use Frozensheep\Synthesize\Type\Type;
use Frozensheep\Synthesize\Exception\ClassException;

/**
*	Object Class
*
*	An object data class.
*
*	@package	Frozensheep\Synthesize
*
*/
class Object extends Type {

	/**
	*	Class Contructor
	*
	*	@param mixed $mixValue An optional value to set on construction.
	*	@return self
	*/
	public function __construct($mixValue = null){
		if(is_null($mixValue)){
			if($this->options()->class){
				$strClass = $this->options()->class;
				$mixValue = new $strClass;
			}
		}

		$this->setValue($mixValue);
	}

	/**
	*	Is Valid Method
	*
	*	Checks to see if the value is valud for the given data type.
	*	@param mixed $mixValue The value to check.
	*	@return bool
	*/
	public function isValid($mixValue){
		if(is_null($mixValue)){
			return true;
		}

		if(is_object($mixValue)){
			if($this->options()->class){
				$strClass = $this->options()->class;
				if($mixValue instanceof $strClass){
					return true;
				}else{
					throw new ClassException($mixValue, $strClass);
{'fraction_non_alphanumeric': 0.136986301369863, 'fraction_numerical': 0.0, 'mean_word_length': 3.8473451327433628, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, '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': '468483', 'n_tokens_mistral': 847, 'n_tokens_neox': 770, 'n_words': 204}