<commit_before><?php
/*
 * This file is part of the Sonata project.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\PageBundle\Request;

use Symfony\Component\Routing\RequestContext;
use Sonata\PageBundle\Site\SiteSelectorInterface;

class SiteRequestContext extends RequestContext
{
    protected $selector;

    /**
     * @param \Sonata\PageBundle\Site\SiteSelectorInterface $site
     * @param string $baseUrl
     * @param string $method
     * @param string $host
     * @param string $scheme
     * @param int $httpPort
     * @param int $httpsPort
     */
    public function __construct(SiteSelectorInterface $selector, $baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443)
    {
        $this->selector = $selector;

        parent::__construct($baseUrl, $method, $host, $scheme, $httpPort, $httpsPort);
    }

    /**
     * @return string|void
     */
    public function getHost()
    {
        $site = $this->selector->retrieve();

        if ($site && !$site->isLocalhost()) {
            return $site->getHost();
        }

        return parent::getHost();
    }

    /**
     * @return string
     */
    public function getBaseUrl()
    {
        $site = $this->selector->retrieve();

        if ($site && !$site->isLocalhost()) {
            return parent::getBaseUrl().$site->getRelativePath();
        }<commit_msg>Remove useless test<commit_after><?php
/*
 * This file is part of the Sonata project.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\PageBundle\Request;

use Symfony\Component\Routing\RequestContext;
use Sonata\PageBundle\Site\SiteSelectorInterface;

class SiteRequestContext extends RequestContext
{
    protected $selector;

    /**
     * @param \Sonata\PageBundle\Site\SiteSelectorInterface $site
     * @param string $baseUrl
     * @param string $method
     * @param string $host
     * @param string $scheme
     * @param int $httpPort
     * @param int $httpsPort
     */
    public function __construct(SiteSelectorInterface $selector, $baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443)
    {
        $this->selector = $selector;

        parent::__construct($baseUrl, $method, $host, $scheme, $httpPort, $httpsPort);
    }

    /**
     * @return string|void
     */
    public function getHost()
    {
        $site = $this->selector->retrieve();

        if ($site && !$site->isLocalhost()) {
            return $site->getHost();
        }

        return parent::getHost();
    }

    /**
     * @return string
     */
    public function getBaseUrl()
    {
        $site = $this->selector->retrieve();

        if ($site) {
            return parent::getBaseUrl().$site->getRelativePath();
        }
{'fraction_non_alphanumeric': 0.1384564425306393, 'fraction_numerical': 0.0033123550844650546, 'mean_word_length': 2.682926829268293, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7124491', 'n_tokens_mistral': 887, 'n_tokens_neox': 863, 'n_words': 227}