<commit_before><?php

declare(strict_types=1);

namespace Cortex\Foundation\Http;

use Illuminate\Support\Str;
use Illuminate\Http\Request as BaseRequest;

class Request extends BaseRequest
{
    /**
     * The guard name.
     *
     * @var string
     */
    protected $guard;

    /**
     * The access area name.
     *
     * @var string
     */
    protected $accessarea;

    /**
     * Determine if current request is an API.
     *
     * @var bool
     */
    protected $isApi = false;

    /**
     * Get the URL (no query string) for the request.
     *
     * @return string
     */
    public function url(): string
    {
        return parent::url().(config('cortex.foundation.route.trailing_slash') ? '/' : '');
    }

    /**
     * Check if this is an API request.
     *
     * @return bool
     */
    public function isApi(): bool<commit_msg>Check if request is an API, which expectsJson<commit_after><?php

declare(strict_types=1);

namespace Cortex\Foundation\Http;

use Illuminate\Support\Str;
use Illuminate\Http\Request as BaseRequest;

class Request extends BaseRequest
{
    /**
     * The guard name.
     *
     * @var string
     */
    protected $guard;

    /**
     * The access area name.
     *
     * @var string
     */
    protected $accessarea;

    /**
     * Determine if current request is an API.
     *
     * @var bool
     */
    protected $isApi = false;

    /**
     * Get the URL (no query string) for the request.
     *
     * @return string
     */
    public function url(): string
    {
        return parent::url().(config('cortex.foundation.route.trailing_slash') ? '/' : '');
    }

    /**
     * Determine if the current request probably expects a JSON response.
     *
     * @return bool
     */
    public function expectsJson()
    {
        return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson() || $this->isApi();
    }

    /**
     * Check if this is an API request.
     *
     * @return bool
     */
    public function isApi(): bool
{'fraction_non_alphanumeric': 0.13092330239374694, 'fraction_numerical': 0.0009770395701025891, 'mean_word_length': 2.011764705882353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '878885', 'n_tokens_mistral': 623, 'n_tokens_neox': 616, 'n_words': 169}