<commit_before><?php

namespace App\Service;

use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Lookup;
use ApaiIO\Request\GuzzleRequest;
use GuzzleHttp\Client;
use Symfony\Component\VarDumper\VarDumper;

class AWSService
{
    /**
     * @return \ApaiIO\ApaiIO
     */
    static function getInstance()
    {
        $conf = new GenericConfiguration();
        $client = new Client();
        $request = new GuzzleRequest($client);
        $conf
            ->setCountry('fr')
            ->setAccessKey(getenv('AccessKey'))
            ->setSecretKey(getenv('SecretKey'))
            ->setAssociateTag(getenv('AssociateTag'))
            ->setRequest($request);
        return new ApaiIO($conf);
    }

    /**
     * @param string $asin
     * @return array
     */
    static function getProductInfo(string $asin): array
    {
        $lookup = new Lookup();
        $lookup->setItemId($asin);
        $lookup->setResponseGroup(array('Medium')); // More detailed information

        $response = self::getInstance()->runOperation($lookup);

        $parsed = \App\Service\XMLParser::xmlstr_to_array($response);

        VarDumper::dump($parsed);

        $productInfos['small_image'] = $parsed['Items']['Item']['SmallImage']['URL'];<commit_msg>mise en prod - env<commit_after><?php

namespace App\Service;

use ApaiIO\ApaiIO;
use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Lookup;
use ApaiIO\Request\GuzzleRequest;
use GuzzleHttp\Client;
use Symfony\Component\VarDumper\VarDumper;

class AWSService
{
    /**
     * @return \ApaiIO\ApaiIO
     */
    static function getInstance()
    {
        $conf = new GenericConfiguration();
        $client = new Client();
        $request = new GuzzleRequest($client);
        $conf
            ->setCountry('fr')
            ->setAccessKey(getenv('AccessKey'))
            ->setSecretKey(getenv('SecretKey'))
            ->setAssociateTag(getenv('AssociateTag'))
            ->setRequest($request);
        return new ApaiIO($conf);
    }

    /**
     * @param string $asin
     * @return array
     */
    static function getProductInfo(string $asin): array
    {
        $lookup = new Lookup();
        $lookup->setItemId($asin);
        $lookup->setResponseGroup(array('Medium')); // More detailed information

        $response = self::getInstance()->runOperation($lookup);

        $parsed = \App\Service\XMLParser::xmlstr_to_array($response);

        // VarDumper::dump($parsed);

        $productInfos['small_image'] = $parsed['Items']['Item']['SmallImage']['URL'];
{'fraction_non_alphanumeric': 0.14612403100775193, 'fraction_numerical': 0.0, 'mean_word_length': 2.8464977645305516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6929509', 'n_tokens_mistral': 765, 'n_tokens_neox': 754, 'n_words': 132}