<commit_before><?php

namespace Admingenerator\GeneratorBundle\Generator;

use Sensio\Bundle\GeneratorBundle\Generator\Generator as BaseBundleGenerator;
use Symfony\Component\Filesystem\Filesystem;

/**
 * Generates an admin bundle.
 *
 * @author <NAME>
 */
class BundleGenerator extends BaseBundleGenerator
{
    private $filesystem;
    private $skeletonDir;

    protected $generator;

    protected $prefix;

    protected $actions = array(
        'New'  => array('views' => array(
            'index',
            'form',
        )),
        'List' => array('views' => array(
            'index',
            'results',
            'filters',
            'row'
        )),
        'Excel' => array('views' => array()),
        'Edit' => array('views' => array(
            'index',
            'form',
        )),
        'Show' => array('views' => array('index')),
        'Actions' => array('views' => array('index'))
    );

    protected $forms = array('New', 'Filters', 'Edit');

    /**
     * @param string $skeletonDir
     */
    public function __construct(Filesystem $filesystem, $skeletonDir)
    {
        $this->filesystem = $filesystem;
        $this->skeletonDir = $skeletonDir;
        if (method_exists($this, 'setSkeletonDirs')) {
            $this->setSkeletonDirs($this->skeletonDir);
        }
    }

    public function setGenerator($generator)
    {
        $this->generator = $generator;
    }

    public function setPrefix($prefix)
    {
        $this->prefix = $prefix;
    }

    /**
     * @param string $namespace
     * @param string $format
     */
    public function generate($namespace, $bundle, $dir, $format, $structure, $generator, $modelName)
    {
        $dir .= '/'.strtr($namespace, '\\', '/');

        // Retrieves model folder depending of chosen ORM
        $modelFolder = '';
        switch ($generator) {
            case 'propel':
                $modelFolder = 'Model';
                break;
            case 'doctrine':
                $modelFolder = 'Entity';
                break;
            case 'doctrine_orm':
                $modelFolder = 'Document';
                break;
        }

        list( $namespace_prefix, $bundle_name) = explode('\\', $namespace, 2);
        $parameters = array(
            'namespace'        => $namespace,
            'bundle'           => $bundle,
            'generator'        => 'admingenerator.generator.'.$this->generator,
            'namespace_prefix' => $namespace_prefix,
            'bundle_name'      => $bundle_name,
            'model_folder'     => $modelFolder,
            'model_name'       => $modelName,
            'prefix'           => ucfirst($this->prefix),
        );

        if (!file_exists($dir.'/'.$bundle.'.php')) {
            $this->renderGeneratedFile('Bundle.php.twig', $dir.'/'.$bundle.'.php', $parameters);
        }

        foreach ($this->actions as $action => $actionProperties) {<commit_msg>Update BundleGenerator.php<commit_after><?php

namespace Admingenerator\GeneratorBundle\Generator;

use Sensio\Bundle\GeneratorBundle\Generator\Generator as BaseBundleGenerator;
use Symfony\Component\Filesystem\Filesystem;

/**
 * Generates an admin bundle.
 *
 * @author <NAME>
 */
class BundleGenerator extends BaseBundleGenerator
{
    private $filesystem;
    private $skeletonDir;

    protected $generator;

    protected $prefix;

    protected $actions = array(
        'New'  => array('views' => array(
            'index',
            'form',
        )),
        'List' => array('views' => array(
            'index',
            'results',
            'filters',
            'row'
        )),
        'Excel' => array('views' => array()),
        'Edit' => array('views' => array(
            'index',
            'form',
        )),
        'Show' => array('views' => array('index')),
        'Actions' => array('views' => array('index'))
    );

    protected $forms = array('New', 'Filters', 'Edit');

    /**
     * @param string $skeletonDir
     */
    public function __construct(Filesystem $filesystem, $skeletonDir)
    {
        $this->filesystem = $filesystem;
        $this->skeletonDir = $skeletonDir;
        if (method_exists($this, 'setSkeletonDirs')) {
            $this->setSkeletonDirs($this->skeletonDir);
        }
    }

    public function setGenerator($generator)
    {
        $this->generator = $generator;
    }

    public function setPrefix($prefix)
    {
        $this->prefix = $prefix;
    }

    /**
     * @param string $namespace
     * @param string $format
     */
    public function generate($namespace, $bundle, $dir, $format, $structure, $generator, $modelName)
    {
        $dir .= '/'.strtr($namespace, '\\', '/');

        // Retrieves model folder depending of chosen ORM
        $modelFolder = '';
        switch ($generator) {
            case 'propel':
                $modelFolder = 'Model';
                break;
            case 'doctrine':
                $modelFolder = 'Entity';
                break;
            case 'doctrine_orm':
                $modelFolder = 'Document';
                break;
        }

        if (FALSE === strpos($namespace, '\\')) {
            $bundle_name = $namespace;
            $namespace_prefix = null;
        } else {
            list( $namespace_prefix, $bundle_name) = explode('\\', $namespace, 2);
        }

        $parameters = array(
            'namespace'        => $namespace,
            'bundle'           => $bundle,
            'generator'        => 'admingenerator.generator.'.$this->generator,
            'namespace_prefix' => $namespace_prefix,
            'bundle_name'      => $bundle_name,
            'model_folder'     => $modelFolder,
            'model_name'       => $modelName,
            'prefix'           => ucfirst($this->prefix),
        );

        if (!file_exists($dir.'/'.$bundle.'.php')) {
            $this->renderGeneratedFile('Bundle.php.twig', $dir.'/'.$bundle.'.php', $parameters);
        }

        foreach ($this->actions as $action => $actionProperties) {
{'fraction_non_alphanumeric': 0.15177093677590203, 'fraction_numerical': 0.00033101621979476995, 'mean_word_length': 1.8776190476190475, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, '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': '3369928', 'n_tokens_mistral': 1695, 'n_tokens_neox': 1648, 'n_words': 335}