<commit_before><?php
/*
 * This file is part of the Eduostia package.
 *
 * (c) Eduostia Corporation <http://eduostia.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cqrs\ReadModel\Repository;
use Cqrs\ReadModel\ReadModelInterface;
use Cqrs\ReadModel\Storage\ReadModelStorageInterface;

/**
 * @author      <NAME> <<EMAIL>>
 * @created     6/30/15
 */
abstract class ReadModelRepository implements ReadModelRepositoryInterface {

    protected $storage;
    protected $table;
    protected $class;

    /**
     * Initialize instance and bind storage
     *
     * @param ReadModelStorageInterface $storage
     * @param string                    $table
     * @param string                    $class
     */
    public function __construct(ReadModelStorageInterface $storage, $table, $class) {

        $this->storage = $storage;
    }

    /**
     * Persist read model to storage
     *
     * @param ReadModelInterface $model
     *
     * @author <NAME> <<EMAIL>>
     */
    public function save(ReadModelInterface $model) {

        return $this->storage->save($model, $this->table, $this->class);
    }

    /**
     * Find read model by id
     *
     * @param string $id<commit_msg>Update read model repository<commit_after><?php
/*
 * This file is part of the Eduostia package.
 *
 * (c) Eduostia Corporation <http://eduostia.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cqrs\ReadModel\Repository;
use Cqrs\ReadModel\ReadModelInterface;
use Cqrs\ReadModel\Storage\ReadModelStorageInterface;

/**
 * @author      <NAME> <<EMAIL>>
 * @created     6/30/15
 */
abstract class ReadModelRepository implements ReadModelRepositoryInterface {

    protected $storage;
    protected $table;
    protected $class;

    /**
     * Initialize instance and bind storage
     *
     * @param ReadModelStorageInterface $storage
     * @param string                    $table
     * @param string                    $class
     */
    public function __construct(ReadModelStorageInterface $storage, $table, $class) {

        $this->storage  = $storage;
        $this->table    = $table;
        $this->class    = $class;
    }

    /**
     * Persist read model to storage
     *
     * @param ReadModelInterface $model
     *
     * @author <NAME> <<EMAIL>>
     */
    public function save(ReadModelInterface $model) {

        return $this->storage->save($model, $this->table, $this->class);
    }

    /**
     * Find read model by id
     *
     * @param string $id
{'fraction_non_alphanumeric': 0.1092814371257485, 'fraction_numerical': 0.0037425149700598802, 'mean_word_length': 2.5217391304347827, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '3514078', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 212}