<commit_before><?php

require dirname(__DIR__) . '/vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Message\Response;
use React\EventLoop\Factory;
use WyriHaximus\React\Guzzle\HttpClientAdapter;
use WyriHaximus\React\Guzzle\HttpClient\ProgressInterface;

// Create eventloop
$loop = Factory::create();

$guzzle = new Client([
    'adapter' => new HttpClientAdapter($loop),
]);

foreach ([
    [
        'name' => 'Yahoo!',
        'url' => 'http://www.yahoo.com/',
    ],
    [
        'name' => 'Duck Duck Go',
        'url' => 'http://www.duckduckgo.com/',
    ],
    [
        'name' => 'Nu',
        'url' => 'http://www.nu.nl/',
    ],
] as $site) {
    $name = $site['name'];

    $guzzle->get($site['url'])->then(function(Response $response) use ($name) {
        echo $name . ' completed' . PHP_EOL;
    }, function($event) use ($name) {
        echo $name . ' error' . PHP_EOL;
    }, function(ProgressInterface $event) use ($name) {
        echo $name . ' progress: ' . number_format($event->getCompletePercentage(), 2) . '%' . PHP_EOL;
    });<commit_msg>Letting nu.nl go first for a very little head start (well it matters on the train WiFi I'm currently testing this example on...)<commit_after><?php

require dirname(__DIR__) . '/vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Message\Response;
use React\EventLoop\Factory;
use WyriHaximus\React\Guzzle\HttpClientAdapter;
use WyriHaximus\React\Guzzle\HttpClient\ProgressInterface;

// Create eventloop
$loop = Factory::create();

$guzzle = new Client([
    'adapter' => new HttpClientAdapter($loop),
]);

foreach ([
    [
        'name' => 'Nu',
        'url' => 'http://www.nu.nl/',
    ],
    [
        'name' => 'Yahoo!',
        'url' => 'http://www.yahoo.com/',
    ],
    [
        'name' => '<NAME>',
        'url' => 'http://www.duckduckgo.com/',
    ],
] as $site) {
    $name = $site['name'];

    $guzzle->get($site['url'])->then(function(Response $response) use ($name) {
        echo $name . ' completed' . PHP_EOL;
    }, function($event) use ($name) {
        echo $name . ' error' . PHP_EOL;
    }, function(ProgressInterface $event) use ($name) {
        echo $name . ' progress: ' . number_format($event->getCompletePercentage(), 2) . '%' . PHP_EOL;
    });
{'fraction_non_alphanumeric': 0.1911699779249448, 'fraction_numerical': 0.0008830022075055188, 'mean_word_length': 2.900172117039587, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '1837360', 'n_tokens_mistral': 797, 'n_tokens_neox': 774, 'n_words': 156}