<commit_before><?php

namespace Platformsh\Cli\Service;

use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Ssh implements InputConfiguringInterface
{
    protected $input;
    protected $output;

    public function __construct(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
    }

    /**
     * @param \Symfony\Component\Console\Input\InputDefinition $definition
     */
    public static function configureInput(InputDefinition $definition)
    {
        $definition->addOption(
            new InputOption('identity-file', 'i', InputOption::VALUE_REQUIRED, 'An SSH identity (private key) to use')
        );
    }

    /**
     * @param array $extraOptions
     *
     * @return array
     */
    public function getSshArgs(array $extraOptions = [])
    {
        $options = array_merge($this->getSshOptions(), $extraOptions);

        $args = [];
        if ($this->output->isDebug()) {
            $args[] = '-vv';
        } elseif ($this->output->isVeryVerbose()) {
            $args[] = '-v';
        } elseif ($this->output->isQuiet()) {
            $args[] = '-q';
        }

        foreach ($options as $option) {
            $args[] = '-o';
            $args[] = $option;
        }

        return $args;
    }

    /**
     * Returns an array of SSH options, based on the input options.
     *<commit_msg>Use pseudo-terminal for SSH<commit_after><?php

namespace Platformsh\Cli\Service;

use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Ssh implements InputConfiguringInterface
{
    protected $input;
    protected $output;

    public function __construct(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
    }

    /**
     * @param \Symfony\Component\Console\Input\InputDefinition $definition
     */
    public static function configureInput(InputDefinition $definition)
    {
        $definition->addOption(
            new InputOption('identity-file', 'i', InputOption::VALUE_REQUIRED, 'An SSH identity (private key) to use')
        );
    }

    /**
     * @param array $extraOptions
     *
     * @return array
     */
    public function getSshArgs(array $extraOptions = [])
    {
        $options = array_merge($this->getSshOptions(), $extraOptions);

        $args = [];
        if ($this->output->isDebug()) {
            $args[] = '-vv';
        } elseif ($this->output->isVeryVerbose()) {
            $args[] = '-v';
        } elseif ($this->output->isQuiet()) {
            $args[] = '-q';
        }

        if ($this->output->isDecorated()) {
            $args[] = '-t';
            if (!$this->output->isVerbose()) {
                $options[] = 'LogLevel Quiet';
            }
        }

        foreach ($options as $option) {
            $args[] = '-o';
            $args[] = $option;
        }

        return $args;
    }

    /**
     * Returns an array of SSH options, based on the input options.
     *
{'fraction_non_alphanumeric': 0.14087481146304676, 'fraction_numerical': 0.0, 'mean_word_length': 2.2766798418972334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2315310', 'n_tokens_mistral': 951, 'n_tokens_neox': 935, 'n_words': 202}