<commit_before><?php
namespace Jeancsil\FlightSpy\Command;

use Jeancsil\FlightSpy\Command\Entity\Parameter;
use Jeancsil\FlightSpy\Facade\MultiDealFacade;
use Jeancsil\FlightSpy\Facade\SingleDealFacade;
use Jeancsil\FlightSpy\Validator\ValidatorInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * @author <NAME> <<EMAIL>>
 * @license MIT
 */
class SkyscannerCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('flightspy:skyscanner:live_prices')
            ->setDescription('Look for live prices in Skyscanner for the determined filters')
            ->addOption(
                Parameter::FILE,
                null,
                InputOption::VALUE_OPTIONAL,
                'Load all your trips watcher from a config file (JSON)'
            )

            ->addOption(
                Parameter::FROM,
                null,
                InputOption::VALUE_OPTIONAL,
                'Starting point of your trip.'
            )

            ->addOption(
                Parameter::TO,
                null,
                InputOption::VALUE_OPTIONAL,
                'Your destiny.'
            )

            ->addOption(
                Parameter::DEPARTURE_DATE,
                null,
                InputOption::VALUE_OPTIONAL,
                'The departure date (dd-mm-yyyy).'
            )

            ->addOption(
                Parameter::RETURN_DATE,
                null,
                InputOption::VALUE_OPTIONAL,
                'The return date (dd-mm-yyyy).'
            )

            ->addOption(
                Parameter::MAX_PRICE,
                null,
                InputOption::VALUE_OPTIONAL,
                'Maximum price to consider as a good deal (1500).'
            )

            ->addOption(
                Parameter::API_KEY,
                null,
                InputOption::VALUE_OPTIONAL,
                'The Skyscanner API key.'
            )

            ->addOption(
                Parameter::LOCATION_SCHEMA,
                null,
                InputOption::VALUE_OPTIONAL,
                'One of the locations schema: Iata, GeoNameCode, GeoNameId, Rnid, Sky.',
                'Sky'
            )
            ->addOption(
                Parameter::COUNTRY,
                null,
                InputOption::VALUE_OPTIONAL,
                'Country code (ISO or a valid one from location schema).'
            )

            ->addOption(
                Parameter::CURRENCY,
                null,
                InputOption::VALUE_OPTIONAL,
                'The currency or every price.'
            )

            ->addOption(
                Parameter::LOCALE,
                null,
                InputOption::VALUE_OPTIONAL,
                'The locale (ISO containing language and country. Eg.: pt-BR, DE-de).'
            )

            ->addOption(
                Parameter::ADULTS,
                null,
                InputOption::VALUE_OPTIONAL,
                'Number of adults. (Between 1 an 8).',
                Parameter::DEFAULT_ADULTS
            )

            ->addOption(
                Parameter::CABIN_CLASS,
                null,
                InputOption::VALUE_OPTIONAL,
                'The cabin class. (Economy, PremiumEconomy, Business, First).',
                Parameter::DEFAULT_CABIN_CLASS
            )

            ->addOption(
                Parameter::CHILDREN,
                null,
                InputOption::VALUE_OPTIONAL,
                'The number of children. (Between 0 and 8).',
                Parameter::DEFAULT_CHILDREN
            )

            ->addOption(
                Parameter::INFANTS,
                null,
                InputOption::VALUE_OPTIONAL,
                'The number of infants. Cannot exceeds adults.',
                Parameter::DEFAULT_INFANTS
            )

            ->addOption(
                Parameter::GROUP_PRICING,
                null,
                InputOption::VALUE_OPTIONAL,
                'Show price per adult.',
                Parameter::DEFAULT_GROUP_PRICING
            )
        ;
    }

    /**
     * @param InputInterface $input
     * @param OutputInterface $output
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->getValidator()
            ->setTarget($input)
            ->validate();

        try {
            $this->getMultiDeal()->process($input);
            $this->getSingleDeal()->process($input);
        } catch (\InvalidArgumentException $e) {
            $this->getLogger()
                ->critical(
                    'Exception caught:' . PHP_EOL .
                    $e->getMessage() . PHP_EOL .
                    $e->getFile() . ':' . $e->getLine() . PHP_EOL
                );
        }
    }

    /**
     * @return ValidatorInterface
     */
    private function getValidator()
    {
        return $this
            ->getContainer()
            ->get('jeancsil_flight_spy.validator.command_line_parameter');
    }

    /**
     * @return MultiDealFacade
     */
    private function getMultiDeal()
    {
        return $this->getContainer()
            ->get('jeancsil_flight_spy.facade.multi_deal');
    }

    /**
     * @return SingleDealFacade
     */
    private function getSingleDeal()
    {
        return $this->getContainer()
            ->get('jeancsil_flight_spy.facade.single_deal');
    }

    /**
     * @return LoggerInterface
     */
    private function getLogger()
    {
        return $this
            ->getContainer()
            ->get('jeancsil_flight_spy.logger.array_logger');
    }
}<commit_msg>Remove all options but --file<commit_after><?php
/**
 * @author <NAME> <<EMAIL>>
 * @license MIT
 */
namespace Jeancsil\FlightSpy\Command;

use Jeancsil\FlightSpy\Command\Entity\Parameter;
use Jeancsil\FlightSpy\Facade\MultiDealFacade;
use Jeancsil\FlightSpy\Validator\ValidatorInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Psr\Log\LoggerInterface;

class SkyscannerCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('flightspy:skyscanner:live_prices')
            ->setDescription('Look for live prices in Skyscanner for the determined filters')
            ->addOption(
                Parameter::FILE,
                null,
                InputOption::VALUE_OPTIONAL,
                'Load all your trips watcher from a config file (JSON)'
            )
        ;
    }

    /** @inheritdoc*/
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->getValidator()
            ->setTarget($input)
            ->validate();

        try {
            $this->getMultiDeal()->process($input);
        } catch (\InvalidArgumentException $e) {
            $this->getLogger()
                ->critical(
                    'Exception caught:' . PHP_EOL .
                    $e->getMessage() . PHP_EOL .
                    $e->getFile() . ':' . $e->getLine() . PHP_EOL
                );
        }
    }

    /**
     * @return ValidatorInterface
     */
    private function getValidator()
    {
        return $this
            ->getContainer()
            ->get('jeancsil_flight_spy.validator.command_line_parameter');
    }

    /**
     * @return MultiDealFacade
     */
    private function getMultiDeal()
    {
        return $this->getContainer()
            ->get('jeancsil_flight_spy.facade.multi_deal');
    }

    /**
     * @return LoggerInterface
     */
    private function getLogger()
    {
        return $this
            ->getContainer()
            ->get('jeancsil_flight_spy.logger.array_logger');
    }
}
{'fraction_non_alphanumeric': 0.10225281602002503, 'fraction_numerical': 0.0010012515644555694, 'mean_word_length': 1.4948485794567592, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 66, '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': '3931929', 'n_tokens_mistral': 2192, 'n_tokens_neox': 2070, 'n_words': 397}