<commit_before><?php

namespace Joe\User;

use Joe\Connection;
use Joe\Log;
use Joe\User;
use simplehtmldom_1_5\simple_html_dom_node;
use Sunra\PhpSimple\HtmlDomParser;

class About
{
    use ClientTrait;

    private $user;

    /** @var $profilLeft simple_html_dom_node[] */
    private $about;

    public function __construct(User $user)
    {
        $this->user = $user;
        $this->client = $this->user->getClient();
    }

    public function getAllData()
    {
        $this->prepareAboutDOM();

        $content = [];
        $content['hello'] = $this->getHelloMessage();
        $content['Basic'] = $this->getBasicInfo();
        $content = array_merge($content, $this->getCategorisedInfo());
        $content['place'] = $this->getLocalization();

        return $content;
    }

    /**
     * @param $dl
     * @return array
     */
    protected function getPropertiesFromDl($dl)
    {
        $content = [];
        $props = $dl->children();
        foreach ($props as $prop) {
            if ($prop->tag == 'dt') {
                $key = $prop->text();
            } elseif ($prop->tag == 'dd') {
                $content[$key] = $prop->text();
            }
        }
        return $content;
    }

    /**
     * @throws \Exception
     */
    protected function prepareAboutDOM()
    {
        if (empty($this->about)) {
            $res = $this->client->request('GET', Connection::ADDRESS . '/bojownik/' . $this->user->nickName());
            $body = $res->getBody();
            $html = HtmlDomParser::str_get_html($body);

            /** @var $profilLeft simple_html_dom_node[] */
            $profilLeft = $html->find('div.profilLeft');

            if (!isset($profilLeft[0])) {
                throw new \Exception('Object containing informations was not found.');
            }

            $this->about = $profilLeft[0];
        }
    }

    /**
     * @return mixed
     */
    public function getHelloMessage()
    {
        $this->prepareAboutDOM();
        $innerText = $this->about->innertext();
        return strip_tags(substr($innerText, 0, strpos($innerText, '<dl>')));
    }

    /**
     * @return mixed
     */
    public function getBasicInfo()
    {
        $this->prepareAboutDOM();
        $dls = $this->about->find('dl');
        if (isset($dls[0])) {
            return $this->getPropertiesFromDl($dls[0]);
        }
        return '';
    }

    /**
     * @return mixed
     */
    protected function getCategorisedInfo()
    {
        $content = [];
        $headers = $this->about->find('h3');
        foreach ($headers as $h) {
            $block = $h->text();
            /** @var $dl simple_html_dom_node */
            $dl = $h->next_sibling();

            if ($dl->tag == 'dl') {
                $content[$block] = $this->getPropertiesFromDl($dl);
            } else {
                Log::info('Exception was found', [$dl->outertext()]);
            }
        }
        return $content;
    }

    /**
     * @return mixed
     */
    protected function getLocalization()
    {
        $scripts = $this->about->find('script');
        if (isset($scripts[1])) {
            return  str_replace(';', ";\n", $scripts[1]->innertext());
        }
        return '';
    }
}<commit_msg>fix of two methods visibility<commit_after><?php

namespace Joe\User;

use Joe\Connection;
use Joe\Log;
use Joe\User;
use simplehtmldom_1_5\simple_html_dom_node;
use Sunra\PhpSimple\HtmlDomParser;

class About
{
    use ClientTrait;

    private $user;

    /** @var $profilLeft simple_html_dom_node[] */
    private $about;

    public function __construct(User $user)
    {
        $this->user = $user;
        $this->client = $this->user->getClient();
    }

    public function getAllData()
    {
        $this->prepareAboutDOM();

        $content = [];
        $content['hello'] = $this->getHelloMessage();
        $content['Basic'] = $this->getBasicInfo();
        $content = array_merge($content, $this->getCategorisedInfo());
        $content['place'] = $this->getLocalization();

        return $content;
    }

    /**
     * @param $dl
     * @return array
     */
    protected function getPropertiesFromDl($dl)
    {
        $content = [];
        $props = $dl->children();
        foreach ($props as $prop) {
            if ($prop->tag == 'dt') {
                $key = $prop->text();
            } elseif ($prop->tag == 'dd') {
                $content[$key] = $prop->text();
            }
        }
        return $content;
    }

    /**
     * @throws \Exception
     */
    protected function prepareAboutDOM()
    {
        if (empty($this->about)) {
            $res = $this->client->request('GET', Connection::ADDRESS . '/bojownik/' . $this->user->nickName());
            $body = $res->getBody();
            $html = HtmlDomParser::str_get_html($body);

            /** @var $profilLeft simple_html_dom_node[] */
            $profilLeft = $html->find('div.profilLeft');

            if (!isset($profilLeft[0])) {
                throw new \Exception('Object containing informations was not found.');
            }

            $this->about = $profilLeft[0];
        }
    }

    /**
     * @return mixed
     */
    public function getHelloMessage()
    {
        $this->prepareAboutDOM();
        $innerText = $this->about->innertext();
        return strip_tags(substr($innerText, 0, strpos($innerText, '<dl>')));
    }

    /**
     * @return mixed
     */
    public function getBasicInfo()
    {
        $this->prepareAboutDOM();
        $dls = $this->about->find('dl');
        if (isset($dls[0])) {
            return $this->getPropertiesFromDl($dls[0]);
        }
        return '';
    }

    /**
     * @return mixed
     */
    public function getCategorisedInfo()
    {
        $content = [];
        $headers = $this->about->find('h3');
        foreach ($headers as $h) {
            $block = $h->text();
            /** @var $dl simple_html_dom_node */
            $dl = $h->next_sibling();

            if ($dl->tag == 'dl') {
                $content[$block] = $this->getPropertiesFromDl($dl);
            } else {
                Log::info('Exception was found', [$dl->outertext()]);
            }
        }
        return $content;
    }

    /**
     * @return mixed
     */
    public function getLocalization()
    {
        $scripts = $this->about->find('script');
        if (isset($scripts[1])) {
            return  str_replace(';', ";\n", $scripts[1]->innertext());
        }
        return '';
    }
}
{'fraction_non_alphanumeric': 0.1709270095472744, 'fraction_numerical': 0.003079765937788728, 'mean_word_length': 1.8424507658643325, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 83, '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': '2180083', 'n_tokens_mistral': 1975, 'n_tokens_neox': 1941, 'n_words': 360}