<commit_before><?php

namespace AzaelCodes\Utils;

class Browser implements BrowserInterface {


	public $userAgent;
    private $device;

	/**
	 *	Default constructor
	 */
	public function __construct()
	{
        $this->userAgent = (array_key_exists('HTTP_USER_AGENT', $_SERVER)) ? $_SERVER['HTTP_USER_AGENT']: null;
        if ($this->userAgent == null) {
            throw new \Exception('Unsupported browser #1001');
            return;
        }

        $this->device = new Device();

	}

    /**
     * Check if the current device is a Mobile one.
     * @return bool
     */
    public function isMobile()
    {
        return Device::isMobile();
    }

    /**
     * Since we already have a isMobile function it is easy to check if
     * the current device is desktop.
     * @return bool
     */
    public function isDesktop()
    {
        return !$this->isMobile() && !$this->isTablet();
    }

    /**
     * Check if the current device is a tablet
     * @see
     * @return bool
     */
    public function isTablet()
    {
        return Device::isAndroidTablet($this->userAgent);
    }

    /**
     * Check if the current device is Android
     * @return bool
     */
    public function isAndroid()
    {
        return $this->getDeviceType() == Device::DEVICE_ANDROID;
    }

    public function isIPhone()
    {
        return $this->getDeviceType() == Device::DEVICE_IPHONE;
    }

    public function isIPad()
    {
        return $this->getDeviceType() == Device::DEVICE_IPAD;
    }

    public function isWindows()
    {
        return $this->getDeviceType() == Device::DEVICE_WINDOWS;
    }

    public function isMac()
    {
        return $this->getDeviceType() == Device::DEVICE_MACINTOSH;
    }

    /**
     * When getting a Linux device type it returns a String with the
     * Linux identifier, that way we can do a simple check for it
     * and return
     * @return bool|int
     */
    public function isLinux()
    {
        return strpos($this->getDeviceType(), Device::OS_LINUX);
    }


    public function getBrowserType()
    {
        // TODO: Implement getBrowserType() method.
    }

    public function getBrowserVersion()
    {
        // TODO: Implement getBrowserVersion() method.
    }

    public function getDeviceType()
    {
        return Device::getDeviceType($this->userAgent);
    }

    public function getLanguage()
    {<commit_msg>Made a better isLinux Function<commit_after><?php

namespace AzaelCodes\Utils;

class Browser implements BrowserInterface {


	public $userAgent;
    private $device;

	/**
	 *	Default constructor
	 */
	public function __construct()
	{
        $this->userAgent = (array_key_exists('HTTP_USER_AGENT', $_SERVER)) ? $_SERVER['HTTP_USER_AGENT']: null;
        if ($this->userAgent == null) {
            throw new \Exception('Unsupported browser #1001');
            return;
        }

        $this->device = new Device();

	}

    /**
     * Check if the current device is a Mobile one.
     * @return bool
     */
    public function isMobile()
    {
        return Device::isMobile();
    }

    /**
     * Since we already have a isMobile function it is easy to check if
     * the current device is desktop.
     * @return bool
     */
    public function isDesktop()
    {
        return !$this->isMobile() && !$this->isTablet();
    }

    /**
     * Check if the current device is a tablet
     * @see
     * @return bool
     */
    public function isTablet()
    {
        return Device::isAndroidTablet($this->userAgent);
    }

    /**
     * Check if the current device is Android
     * @return bool
     */
    public function isAndroid()
    {
        return $this->getDeviceType() == Device::DEVICE_ANDROID;
    }

    public function isIPhone()
    {
        return $this->getDeviceType() == Device::DEVICE_IPHONE;
    }

    public function isIPad()
    {
        return $this->getDeviceType() == Device::DEVICE_IPAD;
    }

    public function isWindows()
    {
        return $this->getDeviceType() == Device::DEVICE_WINDOWS;
    }

    public function isMac()
    {
        return $this->getDeviceType() == Device::DEVICE_MACINTOSH;
    }

    /**
     * A linux device is identified by its OS.
     * @return bool|int
     */
    public function isLinux()
    {
        return $this->getOS() == Device::OS_LINUX;
    }


    public function getBrowserType()
    {
        // TODO: Implement getBrowserType() method.
    }

    public function getBrowserVersion()
    {
        // TODO: Implement getBrowserVersion() method.
    }

    public function getDeviceType()
    {
        return Device::getDeviceType($this->userAgent);
    }

    public function getLanguage()
    {
{'fraction_non_alphanumeric': 0.11655657362028553, 'fraction_numerical': 0.0017046665246111229, 'mean_word_length': 2.2128678986995207, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '1017100', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1333, 'n_words': 358}