<commit_before><?php
 namespace PHPReview\AdminBundle\Command;

 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand as DoctrineCommand;

 class ExpiraChaveCommand extends ContainerAwareCommand
 {
     public function configure(){
        $this->setName('phpreview:admin:expira')
             ->setDescription('Comando para desabilitar chaves nao usadas.');
     }
     
     protected function execute(InputInterface $input, OutputInterface $output){
         $output->writeln('Iniciando a verificacao de chaves expiradas '. date('Y-m-d H:i:s'));
         
         $em = $this->getContainer()->get('doctrine')->getEntityManager();
         $qb = $em->createQueryBuilder();
         
         $qb->select('c');
         $qb->from('AdminBundle:Chave','c');
         $qb->where('c.data_expira < :data_expira and c.in_usado = 0 and c.in_expirado = 0');
         $qb->setParameter('data_expira',date('Y-m-d H:i:s'));
         
         $chaves = $qb->getQuery()->getResult();
         
         $output->writeln('Total de chaves encontradas: '. count($chaves));

         for($i = 0; $i < count($chaves);$i++){
            $chaves[$i]->setInExpirado(true);
         }
         
         $em->flush();
         
         $output->writeln('Fim da verificacao de chaves expiradas');
     }
 }
?>
<commit_msg>#49 - Atualizacao do sistema de log do comando<commit_after><?php
 namespace PHPReview\AdminBundle\Command;

 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand as DoctrineCommand;

 class ExpiraChaveCommand extends ContainerAwareCommand
 {
     public function configure(){
        $this->setName('phpreview:admin:expira')
             ->setDescription('Comando para desabilitar chaves nao usadas.');
     }
     
     protected function execute(InputInterface $input, OutputInterface $output){
         $output->writeln(date('[d/m/Y H:i:s] ').'Iniciando a verificacao de chaves expiradas ');
         
         $em = $this->getContainer()->get('doctrine')->getEntityManager();
         $qb = $em->createQueryBuilder();
         
         $qb->select('c');
         $qb->from('AdminBundle:Chave','c');
         $qb->where('c.data_expira < :data_expira and c.in_usado = 0 and c.in_expirado = 0');
         $qb->setParameter('data_expira',date('Y-m-d H:i:s'));
         
         $chaves = $qb->getQuery()->getResult();
         
         $output->writeln(date('[d/m/Y H:i:s] ').'Total de chaves encontradas: '. count($chaves));

         for($i = 0; $i < count($chaves);$i++){
            $chaves[$i]->setInExpirado(true);
         }
         
         $em->flush();
         
         $output->writeln(date('[d/m/Y H:i:s] ').'Fim da verificacao de chaves expiradas');
         $output->writeln('-----------/>');
     }
 }
?>

{'fraction_non_alphanumeric': 0.15483265561463871, 'fraction_numerical': 0.0025023459493274947, 'mean_word_length': 2.8763636363636365, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 41, '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': '6812900', 'n_tokens_mistral': 1004, 'n_tokens_neox': 996, 'n_words': 168}