<commit_before><?php

namespace Circle314\Data\Mediator\Database;

use Circle314\Concept\Persistence\PersistenceConstants;
use Circle314\Data\Operation\Call\Database\Native\NativeDatabaseCall;
use Circle314\Data\Accessor\Database\DatabaseAccessorInterface;
use Circle314\Data\Operation\OperationMediatorInterface;
use Circle314\Data\Operation\Response\Database\DatabaseResponseInterface;
use Circle314\Schema\Database\DatabaseTableSchemaInterface;

abstract class AbstractDatabaseMediator implements DatabaseMediatorInterface
{
    #region Properties
    /** @var DatabaseAccessorInterface */
    private $databaseAccessor;

    /** @var OperationMediatorInterface */
    private $operationMediator;
    #endregion

    #region Constructor
    /**
     * AbstractDatabaseMediator constructor.
     * @param DatabaseAccessorInterface $databaseAccessor
     * @param OperationMediatorInterface $operationMediator
     */
    final public function __construct(
        DatabaseAccessorInterface       $databaseAccessor,
        OperationMediatorInterface       $operationMediator
    ) {
        $this->databaseAccessor         = $databaseAccessor;
        $this->operationMediator        = $operationMediator;
    }
    #endregion

    #region Public Methods
    final public function clearTableCache()
    {
        $this->operationMediator()->clearAllResultsForAccessor($this->databaseAccessor());
    }

    /**
     * @param DatabaseTableSchemaInterface $databaseTableSchema
     * @return DatabaseResponseInterface
     */
    final public function delete($databaseTableSchema)
    {
        $call = $this->prepareDatabaseCall($databaseTableSchema, PersistenceConstants::WRITE);
        $call->setQuery($this->databaseAccessor()->generateDeleteQuery($databaseTableSchema));
        $this->operationMediator()->clearInvalidatedOperationResults($call);
        return $this->operationMediator()->getCallResponse($call);
    }

    /**
     * @param mixed $databaseTableSchema
     * @return DatabaseResponseInterface
     */
    final public function get($databaseTableSchema)
    {
        $call = $this->prepareDatabaseCall($databaseTableSchema, PersistenceConstants::READ);
        $call->setQuery($this->databaseAccessor()->generateSelectQuery($databaseTableSchema));
        return $this->operationMediator()->getCallResponse($call);
    }
<commit_msg>Added a new method AbstractDatabaseMediator::commitTransaction()<commit_after><?php

namespace Circle314\Data\Mediator\Database;

use Circle314\Concept\Persistence\PersistenceConstants;
use Circle314\Data\Operation\Call\Database\Native\NativeDatabaseCall;
use Circle314\Data\Accessor\Database\DatabaseAccessorInterface;
use Circle314\Data\Operation\OperationMediatorInterface;
use Circle314\Data\Operation\Response\Database\DatabaseResponseInterface;
use Circle314\Schema\Database\DatabaseTableSchemaInterface;

abstract class AbstractDatabaseMediator implements DatabaseMediatorInterface
{
    #region Properties
    /** @var DatabaseAccessorInterface */
    private $databaseAccessor;

    /** @var OperationMediatorInterface */
    private $operationMediator;
    #endregion

    #region Constructor
    /**
     * AbstractDatabaseMediator constructor.
     * @param DatabaseAccessorInterface $databaseAccessor
     * @param OperationMediatorInterface $operationMediator
     */
    final public function __construct(
        DatabaseAccessorInterface       $databaseAccessor,
        OperationMediatorInterface       $operationMediator
    ) {
        $this->databaseAccessor         = $databaseAccessor;
        $this->operationMediator        = $operationMediator;
    }
    #endregion

    #region Public Methods
    final public function clearTableCache()
    {
        $this->operationMediator()->clearAllResultsForAccessor($this->databaseAccessor());
    }

    /**
     * @return mixed
     */
    final public function commitTransaction()
    {
        return $this->databaseAccessor()->commitTransaction();
    }

    /**
     * @param DatabaseTableSchemaInterface $databaseTableSchema
     * @return DatabaseResponseInterface
     */
    final public function delete($databaseTableSchema)
    {
        $call = $this->prepareDatabaseCall($databaseTableSchema, PersistenceConstants::WRITE);
        $call->setQuery($this->databaseAccessor()->generateDeleteQuery($databaseTableSchema));
        $this->operationMediator()->clearInvalidatedOperationResults($call);
        return $this->operationMediator()->getCallResponse($call);
    }

    /**
     * @param mixed $databaseTableSchema
     * @return DatabaseResponseInterface
     */
    final public function get($databaseTableSchema)
    {
        $call = $this->prepareDatabaseCall($databaseTableSchema, PersistenceConstants::READ);
        $call->setQuery($this->databaseAccessor()->generateSelectQuery($databaseTableSchema));
        return $this->operationMediator()->getCallResponse($call);
    }

{'fraction_non_alphanumeric': 0.09886317498984978, 'fraction_numerical': 0.008526187576126675, 'mean_word_length': 4.063720452209661, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5451502', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1155, 'n_words': 198}