<commit_before><?php

class PhpcouchRecord implements PhpcouchIRecord
{
	protected $connection = null;
	protected $data = array();
	
	public function __construct(PhpcouchConnection $connection = null)
	{
		$this->setConnection($connection);
	}
	
	public function __get($name)
	{
		if(isset($this->data[$name])) {
			return $this->data[$name];
		}
	}
	
	public function __isset($name)
	{
		return isset($this->data[$name]);
	}
	
	public function __set($name, $value)
	{
		if(!isset($this->data[$name]) || $this->data[$name] !== $value) {
			$this->isModified = true;
		}
		$this->data[$name] = $value;
	}
	
	public function __unset($name)
	{
		if(array_key_exists($this->data[$name])) {
			unset($this->data[$name]);
		}
	}
	
	public function hydrate($data)
	{
		if(is_object($data)) {
			$data = get_object_vars($data);
		}
		
		$this->fromArray($data);
	}
	
	public function dehydrate()
	{
		return $this->toArray();
	}
	
	public function fromArray(array $data)
	{
		foreach($data as $key => $value) {
			if(strpos($key, '_') === 0) {
				$this->{$key} = $value;
			} else {
				$this->__set($key, $value);<commit_msg>invasion of the interfaces<commit_after><?php

abstract class PhpcouchRecord implements PhpcouchIRecord
{
	protected $connection = null;
	protected $data = array();
	
	public function __construct(PhpcouchConnection $connection = null)
	{
		$this->setConnection($connection);
	}
	
	public function __get($name)
	{
		if(isset($this->data[$name])) {
			return $this->data[$name];
		}
	}
	
	public function __isset($name)
	{
		return isset($this->data[$name]);
	}
	
	public function hydrate($data)
	{
		if(is_object($data)) {
			$data = get_object_vars($data);
		}
		
		$this->fromArray($data);
	}
	
	public function dehydrate()
	{
		return $this->toArray();
	}
	
	public function fromArray(array $data)
	{
		foreach($data as $key => $value) {
			if(strpos($key, '_') === 0) {
				$this->{$key} = $value;
			} else {
				$this->__set($key, $value);
{'fraction_non_alphanumeric': 0.18339276617422312, 'fraction_numerical': 0.0010188487009679063, 'mean_word_length': 4.023017902813299, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6248467', 'n_tokens_mistral': 790, 'n_tokens_neox': 699, 'n_words': 129}