<commit_before><?php

namespace Droath\ProjectX\Task\Drupal;

use Boedah\Robo\Task\Drush\loadTasks as drushTasks;
use Droath\ProjectX\Database;
use Droath\ProjectX\Exception\TaskResultRuntimeException;
use Droath\ProjectX\ProjectX;
use Droath\ProjectX\Project\DrupalProjectType;
use Droath\ProjectX\Task\EventTaskBase;
use Droath\ProjectX\TaskResultTrait;
use Droath\RoboDockerCompose\Task\loadTasks as dockerComposeTasks;
use Robo\Task\Composer\loadTasks as composerTasks;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
 * Define Drupal specific tasks.
 */
class DrupalTasks extends EventTaskBase
{
    use drushTasks;
    use composerTasks;
    use TaskResultTrait;
    use dockerComposeTasks;

    /**
     * Install Drupal on the current environment.
     *
     * @param array $opts
     *
     * @option string $db-name Set the database name.
     * @option string $db-user Set the database user.
     * @option string $db-pass Set the database password.
     * @option string $db-host Set the database host.
     * @option string $db-port Set the database port.
     * @option string $db-protocol Set the database protocol.
     *
     * @return self
     * @throws \Exception
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function drupalInstall($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => null,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->getProjectInstance()
            ->setupDrupalInstall($this->buildDatabase($opts));
        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }

    /**
     * Setup local environment for already built projects.
     *
     * @param array $opts
     *
     * @option string $db-name Set the database name.
     * @option string $db-user Set the database user.
     * @option string $db-pass Set the database password.
     * @option string $db-host Set the database host.
     * @option string $db-port Set the database port.
     * @option string $db-protocol Set the database protocol.
     * @option bool $no-docker Don't use docker for local setup.
     * @option bool $no-engine Don't start local development engine.
     * @option bool $no-import Don't import Drupal configurations.
     * @option bool $no-browser Don't launch a browser window after setup is complete.
     * @option int $reimport-attempts The amount of times to retry config-import.
     *
     * @return self
     * @throws \Exception
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     * @throws \Robo\Exception\TaskException
     */
    public function drupalLocalSetup($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => <PASSWORD>,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
        'no-docker' => false,
        'no-engine' => false,
        'no-import' => false,
        'no-browser' => false,
        'reimport-attempts' => 1,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $database = $this->buildDatabase($opts);
        $instance = $this
            ->getProjectInstance()
            ->setupDrupalFilesystem()
            ->setupDrupalLocalSettings($database);

        if (!$opts['no-engine']) {
            $instance->projectEngineUp();
        }
        $instance->setupDrupalInstall($database);

        $this->drupalDrushAlias();
        $drush_stack = $this->getDrushStack();<commit_msg>#94: Fix missing projectEngineUp() method fatal PHP error in DrushTasks.php.<commit_after><?php

namespace Droath\ProjectX\Task\Drupal;

use Boedah\Robo\Task\Drush\loadTasks as drushTasks;
use Droath\ProjectX\Database;
use Droath\ProjectX\Exception\TaskResultRuntimeException;
use Droath\ProjectX\ProjectX;
use Droath\ProjectX\Project\DrupalProjectType;
use Droath\ProjectX\Task\EventTaskBase;
use Droath\ProjectX\TaskResultTrait;
use Droath\RoboDockerCompose\Task\loadTasks as dockerComposeTasks;
use Robo\Task\Composer\loadTasks as composerTasks;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
 * Define Drupal specific tasks.
 */
class DrupalTasks extends EventTaskBase
{
    use drushTasks;
    use composerTasks;
    use TaskResultTrait;
    use dockerComposeTasks;

    /**
     * Install Drupal on the current environment.
     *
     * @param array $opts
     *
     * @option string $db-name Set the database name.
     * @option string $db-user Set the database user.
     * @option string $db-pass Set the database password.
     * @option string $db-host Set the database host.
     * @option string $db-port Set the database port.
     * @option string $db-protocol Set the database protocol.
     *
     * @return self
     * @throws \Exception
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function drupalInstall($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => null,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->getProjectInstance()
            ->setupDrupalInstall($this->buildDatabase($opts));
        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }

    /**
     * Setup local environment for already built projects.
     *
     * @param array $opts
     *
     * @option string $db-name Set the database name.
     * @option string $db-user Set the database user.
     * @option string $db-pass Set the database password.
     * @option string $db-host Set the database host.
     * @option string $db-port Set the database port.
     * @option string $db-protocol Set the database protocol.
     * @option bool $no-docker Don't use docker for local setup.
     * @option bool $no-engine Don't start local development engine.
     * @option bool $no-import Don't import Drupal configurations.
     * @option bool $no-browser Don't launch a browser window after setup is complete.
     * @option int $reimport-attempts The amount of times to retry config-import.
     *
     * @return self
     * @throws \Exception
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     * @throws \Robo\Exception\TaskException
     */
    public function drupalLocalSetup($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => <PASSWORD>,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
        'no-docker' => false,
        'no-engine' => false,
        'no-import' => false,
        'no-browser' => false,
        'reimport-attempts' => 1,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $database = $this->buildDatabase($opts);

        /** @var DrupalProjectType $instance */
        $instance = $this
            ->getProjectInstance()
            ->setupDrupalFilesystem()
            ->setupDrupalLocalSettings($database);

        if (!$opts['no-engine']) {
            $instance->projectEnvironmentUp();
        }
        $instance->setupDrupalInstall($database);

        $this->drupalDrushAlias();
        $drush_stack = $this->getDrushStack();
{'fraction_non_alphanumeric': 0.11794737531090457, 'fraction_numerical': 0.0005236287472182222, 'mean_word_length': 2.6766121270452357, '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': '237086', 'n_tokens_mistral': 2222, 'n_tokens_neox': 2180, 'n_words': 567}