<commit_before><?php
namespace CRM\CivixBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
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 CRM\CivixBundle\Builder\Collection;
use CRM\CivixBundle\Builder\CopyClass;
use CRM\CivixBundle\Builder\CopyFile;
use CRM\CivixBundle\Builder\Dirs;
use CRM\CivixBundle\Builder\Info;
use CRM\CivixBundle\Builder\Module;
use CRM\CivixBundle\Builder\Template;
use CRM\CivixBundle\Utils\Path;

class InitReportCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('generate:report-ext')
            ->setDescription('Create a new CiviCRM Report-Extension')
            ->addArgument('fullName', InputArgument::REQUIRED, 'Qualified extension name (e.g. "com.example.myextension")')
            ->addArgument('component', InputArgument::REQUIRED, 'A component (CiviGrant, CiviCase, etc)')
            ->addOption('webPath', null, InputOption::VALUE_OPTIONAL, 'The path which maps to this report (eg "civicrm/report/x")')
            ->addOption('copy', null, InputOption::VALUE_OPTIONAL, 'The class name of an existing report which should be copied')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $ctx = array();
        $ctx['type'] = 'report';
        $ctx['typeInfo'] = array();
        $ctx['fullName'] = $input->getArgument('fullName');
        $ctx['basedir'] = $ctx['fullName'];
        $ctx['reportClassName'] = preg_replace(':\.:','_',$ctx['fullName']);
        if (preg_match('/^[a-z0-9\.]+\.([a-z0-9]+)$/', $ctx['fullName'], $matches)) {
            $ctx['mainFile'] = $matches[1];
        } else {
            $output->writeln('<error>Malformed package name</error>');
            return;
        }

        if (in_array($input->getArgument('component'), $this->getReportComponents())) {
            $ctx['typeInfo']['component'] = $input->getArgument('component');
        } else {
            throw new \Exception("Component must be one of: " . implode(', ', $this->getReportComponents()));
        }

        if (preg_match('/^civicrm\/report\/(.*)$/', $input->getOption('webPath'), $matches)) {<commit_msg>Tweak "generate:report-ext" help text (#10)<commit_after><?php
namespace CRM\CivixBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
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 CRM\CivixBundle\Builder\Collection;
use CRM\CivixBundle\Builder\CopyClass;
use CRM\CivixBundle\Builder\CopyFile;
use CRM\CivixBundle\Builder\Dirs;
use CRM\CivixBundle\Builder\Info;
use CRM\CivixBundle\Builder\Module;
use CRM\CivixBundle\Builder\Template;
use CRM\CivixBundle\Utils\Path;

class InitReportCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('generate:report-ext')
            ->setDescription('Create a new CiviCRM Report-Extension')
            ->addArgument('<full.ext.name>', InputArgument::REQUIRED, 'Qualified extension name (e.g. "com.example.myextension")')
            ->addArgument('<CiviComponent>', InputArgument::REQUIRED, 'A component (CiviGrant, CiviCase, etc)')
            ->addOption('webPath', null, InputOption::VALUE_OPTIONAL, 'The path which maps to this report (eg "civicrm/report/x")')
            ->addOption('copy', null, InputOption::VALUE_OPTIONAL, 'The class name of an existing report which should be copied')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $ctx = array();
        $ctx['type'] = 'report';
        $ctx['typeInfo'] = array();
        $ctx['fullName'] = $input->getArgument('<full.ext.name>');
        $ctx['basedir'] = $ctx['fullName'];
        $ctx['reportClassName'] = preg_replace(':\.:','_',$ctx['fullName']);
        if (preg_match('/^[a-z0-9\.]+\.([a-z0-9]+)$/', $ctx['fullName'], $matches)) {
            $ctx['mainFile'] = $matches[1];
        } else {
            $output->writeln('<error>Malformed package name</error>');
            return;
        }

        if (in_array($input->getArgument('<CiviComponent>'), $this->getReportComponents())) {
            $ctx['typeInfo']['component'] = $input->getArgument('<CiviComponent>');
        } else {
            throw new \Exception("Component must be one of: " . implode(', ', $this->getReportComponents()));
        }

        if (preg_match('/^civicrm\/report\/(.*)$/', $input->getOption('webPath'), $matches)) {
{'fraction_non_alphanumeric': 0.16361746361746363, 'fraction_numerical': 0.002494802494802495, 'mean_word_length': 3.57319391634981, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 38, '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': '6640405', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1417, 'n_words': 266}