<commit_before><?php
namespace LeoBenelli\LBComposerCheckBundle\App;

use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\ProcessBuilder;

/**
 * Description of ComposerLeo
 *
 * @author benelli
 */
class ComposerBundleRepository {

    // Array dei packages installati
    private $packages = array();

    /**
     * Funzione di caricamento via composer
     */
    public function load() {

       $builder = new ProcessBuilder();
       $builder->setPrefix('composer');
       $builder->setArguments(array('show', '-l' , '--format=json', '--working-dir=..'));
       $process = $builder->getProcess();

       $process->run();

       // Trasformo il json di ritorno in Array
       $packagesFromJson = json_decode($process->getOutput(), true);

       // Recupero i pacchetti installati
       $packagesInstalled = $packagesFromJson['installed'];

       // Scorro e riempio l'array dei package
       foreach ($packagesInstalled as $packageInstalled) {
           $package = ComposerPackage::createByArray($packageInstalled);

//           $package = new ComposerPackage();
//           $package->setName($packageInstalled['name']);<commit_msg>Aggiunta timeout process a 2 minuti (120 sec)<commit_after><?php
namespace LeoBenelli\LBComposerCheckBundle\App;

use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\ProcessBuilder;

/**
 * Description of ComposerLeo
 *
 * @author benelli
 */
class ComposerBundleRepository {

    // Array dei packages installati
    private $packages = array();

    /**
     * Funzione di caricamento via composer
     */
    public function load() {

       $builder = new ProcessBuilder();
       $builder->setPrefix('composer');
       $builder->setArguments(array('show', '-l' , '--format=json', '--working-dir=..'));
       $process = $builder->getProcess();
       $process->setTimeout(120); // Timeout a 120 secondi 

       $process->run();

       // Trasformo il json di ritorno in Array
       $packagesFromJson = json_decode($process->getOutput(), true);

       // Recupero i pacchetti installati
       $packagesInstalled = $packagesFromJson['installed'];

       // Scorro e riempio l'array dei package
       foreach ($packagesInstalled as $packageInstalled) {
           $package = ComposerPackage::createByArray($packageInstalled);

//           $package = new ComposerPackage();
//           $package->setName($packageInstalled['name']);
{'fraction_non_alphanumeric': 0.1307752545027408, 'fraction_numerical': 0.003915426781519186, 'mean_word_length': 3.2512479201331117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '2624339', 'n_tokens_mistral': 716, 'n_tokens_neox': 687, 'n_words': 159}