<commit_before><?php


namespace rmatil\CmsBundle\DataAccessor;


use Doctrine\DBAL\DBALException;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use rmatil\CmsBundle\Exception\EntityInvalidException;
use rmatil\CmsBundle\Exception\EntityNotFoundException;
use rmatil\CmsBundle\Exception\EntityNotInsertedException;
use rmatil\CmsBundle\Exception\EntityNotUpdatedException;
use Symfony\Component\Security\Acl\Dbal\AclProvider;
use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;

/**
 * A base data accessor allowing modified access to the repositories
 */
class DataAccessor implements DataAccessorInterface {

    /**
     * @var \Doctrine\ORM\EntityManager
     */
    protected $em;

    /**
     * @var \Psr\Log\LoggerInterface
     */
    protected $logger;

    /**
     * @var string
     */
    protected $entityName;

    /**
     * @var AclProvider
     */
    protected $aclProvider;

    /**
     * Creates a new data accessor for the given entity
     *
     * @param $entityName  string The bundle's qualifier for the entity (e.g. Bundle:Entity)
     * @param $em          EntityManagerInterface The entity manager to access the db
     * @param $aclProvider MutableAclProviderInterface The ACL Provider used to set permissions to objects
     * @param $logger      LoggerInterface The logger
     */
    public function __construct($entityName, EntityManagerInterface $em, MutableAclProviderInterface $aclProvider, LoggerInterface $logger) {
        $this->entityName = $entityName;
        $this->em = $em;
        $this->aclProvider = $aclProvider;
        $this->logger = $logger;
    }
<commit_msg>Add token Storage to DataAccessor<commit_after><?php


namespace rmatil\CmsBundle\DataAccessor;


use Doctrine\DBAL\DBALException;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use rmatil\CmsBundle\Exception\EntityInvalidException;
use rmatil\CmsBundle\Exception\EntityNotFoundException;
use rmatil\CmsBundle\Exception\EntityNotInsertedException;
use rmatil\CmsBundle\Exception\EntityNotUpdatedException;
use Symfony\Component\Security\Acl\Dbal\AclProvider;
use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

/**
 * A base data accessor allowing modified access to the repositories
 */
class DataAccessor implements DataAccessorInterface {

    /**
     * @var \Doctrine\ORM\EntityManager
     */
    protected $em;

    /**
     * @var \Psr\Log\LoggerInterface
     */
    protected $logger;

    /**
     * @var string
     */
    protected $entityName;

    /**
     * @var AclProvider
     */
    protected $aclProvider;

    /**
     * @var TokenStorageInterface
     */
    protected $tokenStorage;

    /**
     * Creates a new data accessor for the given entity
     *
     * @param $entityName  string The bundle's qualifier for the entity (e.g. Bundle:Entity)
     * @param $em          EntityManagerInterface The entity manager to access the db
     * @param $aclProvider MutableAclProviderInterface The ACL Provider used to set permissions to objects
     * @param $logger      LoggerInterface The logger
     */
    public function __construct($entityName, EntityManagerInterface $em, MutableAclProviderInterface $aclProvider, TokenStorageInterface $tokenStorage, LoggerInterface $logger) {
        $this->entityName = $entityName;
        $this->em = $em;
        $this->aclProvider = $aclProvider;
        $this->tokenStorage = $tokenStorage;
        $this->logger = $logger;
    }

{'fraction_non_alphanumeric': 0.09280936454849498, 'fraction_numerical': 0.0, 'mean_word_length': 3.4308641975308642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '3220625', 'n_tokens_mistral': 1020, 'n_tokens_neox': 992, 'n_words': 244}