<commit_before><?php

namespace Application\Bundle\UserBundle\Command;

use Application\Bundle\UserBundle\Entity\User;
use Application\Bundle\UserBundle\Entity\UserTranslation;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * GenerateUserSlugCommand
 *
 * @author <NAME> <<EMAIL>>
 */
class GenerateUserSlugCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('stfalcon:user:generate:slug')
            ->setDescription('Generate slug for all users')
            ->setHelp("The <info>%command.name%</info> command generate slug for all users.");
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $em = $this->getContainer()->get('doctrine.orm.entity_manager');

        $userRepository = $em->getRepository('ApplicationUserBundle:User');
        $users          = $userRepository->findAll();

        /** @var User $user */
        foreach ($users as $user) {
            $isFirstnameExists = false;
            $isLastnameExists  = false;

            $slug = '';

            $translations = $user->getTranslations()->getValues();
            /** @var UserTranslation $translation */
            foreach ($translations as $translation) {
                if (
                    $translation->getLocale() == 'en'
                    && in_array($translation->getField(), ['firstname', 'lastname'])
                ) {
                    if ($translation->getField() == 'firstname') {
                        $isFirstnameExists = !empty($translation->getContent()) ? true : false;

                        $slug = $translation->getContent().'_'.$slug;
                    } else {
                        $isLastnameExists = !empty($translation->getContent()) ? true : false;

                        $slug = $slug.$translation->getContent();
                    }
                }
            }

            if ($isFirstnameExists && $isLastnameExists) {
                $user->setSlug($slug);

                $this->showResultMessage($output, ($isFirstnameExists && $isLastnameExists), $user, $slug);<commit_msg>Fix travis error<commit_after><?php

namespace Application\Bundle\UserBundle\Command;

use Application\Bundle\UserBundle\Entity\User;
use Application\Bundle\UserBundle\Entity\UserTranslation;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * GenerateUserSlugCommand
 *
 * @author <NAME> <<EMAIL>>
 */
class GenerateUserSlugCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('stfalcon:user:generate:slug')
            ->setDescription('Generate slug for all users')
            ->setHelp("The <info>%command.name%</info> command generate slug for all users.");
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $em = $this->getContainer()->get('doctrine.orm.entity_manager');

        $userRepository = $em->getRepository('ApplicationUserBundle:User');
        $users          = $userRepository->findAll();

        /** @var User $user */
        foreach ($users as $user) {
            $isFirstnameExists = false;
            $isLastnameExists  = false;

            $slug = '';

            $translations = $user->getTranslations()->getValues();
            /** @var UserTranslation $translation */
            foreach ($translations as $translation) {
                if ($translation->getLocale() == 'en'
                    && in_array($translation->getField(), ['firstname', 'lastname'])) {
                    $tanslationContent = $translation->getContent();

                    if ($translation->getField() == 'firstname') {
                        $isFirstnameExists = !empty($tanslationContent) ? true : false;

                        $slug = $tanslationContent.'_'.$slug;
                    } else {
                        $isLastnameExists = !empty($tanslationContent) ? true : false;

                        $slug = $slug.$tanslationContent;
                    }
                }
            }

            if ($isFirstnameExists && $isLastnameExists) {
                $user->setSlug($slug);

                $this->showResultMessage($output, ($isFirstnameExists && $isLastnameExists), $user, $slug);
{'fraction_non_alphanumeric': 0.131154780304703, 'fraction_numerical': 0.0, 'mean_word_length': 2.2449856733524354, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 46, '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': '4671029', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1137, 'n_words': 209}