<commit_before><?php

namespace Fansible\DevopsBundle\Generator\Ansible\Roles;

use Fansible\DevopsBundle\Config\ServicesConfig;
use Fansible\DevopsBundle\Generator\Helper\GeneratorInterface;

class MysqlGenerator implements GeneratorInterface
{
    /**
     * @var \Fansible\DevopsBundle\Generator\Helper\TwigHelper
     */
    private $twigHelper;

    /**
     * @var ServicesConfig
     */
    private $servicesConfig;

    /**
     * @var \Fansible\DevopsBundle\Config\DatabaseConfig
     */
    private $databaseConfig;

    /**
     * @param \Fansible\DevopsBundle\Generator\Helper\TwigHelper $twigHelper
     * @param ServicesConfig                                     $servicesConfig
     * @param \Fansible\DevopsBundle\Config\DatabaseConfig       $databaseConfig
     */
    public function __construct($twigHelper, $servicesConfig, $databaseConfig)
    {
        $this->twigHelper = $twigHelper;
        $this->servicesConfig = $servicesConfig;
        $this->databaseConfig = $databaseConfig;
    }

    /**
     * @inheritdoc
     */
    public function generate()
    {
        if ($this->servicesConfig->isPresent(ServicesConfig::ANSIBLE)
            && $this->servicesConfig->isPresent(ServicesConfig::MYSQL)
        ) {
            $this->twigHelper->renderProvisioningFile(
                'vars/mysql.yml',
                'Ansible/Roles:mysql.yml.twig',
                [
                    'database' => $this->databaseConfig,
                ]
            );
        }
    }
}
<commit_msg>Refactoring mysql generator<commit_after><?php

namespace Fansible\DevopsBundle\Generator\Ansible\Roles;

use Fansible\DevopsBundle\Config\ServicesConfig;
use Fansible\DevopsBundle\Generator\Helper\AnsibleRoleHelper;

class MysqlGenerator extends AnsibleRoleHelper
{
    /**
     * @var \Fansible\DevopsBundle\Config\DatabaseConfig
     */
    private $databaseConfig;

    /**
     * @param \Fansible\DevopsBundle\Generator\Helper\TwigHelper $twigHelper
     * @param ServicesConfig                                     $servicesConfig
     * @param \Fansible\DevopsBundle\Config\DatabaseConfig       $databaseConfig
     */
    public function __construct($twigHelper, $servicesConfig, $databaseConfig)
    {
        parent::__construct($twigHelper, $servicesConfig);
        $this->databaseConfig = $databaseConfig;
    }

    /**
     * @inheritdoc
     */
    public function getService()
    {
        return ServicesConfig::MYSQL;
    }

    /**
     * @inheritdoc
     */
    public function getParameters()
    {
        return [
            'database' => $this->databaseConfig,
        ];
    }
}

{'fraction_non_alphanumeric': 0.10996563573883161, 'fraction_numerical': 0.0, 'mean_word_length': 2.3122629582806575, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2481831', 'n_tokens_mistral': 753, 'n_tokens_neox': 727, 'n_words': 103}