<commit_before><?php
namespace RcmDoctrineJsonPluginStorage\Repo;

use Doctrine\ORM\EntityManager;
use RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig;

class DoctrineJsonRepo implements PluginStorageRepoInterface
{
    /**
     * @var \Doctrine\ORM\EntityManager entity manager
     */
    protected $entityMgr;

    public function __construct(EntityManager $entityMgr)
    {
        $this->entityMgr = $entityMgr;
    }

    /**
     * @param $instanceId
     * @return array
     */
    public function select($instanceId)
    {
        /**
         * @var \RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig
         */
        $entity = $this->selectEntity($instanceId);
        if (!is_object($entity)) {
            return array();
        }
        return $entity->getConfig();
    }

    /**
     * @param $instanceId
     * @param $configData
     */
    public function insert($instanceId, $configData)
    {
        $entity = new DoctrineJsonInstanceConfig();
        $entity->setInstanceId($instanceId);
        $entity->setConfig($configData);
        $this->entityMgr->persist($entity);
        $this->entityMgr->flush($entity);
    }

    /**
     * @param $instanceId
     */
    public function delete($instanceId)
    {
        $entity = $this->selectEntity($instanceId);
        if (is_object($entity)) {
            $this->entityMgr->remove($entity);
            $this->entityMgr->flush();
        }
    }

    /*
     *
     */
    public function selectEntity($instanceId)
    {
        $instanceConfig = $this->entityMgr
            ->getRepository('RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig')
            ->findOneByInstanceId($instanceId);
        return $instanceConfig;
    }<commit_msg>fix doc block<commit_after><?php
namespace RcmDoctrineJsonPluginStorage\Repo;

use Doctrine\ORM\EntityManager;
use RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig;

class DoctrineJsonRepo implements PluginStorageRepoInterface
{
    /**
     * @var \Doctrine\ORM\EntityManager entity manager
     */
    protected $entityMgr;

    public function __construct(EntityManager $entityMgr)
    {
        $this->entityMgr = $entityMgr;
    }

    /**
     * @param $instanceId
     * @return array
     */
    public function select($instanceId)
    {
        /**
         * @var \RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig
         */
        $entity = $this->selectEntity($instanceId);
        if (!is_object($entity)) {
            return array();
        }
        return $entity->getConfig();
    }

    /**
     * @param $instanceId
     * @param $configData
     */
    public function insert($instanceId, $configData)
    {
        $entity = new DoctrineJsonInstanceConfig();
        $entity->setInstanceId($instanceId);
        $entity->setConfig($configData);
        $this->entityMgr->persist($entity);
        $this->entityMgr->flush($entity);
    }

    /**
     * @param $instanceId
     */
    public function delete($instanceId)
    {
        $entity = $this->selectEntity($instanceId);
        if (is_object($entity)) {
            $this->entityMgr->remove($entity);
            $this->entityMgr->flush();
        }
    }

    /**
     * @param $instanceId
     * @return mixed
     */
    public function selectEntity($instanceId)
    {
        $instanceConfig = $this->entityMgr
            ->getRepository('RcmDoctrineJsonPluginStorage\Entity\DoctrineJsonInstanceConfig')
            ->findOneByInstanceId($instanceId);
        return $instanceConfig;
    }
{'fraction_non_alphanumeric': 0.12468478565424489, 'fraction_numerical': 0.0, 'mean_word_length': 2.4359961501443697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '1797614', 'n_tokens_mistral': 994, 'n_tokens_neox': 1006, 'n_words': 156}