<commit_before><?php

namespace PragmaRX\Health\Checkers;

use GuzzleHttp\TransferStats;
use GuzzleHttp\Client as Guzzle;

class HttpChecker extends BaseChecker
{
    /**
     * @var bool
     */
    protected $secure = false;

    /**
     * @var
     */
    protected $guzzle;

    /**
     * @var
     */
    private $totalTime;

    /**
     * @var
     */
    private $url;

    /**
     * HTTP Checker.
     *
     * @return bool
     */
    public function check()
    {
        try {
            $health = [];

            foreach ((array) $this->resource['url'] as $url) {
                list($healthy, $message) = $this->checkWebPage(
                    $this->makeUrlWithScheme($url, $this->secure),
                    $this->secure
                );

                $health[] = $this->makeResult($healthy, $message);
            }

            return $health;
        } catch (\Exception $exception) {
            return $this->makeResultFromException($exception);
        }
    }

    /**
     *  Check web pages.
     *
     * @param $url
     * @param bool $ssl
     * @return mixed
     */<commit_msg>Support Collections<commit_after><?php

namespace PragmaRX\Health\Checkers;

use GuzzleHttp\TransferStats;
use GuzzleHttp\Client as Guzzle;
use Illuminate\Support\Collection;

class HttpChecker extends BaseChecker
{
    /**
     * @var bool
     */
    protected $secure = false;

    /**
     * @var
     */
    protected $guzzle;

    /**
     * @var
     */
    private $totalTime;

    /**
     * @var
     */
    private $url;

    /**
     * HTTP Checker.
     *
     * @return bool
     */
    public function check()
    {
        try {
            $health = [];

            foreach ($this->getResourceUrlArray() as $url) {
                list($healthy, $message) = $this->checkWebPage(
                    $this->makeUrlWithScheme($url, $this->secure),
                    $this->secure
                );

                $health[] = $this->makeResult($healthy, $message);
            }

            return $health;
        } catch (\Exception $exception) {
            return $this->makeResultFromException($exception);
        }
    }

    private function getResourceUrlArray()
    {
        if (is_a($this->resource['url'], Collection::class)) {
            return $this->resource['url']->toArray();
        }

        return (array) $this->resource['url'];
    }

    /**
     *  Check web pages.
     *
     * @param $url
     * @param bool $ssl
     * @return mixed
     */
{'fraction_non_alphanumeric': 0.13961813842482101, 'fraction_numerical': 0.0, 'mean_word_length': 1.5455465587044535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '7221454', 'n_tokens_mistral': 752, 'n_tokens_neox': 719, 'n_words': 147}