<commit_before><?php
/**
 * DTOx
 *
 * @copyright   Copyright (c) 2012, <NAME> (<EMAIL>)
 * @license     http://opensource.org/licenses/MIT
 * @author      <NAME> <<EMAIL>>
 */

namespace DTOx\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use DTOx\Generator\DTO;
use DTOx\TestGenerator\DTOUnit;

/**
 * @package    DTOx\TestGenerator
 */
class DtoxCommand extends Command
{
    protected function configure()
    {
        $this->setName('react')
            ->setDescription('Start a new code reaction.')
            ->addArgument(
                'type',
                InputArgument::REQUIRED,
                'What do you want to react?'
            )
            ->addArgument(
                'fqcn',
                InputArgument::REQUIRED,
                'Specify the fully qualified class name!'
            )
            ->addArgument(
                'variables',
                InputArgument::IS_ARRAY,
                'Specify your variables!'
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dialog = $this->getHelperSet()->get('dialog');
        $type = $input->getArgument('type');
        if (in_array(strtolower($type), array('dto','dto-unit'))) {
            $className = $this->getClassName($input->getArgument('fqcn'));
            $path = $this->getPath($input->getArgument('fqcn'));
            $output->writeln("Creating a new $type called $className in $path...");
            $text = $this->react(strtolower($type), $input->getArgument('fqcn'), $input->getArgument('variables'));
            $output->writeln($text);
        } else {
            throw new \RuntimeException('A formula for that reaction is not found!');
        }
    }

    private function getClassName($fqcn)
    {
        return array_pop(explode('\\', $fqcn));
    }

    private function getNameSpace($fqcn)
    {
        return implode('\\', array_slice(explode('\\', $fqcn), 0, count(explode('\\', $fqcn))-1));
    }

    private function getPath($fqcn)
    {
        return implode('/', array_slice(explode('\\', $fqcn), 0, count(explode('\\', $fqcn))-1));<commit_msg>Fixing a php warning: Only variables should be passed by reference.<commit_after><?php
/**
 * DTOx
 *
 * @copyright   Copyright (c) 2012, <NAME> (<EMAIL>)
 * @license     http://opensource.org/licenses/MIT
 * @author      <NAME> <<EMAIL>>
 */

namespace DTOx\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use DTOx\Generator\DTO;
use DTOx\TestGenerator\DTOUnit;

/**
 * @package    DTOx\TestGenerator
 */
class DtoxCommand extends Command
{
    protected function configure()
    {
        $this->setName('react')
            ->setDescription('Start a new code reaction.')
            ->addArgument(
                'type',
                InputArgument::REQUIRED,
                'What do you want to react?'
            )
            ->addArgument(
                'fqcn',
                InputArgument::REQUIRED,
                'Specify the fully qualified class name!'
            )
            ->addArgument(
                'variables',
                InputArgument::IS_ARRAY,
                'Specify your variables!'
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dialog = $this->getHelperSet()->get('dialog');
        $type = $input->getArgument('type');
        if (in_array(strtolower($type), array('dto','dto-unit'))) {
            $className = $this->getClassName($input->getArgument('fqcn'));
            $path = $this->getPath($input->getArgument('fqcn'));
            $output->writeln("Creating a new $type called $className in $path...");
            $text = $this->react(strtolower($type), $input->getArgument('fqcn'), $input->getArgument('variables'));
            $output->writeln($text);
        } else {
            throw new \RuntimeException('A formula for that reaction is not found!');
        }
    }

    private function getClassName($fqcn)
    {
        $exploded = explode('\\', $fqcn);
        return array_pop($exploded);
    }

    private function getNameSpace($fqcn)
    {
        return implode('\\', array_slice(explode('\\', $fqcn), 0, count(explode('\\', $fqcn))-1));
    }

    private function getPath($fqcn)
    {
        return implode('/', array_slice(explode('\\', $fqcn), 0, count(explode('\\', $fqcn))-1));
{'fraction_non_alphanumeric': 0.15176151761517614, 'fraction_numerical': 0.003335417969564311, 'mean_word_length': 2.3908127208480567, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 47, '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': '6253204', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1380, 'n_words': 281}