<commit_before><?php
/**
 * Nooku Framework - http://nooku.org/framework
 *
 * @copyright   Copyright (C) 2007 - 2014 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        https://github.com/nooku/nooku-framework for the canonical source repository
 */

/**
 * Model Entity Interface
 *
 * @author  <NAME> <https://github.com/johanjanssens>
 * @package Koowa\Library\Model\Entity
 */
interface KModelEntityInterface extends IteratorAggregate, ArrayAccess, Serializable, Countable
{
    /**
     * Entity States
     */
    const STATUS_FETCHED  = 'fetched';
    const STATUS_DELETED  = 'deleted';
    const STATUS_CREATED  = 'created';
    const STATUS_UPDATED  = 'updated';
    const STATUS_FAILED   = 'failed';

    /**
     * Saves the to the data store
     *
     * This performs an intelligent insert/update and reloads the properties
     * with fresh data from the table on success.
     *
     * @return KModelEntityInterface
     */
    public function save();

    /**
     * Deletes the entity form the data store
     *
     * @return KModelEntityInterface
     */
    public function delete();

    /**
     * Resets to the entity to it's default properties
     *
     * @return KModelEntityInterface
     */
    public function reset();

    /**
     * Get the entity key
     *
     * @return string
     */
    public function getIdentityKey();

    /**
     * Get a property
     *
     * @param   string  $name The property name.
     * @return  mixed   The property value.
     */
    public function getProperty($name);

    /**
     * Set a property
     *
     * If the value is the same as the current value and the entity is loaded from the data store the value will not be
     * reset. If the entity is new the value will be (re)set and marked as modified
     *
     * @param   string  $name       The property name.
     * @param   mixed   $value      The property value.
     * @param   boolean $modified   If TRUE, update the modified information for the property
     *
     * @return  KModelEntityInterface
     */
    public function setProperty($name, $value, $modified = true);

    /**
     * Test existence of a property
     *
     * @param  string  $name The property name.
     * @return boolean
     */
    public function hasProperty($name);

    /**
     * Remove a property
     *
     * @param   string  $name The property name.
     * @return  KModelEntityInterface
     */
    public function removeProperty($name);

    /**
     * Get the properties
     *
     * @param   boolean  $modified If TRUE, only return the modified data.
     * @return  array   An associative array of entity properties
     */
    public function getProperties($modified = false);

    /**
     * Set the properties
     *
     * @param   mixed   $properties  Either and associative array, an object or a KModelEntityInterface
     * @param   boolean $modified    If TRUE, update the modified information for each column being set.
     * @return  KModelEntityInterface
     */
    public function setProperties($properties, $modified = true);

    /**
     * Get a list of the computed properties
     *
     * @return array An array
     */
    public function getComputedProperties();

    /**
     * Returns the status.
     *
     * @return string The status value.
     */
    public function getStatus();
    
    /**
     * Set the status
     *
     * @param   string|null $status The status value or NULL to reset the status
     * @return  KModelEntityInterface
     */
    public function setStatus($status);
    
    /**
     * Returns the status message
     *
     * @return string The status message
     */
    public function getStatusMessage();
    
    /**
     * Set the status message
     *
     * @param   string $message The status message
     * @return  KModelEntityInterface
     */
    public function setStatusMessage($message);

    /**
     * Checks if the entity is new or not
     *
     * @return bool
     */
    public function isNew();

    /**
     * Check if the entity or specific entity property has been modified.
     *
     * If a specific property name is giving method will return TRUE only if this property was modified.
     *
     * @param   string $property The property name<commit_msg>re #208 : Add modified entity state.<commit_after><?php
/**
 * Nooku Framework - http://nooku.org/framework
 *
 * @copyright   Copyright (C) 2007 - 2014 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        https://github.com/nooku/nooku-framework for the canonical source repository
 */

/**
 * Model Entity Interface
 *
 * @author  <NAME> <https://github.com/johanjanssens>
 * @package Koowa\Library\Model\Entity
 */
interface KModelEntityInterface extends IteratorAggregate, ArrayAccess, Serializable, Countable
{
    /**
     * Entity States
     */
    const STATUS_MODIFIED = 'modified';
    const STATUS_FETCHED  = 'fetched';
    const STATUS_DELETED  = 'deleted';
    const STATUS_CREATED  = 'created';
    const STATUS_UPDATED  = 'updated';
    const STATUS_FAILED   = 'failed';

    /**
     * Saves the to the data store
     *
     * This performs an intelligent insert/update and reloads the properties
     * with fresh data from the table on success.
     *
     * @return KModelEntityInterface
     */
    public function save();

    /**
     * Deletes the entity form the data store
     *
     * @return KModelEntityInterface
     */
    public function delete();

    /**
     * Resets to the entity to it's default properties
     *
     * @return KModelEntityInterface
     */
    public function reset();

    /**
     * Get the entity key
     *
     * @return string
     */
    public function getIdentityKey();

    /**
     * Get a property
     *
     * @param   string  $name The property name.
     * @return  mixed   The property value.
     */
    public function getProperty($name);

    /**
     * Set a property
     *
     * If the value is the same as the current value and the entity is loaded from the data store the value will not be
     * reset. If the entity is new the value will be (re)set and marked as modified
     *
     * @param   string  $name       The property name.
     * @param   mixed   $value      The property value.
     * @param   boolean $modified   If TRUE, update the modified information for the property
     *
     * @return  KModelEntityInterface
     */
    public function setProperty($name, $value, $modified = true);

    /**
     * Test existence of a property
     *
     * @param  string  $name The property name.
     * @return boolean
     */
    public function hasProperty($name);

    /**
     * Remove a property
     *
     * @param   string  $name The property name.
     * @return  KModelEntityInterface
     */
    public function removeProperty($name);

    /**
     * Get the properties
     *
     * @param   boolean  $modified If TRUE, only return the modified data.
     * @return  array   An associative array of entity properties
     */
    public function getProperties($modified = false);

    /**
     * Set the properties
     *
     * @param   mixed   $properties  Either and associative array, an object or a KModelEntityInterface
     * @param   boolean $modified    If TRUE, update the modified information for each column being set.
     * @return  KModelEntityInterface
     */
    public function setProperties($properties, $modified = true);

    /**
     * Get a list of the computed properties
     *
     * @return array An array
     */
    public function getComputedProperties();

    /**
     * Returns the status.
     *
     * @return string The status value.
     */
    public function getStatus();

    /**
     * Set the status
     *
     * @param   string|null $status The status value or NULL to reset the status
     * @return  KModelEntityInterface
     */
    public function setStatus($status);

    /**
     * Returns the status message
     *
     * @return string The status message
     */
    public function getStatusMessage();

    /**
     * Set the status message
     *
     * @param   string $message The status message
     * @return  KModelEntityInterface
     */
    public function setStatusMessage($message);

    /**
     * Checks if the entity is new or not
     *
     * @return bool
     */
    public function isNew();

    /**
     * Check if the entity or specific entity property has been modified.
     *
     * If a specific property name is giving method will return TRUE only if this property was modified.
     *
     * @param   string $property The property name
{'fraction_non_alphanumeric': 0.08986834573554665, 'fraction_numerical': 0.0024041213508872354, 'mean_word_length': 2.2141280353200883, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '6886075', 'n_tokens_mistral': 2406, 'n_tokens_neox': 2344, 'n_words': 847}