<commit_before><?php
/**
 * ZnZend
 *
 * @author <NAME> <<EMAIL>>
 * @link   http://github.com/zionsg/ZnZend for canonical source repository
 */

namespace ZnZend\Db;

use Zend\Paginator\Paginator;

/**
 * Interface for entity mappers corresponding to database tables
 */
interface MapperInterface
{
    /**
     * Check whether the mapper and its entity support row states (active, deleted, all)
     *
     * Ideally, no records should ever be deleted from the database and should have
     * a field to mark it as deleted instead - this is what row state refers to.
     *
     * @return bool
     */
    public function hasRowState();

    /**
     * Set row state
     *
     * Rows returned from query results will conform to the current specified row state
     *
     * @param  mixed $rowState Flags to indicate 1 of 3 states: active, deleted, all
     * @return MapperInterface
     */
    public function setRowState($rowState);

    /**
     * Mark records as active
     *
     * If an entity is passed in for $where, it is assumed that the
     * entity is to be marked as active. This is useful, eg. in the controller,
     * where the user does not and should not know the column name or how to
     * construct a where clause.
     *
     * @param  string|array|closure|EntityInterface $where
     * @return bool|int Return false if row state not supported
     */
    public function markActive($where);

    /**
     * Mark records as deleted
     *
     * If an entity is passed in for $where, it is assumed that the
     * entity is to be marked as deleted. This is useful, eg. in the controller,
     * where the user does not and should not know the column name or how to
     * construct a where clause.
     *
     * @param  string|array|closure|EntityInterface $where
     * @return bool|int Return false if row state not supported
     */
    public function markDeleted($where);

    /**
     * Fetch all rows
     *
     * @return Paginator
     */
    public function fetchAll();

    /**
     * Find row by primary key
     *
     * @param  mixed $key The value for the primary key
     * @return EntityInterface
     */
    public function find($key);
}
<commit_msg>Add ArraySerializableInterface<commit_after><?php
/**
 * ZnZend
 *
 * @author <NAME> <<EMAIL>>
 * @link   http://github.com/zionsg/ZnZend for canonical source repository
 */

namespace ZnZend\Db;

use Zend\Paginator\Paginator;
use Zend\Stdlib\ArraySerializableInterface;

/**
 * Interface for entity mappers corresponding to database tables
 *
 * The ArraySerializableInterface allows the populating of records for a mapper
 * from a non-database source, eg. a UserMapper which reads from a config file
 * containing an array of user records rather than querying a database.
 */
interface MapperInterface extends ArraySerializableInterface
{
    /**
     * Check whether the mapper and its entity support row states (active, deleted, all)
     *
     * Ideally, no records should ever be deleted from the database and should have
     * a field to mark it as deleted instead - this is what row state refers to.
     *
     * @return bool
     */
    public function hasRowState();

    /**
     * Set row state
     *
     * Rows returned from query results will conform to the current specified row state
     *
     * @param  mixed $rowState Flags to indicate 1 of 3 states: active, deleted, all
     * @return MapperInterface
     */
    public function setRowState($rowState);

    /**
     * Mark records as active
     *
     * If an entity is passed in for $where, it is assumed that the
     * entity is to be marked as active. This is useful, eg. in the controller,
     * where the user does not and should not know the column name or how to
     * construct a where clause.
     *
     * @param  string|array|closure|EntityInterface $where
     * @return bool|int Return false if row state not supported
     */
    public function markActive($where);

    /**
     * Mark records as deleted
     *
     * If an entity is passed in for $where, it is assumed that the
     * entity is to be marked as deleted. This is useful, eg. in the controller,
     * where the user does not and should not know the column name or how to
     * construct a where clause.
     *
     * @param  string|array|closure|EntityInterface $where
     * @return bool|int Return false if row state not supported
     */
    public function markDeleted($where);

    /**
     * Fetch all rows
     *
     * @return Paginator
     */
    public function fetchAll();

    /**
     * Find row by primary key
     *
     * @param  mixed $key The value for the primary key
     * @return EntityInterface
     */
    public function find($key);
}

{'fraction_non_alphanumeric': 0.07684165961049957, 'fraction_numerical': 0.000846740050804403, 'mean_word_length': 2.549962434259955, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '4648911', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1257, 'n_words': 563}