HEX
Server: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux vmi267337.contaboserver.net 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
User: ohirex (1008)
PHP: 8.2.8
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec
Upload Files
File: /home/ohirex/web/ohirex.com/public_html/join/bases/browser/Os.php
<?php

namespace Sinergi\BrowserDetector;

/**
 * OS Detection.
 */
class Os
{
    const UNKNOWN = 'unknown';
    const OSX = 'OS X';
    const IOS = 'iOS';
    const SYMBOS = 'SymbOS';
    const WINDOWS = 'Windows';
    const ANDROID = 'Android';
    const LINUX = 'Linux';
    const NOKIA = 'Nokia';
    const BLACKBERRY = 'BlackBerry';
    const FREEBSD = 'FreeBSD';
    const OPENBSD = 'OpenBSD';
    const NETBSD = 'NetBSD';
    const OPENSOLARIS = 'OpenSolaris';
    const SUNOS = 'SunOS';
    const OS2 = 'OS2';
    const BEOS = 'BeOS';
    const WINDOWS_PHONE = 'Windows Phone';
    const CHROME_OS = 'Chrome OS';

    const VERSION_UNKNOWN = 'unknown';

    /**
     * @var string
     */
    private $name;

    /**
     * @var string
     */
    private $version;

    /**
     * @var bool
     */
    private $isMobile = false;

    /**
     * @var UserAgent
     */
    private $userAgent;

    /**
     * @param null|string|UserAgent $userAgent
     *
     * @throws \Sinergi\BrowserDetector\InvalidArgumentException
     */
    public function __construct($userAgent = null)
    {
        if ($userAgent instanceof UserAgent) {
            $this->setUserAgent($userAgent);
        } elseif (null === $userAgent || is_string($userAgent)) {
            $this->setUserAgent(new UserAgent($userAgent));
        } else {
            throw new InvalidArgumentException();
        }
    }

    /**
     * Return the name of the OS.
     *
     * @return string
     */
    public function getName()
    {
        if (!isset($this->name)) {
            OsDetector::detect($this, $this->getUserAgent());
        }

        return $this->name;
    }

    /**
     * Set the name of the OS.
     *
     * @param string $name
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->name = (string)$name;

        return $this;
    }

    /**
     * Return the version of the OS.
     *
     * @return string
     */
    public function getVersion()
    {
        if (isset($this->version)) {
            return (string)$this->version;
        } else {
            OsDetector::detect($this, $this->getUserAgent());

            return (string)$this->version;
        }
    }

    /**
     * Set the version of the OS.
     *
     * @param string $version
     *
     * @return $this
     */
    public function setVersion($version)
    {
        $this->version = (string)$version;

        return $this;
    }

    /**
     * Is the browser from a mobile device?
     *
     * @return bool
     */
    public function getIsMobile()
    {
        if (!isset($this->name)) {
            OsDetector::detect($this, $this->getUserAgent());
        }

        return $this->isMobile;
    }

    /**
     * @return bool
     */
    public function isMobile()
    {
        return $this->getIsMobile();
    }

    /**
     * Set the Browser to be mobile.
     *
     * @param bool $isMobile
     */
    public function setIsMobile($isMobile = true)
    {
        $this->isMobile = (bool)$isMobile;
    }

    /**
     * @param UserAgent $userAgent
     *
     * @return $this
     */
    public function setUserAgent(UserAgent $userAgent)
    {
        $this->userAgent = $userAgent;

        return $this;
    }

    /**
     * @return UserAgent
     */
    public function getUserAgent()
    {
        return $this->userAgent;
    }
}