<commit_before><?php

namespace CommerceGuys\Platform\Cli\Local\Toolstack;

class Symfony extends ToolstackBase
{

    public function getKey() {
        return 'php:symfony';
    }

    public function detect($appRoot)
    {
        if (file_exists($appRoot . '/composer.json')) {
            $json = file_get_contents($appRoot . '/composer.json');
            $composer_json = json_decode($json);
            if (property_exists($composer_json->require, "symfony/symfony")) {
              return TRUE; // @todo: Find a better way to test for Symfony. Some projects do not have this dep.
            }
        }
        
        return FALSE;
    }

    public function build()
    {
        $buildDir = $this->buildDir;

        if (!file_exists($this->appRoot . '/composer.json')) {
            throw new \Exception("Couldn't find a composer.json in the directory.");
        }

        mkdir($buildDir);
        $this->fsHelper->copy($this->appRoot, $buildDir);
        if (is_dir($buildDir)) {
            $args = array('composer', 'install', '--no-progress', '--no-interaction', '--working-dir', $buildDir);
            $this->shellHelper->execute($args, $buildDir, true, false);
        }
        else {
            throw new \Exception("Couldn't create build directory");
        }

        $this->symLinkSpecialDestinations();
    }

    public function install()
    {
        $buildDir = $this->buildDir;

        // The build has been done, create a config_dev.yml if it is missing.
        if (is_dir($buildDir) && file_exists($buildDir . '/app/config')) {
            if (!file_exists($buildDir . '/app/config/config_dev.yml')) {
                // Create the config_dev.yml file.
                copy(CLI_ROOT . '/resources/symfony/config_dev.yml', $buildDir . '/app/config/');
            }
            if (!file_exists($buildDir . '/app/config/routing_dev.yml')) {
                // Create the routing_dev.yml file.
                copy(CLI_ROOT . '/resources/symfony/routing_dev.yml', $buildDir . '/app/config/');
            }
        }

        $this->symLinkSpecialDestinations();

        // Point www to the latest build.
        $this->fsHelper->symLink($buildDir, $this->projectRoot . '/www');<commit_msg>Remove double symlink call in symfony toolstack<commit_after><?php

namespace CommerceGuys\Platform\Cli\Local\Toolstack;

class Symfony extends ToolstackBase
{

    public function getKey() {
        return 'php:symfony';
    }

    public function detect($appRoot)
    {
        if (file_exists($appRoot . '/composer.json')) {
            $json = file_get_contents($appRoot . '/composer.json');
            $composer_json = json_decode($json);
            if (property_exists($composer_json->require, "symfony/symfony")) {
              return TRUE; // @todo: Find a better way to test for Symfony. Some projects do not have this dep.
            }
        }
        
        return FALSE;
    }

    public function build()
    {
        $buildDir = $this->buildDir;

        if (!file_exists($this->appRoot . '/composer.json')) {
            throw new \Exception("Couldn't find a composer.json in the directory.");
        }

        mkdir($buildDir);
        $this->fsHelper->copy($this->appRoot, $buildDir);
        if (is_dir($buildDir)) {
            $args = array('composer', 'install', '--no-progress', '--no-interaction', '--working-dir', $buildDir);
            $this->shellHelper->execute($args, $buildDir, true, false);
        }
        else {
            throw new \Exception("Couldn't create build directory");
        }

        $this->symLinkSpecialDestinations();
    }

    public function install()
    {
        $buildDir = $this->buildDir;

        // The build has been done, create a config_dev.yml if it is missing.
        if (is_dir($buildDir) && file_exists($buildDir . '/app/config')) {
            if (!file_exists($buildDir . '/app/config/config_dev.yml')) {
                // Create the config_dev.yml file.
                copy(CLI_ROOT . '/resources/symfony/config_dev.yml', $buildDir . '/app/config/');
            }
            if (!file_exists($buildDir . '/app/config/routing_dev.yml')) {
                // Create the routing_dev.yml file.
                copy(CLI_ROOT . '/resources/symfony/routing_dev.yml', $buildDir . '/app/config/');
            }
        }

        // Point www to the latest build.
        $this->fsHelper->symLink($buildDir, $this->projectRoot . '/www');
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.062585969738652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1859526', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1273, 'n_words': 284}