<commit_before><?php

class Denkmal_Push_Notification_Provider_WebPush extends Denkmal_Push_Notification_Provider_Abstract {

    public function sendNotifications(array $subscriptionList, Denkmal_Push_Notification_Message $message) {
        $ttl = max(0, $message->getExpires()->getTimestamp() - (new DateTime())->getTimestamp());

        $messageFactory = new \GuzzleHttp\Message\MessageFactory();
        $requests = Functional\map($subscriptionList, function (Denkmal_Push_Subscription $subscription) use ($messageFactory, $ttl) {
            $headers = [
                'TTL' => $ttl,
            ];
            return $messageFactory->createRequest('POST', $subscription->getEndpoint(), ['headers' => $headers]);
        });
        $this->_sendRequests($requests);
    }

    public function getIdentifier() {
        return 'web-push';
    }

    /**
     * @param \GuzzleHttp\Message\Request[] $requests
     * @throws CM_Exception
     */
    protected function _sendRequests(array $requests) {
        $guzzle = $this->_getGuzzleClient();
        /** @var \GuzzleHttp\Event\ErrorEvent[] $errorEvents */
        $errorEvents = [];
        $pool = new \GuzzleHttp\Pool($guzzle, $requests, [
            'pool_size' => 100,
            'error'     => function (\GuzzleHttp\Event\ErrorEvent $errorEvent) use (&$errorEvents) {<commit_msg>Make sure guzzle throws on non-200 response from WebPush server<commit_after><?php

class Denkmal_Push_Notification_Provider_WebPush extends Denkmal_Push_Notification_Provider_Abstract {

    public function sendNotifications(array $subscriptionList, Denkmal_Push_Notification_Message $message) {
        $ttl = max(0, $message->getExpires()->getTimestamp() - (new DateTime())->getTimestamp());

        $messageFactory = new \GuzzleHttp\Message\MessageFactory();
        $requests = Functional\map($subscriptionList, function (Denkmal_Push_Subscription $subscription) use ($messageFactory, $ttl) {
            $headers = [
                'TTL' => $ttl,
            ];
            return $messageFactory->createRequest('POST', $subscription->getEndpoint(), [
                'headers'    => $headers,
                'exceptions' => true,
            ]);
        });
        $this->_sendRequests($requests);
    }

    public function getIdentifier() {
        return 'web-push';
    }

    /**
     * @param \GuzzleHttp\Message\Request[] $requests
     * @throws CM_Exception
     */
    protected function _sendRequests(array $requests) {
        $guzzle = $this->_getGuzzleClient();
        /** @var \GuzzleHttp\Event\ErrorEvent[] $errorEvents */
        $errorEvents = [];
        $pool = new \GuzzleHttp\Pool($guzzle, $requests, [
            'pool_size' => 100,
            'error'     => function (\GuzzleHttp\Event\ErrorEvent $errorEvent) use (&$errorEvents) {
{'fraction_non_alphanumeric': 0.1338778409090909, 'fraction_numerical': 0.00390625, 'mean_word_length': 2.896265560165975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '2562505', 'n_tokens_mistral': 797, 'n_tokens_neox': 773, 'n_words': 147}