<commit_before><?php

namespace phpcouch\record;

use phpcouch\exception;

class Document extends MutableAbstract implements DocumentInterface
{
	const ATTACHMENTS_FIELD = '_attachments';
	
	/**
	 * Load data into this record.
	 * This will clear all information before importing the data and set new and modified flags to false.
	 *
	 * @param      array The data to load.
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function hydrate($data)
	{
		parent::hydrate($data);
		
		$this->isNew = false;
		$this->isModified = false;
	}
	
	public function getAttachments()
	{
		return $this->{self::ATTACHMENTS_FIELD};
	}
	
	public function hasAttachments()
	{
		return count($this->{self::ATTACHMENTS_FIELD});
	}
	
	public function retrieveAttachment($name)
	{
		if(isset($this->{self::ATTACHMENTS_FIELD}[$name])) {
			return $this->connection->retrieveAttachment($this, $name);
		} else {
			throw new Exception(sprintf('Unknown attachment "%s".', $name));
		}
	}
	
	/**
	 * Save this document in the database.
	 *
	 * @throws     ?
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function save()
	{
		if($this->isNew()) {
			return $this->connection->createDocument($this);
		} elseif($this->isModified()) {
			return $this->connection->updateDocument($this);
		}
	}
}

?><commit_msg>fix inheritance<commit_after><?php

namespace phpcouch\record;

use phpcouch\exception;

class Document extends MutableRecordAbstract implements DocumentInterface
{
	const ATTACHMENTS_FIELD = '_attachments';
	
	/**
	 * Load data into this record.
	 * This will clear all information before importing the data and set new and modified flags to false.
	 *
	 * @param      array The data to load.
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function hydrate($data)
	{
		parent::hydrate($data);
		
		$this->isNew = false;
		$this->isModified = false;
	}
	
	public function getAttachments()
	{
		return $this->{self::ATTACHMENTS_FIELD};
	}
	
	public function hasAttachments()
	{
		return count($this->{self::ATTACHMENTS_FIELD});
	}
	
	public function retrieveAttachment($name)
	{
		if(isset($this->{self::ATTACHMENTS_FIELD}[$name])) {
			return $this->connection->retrieveAttachment($this, $name);
		} else {
			throw new Exception(sprintf('Unknown attachment "%s".', $name));
		}
	}
	
	/**
	 * Save this document in the database.
	 *
	 * @throws     ?
	 *
	 * @author     <NAME> <<EMAIL>>
	 * @since      1.0.0
	 */
	public function save()
	{
		if($this->isNew()) {
			return $this->connection->createDocument($this);
		} elseif($this->isModified()) {
			return $this->connection->updateDocument($this);
		}
	}
}

?>
{'fraction_non_alphanumeric': 0.1504491017964072, 'fraction_numerical': 0.004491017964071856, 'mean_word_length': 3.5152027027027026, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 43, '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': '7036631', 'n_tokens_mistral': 952, 'n_tokens_neox': 850, 'n_words': 201}