<commit_before><?php
/**
 * This is the base class for log common listener
 *
 * @author <NAME>
 */

namespace HealthCareAbroad\LogBundle\Listener;

use HealthCareAbroad\LogBundle\Services\LogService;

use Symfony\Component\DependencyInjection\ContainerInterface;

use Doctrine\Bundle\DoctrineBundle\Registry;

abstract class BaseCommonListener
{
    /**
     * @var Registry
     */
    protected $doctrine;
    
    /**
     * @var ContainerInterface
     */
    protected $container;
    
    /**
     * @var integer
     */
    protected $loggedAccountId;
    
    /**
     * @var LogService
     */
    protected $logService;
    
    /**
     * @var array
     */
    private static $logClassMap;
    
    
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
        
        $this->doctrine = $this->container->get('doctrine');
        
        $this->logService = $this->container->get('services.log');
        
        // set logged account id
        $securityContext = $this->container->get('security.context', ContainerInterface::NULL_ON_INVALID_REFERENCE);
        if (null != $securityContext && null != $securityContext->getToken()) {
            $this->loggedAccountId = $this->container->get('session')->get('accountId', null);
        }
    }
    
    /**
     * Convenience function to get the log action type based on the event name
     * 
     * @param string $eventName
     */
    protected function getLogActionOfEventName($eventName)
    {
        // by convention event name should be informat event.entity.action
        $parts = preg_split('/\./', $eventName, -1, \PREG_SPLIT_NO_EMPTY);
        
        return $parts[\count($parts)-1];
    }
}<commit_msg>set default logged account id for logs<commit_after><?php
/**
 * This is the base class for log common listener
 *
 * @author <NAME>
 */

namespace HealthCareAbroad\LogBundle\Listener;

use HealthCareAbroad\LogBundle\Services\LogService;

use Symfony\Component\DependencyInjection\ContainerInterface;

use Doctrine\Bundle\DoctrineBundle\Registry;

abstract class BaseCommonListener
{
    /**
     * @var Registry
     */
    protected $doctrine;
    
    /**
     * @var ContainerInterface
     */
    protected $container;
    
    /**
     * @var integer
     */
    protected $loggedAccountId;
    
    /**
     * @var LogService
     */
    protected $logService;
    
    /**
     * @var array
     */
    private static $logClassMap;
    
    
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
        
        $this->doctrine = $this->container->get('doctrine');
        
        $this->logService = $this->container->get('services.log');
        
        // set logged account id
        $securityContext = $this->container->get('security.context', ContainerInterface::NULL_ON_INVALID_REFERENCE);
        if (null != $securityContext && null != $securityContext->getToken()) {
            $this->loggedAccountId = $this->container->get('session')->get('accountId', null);
        }
        else {
            $this->loggedAccountId = 0;
        }
    }
    
    /**
     * Convenience function to get the log action type based on the event name
     * 
     * @param string $eventName
     */
    protected function getLogActionOfEventName($eventName)
    {
        // by convention event name should be informat event.entity.action
        $parts = preg_split('/\./', $eventName, -1, \PREG_SPLIT_NO_EMPTY);
        
        return $parts[\count($parts)-1];
    }
}
{'fraction_non_alphanumeric': 0.12402015677491601, 'fraction_numerical': 0.0013997760358342665, 'mean_word_length': 2.351782363977486, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 34, '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': '7248677', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1008, 'n_words': 215}