src/Entity/Device.php
protected function parseUserAgent($userAgentString)
    {
        $parser = new WhichBrowser\Parser($userAgentString);

        if (!$parser->isDetected()) {
            return;
        }

        if ($parser->isType('mobile')) {
            $this->setType('mobile');
        } elseif ($parser->isType('tablet')) {
            $this->setType('tablet');
        } elseif ($parser->isType('desktop')) {
            $this->setType('pc');
        } else {
            $this->setType('other');
        }

        if ($parser->isOs('Android')) {
            $this->setOperatingSystem('android');
        } elseif ($parser->isOs('iOS')) {
            $this->setOperatingSystem('ios');
        } elseif ($parser->isOs('Windows')) {
            $this->setOperatingSystem('windows');
        } elseif ($parser->isOs('Windows Phone')) {
            $this->setOperatingSystem('windows-mobile');
        } else {
            $this->setOperatingSystem('other');
        }
    }
protected function parseUserAgent($userAgentString)
    {
        $parser = new WhichBrowser\Parser($userAgentString);

        if (!$parser->isDetected()) {
            return;
        }

        if ($parser->isType('mobile')) {
            $this->setType('mobile');
        } elseif ($parser->isType('tablet')) {
            $this->setType('tablet');
        } elseif ($parser->isType('desktop')) {
            $this->setType('pc');
        } else {
            $this->setType('other');
        }

        if ($parser->isOs('Android')) {
            $this->setOperatingSystem('android');
        } elseif ($parser->isOs('iOS')) {
            $this->setOperatingSystem('ios');
        } elseif ($parser->isOs('Windows')) {
            $this->setOperatingSystem('windows');
        } elseif ($parser->isOs('Windows Phone')) {
            $this->setOperatingSystem('windows-mobile');
        } else {
            $this->setOperatingSystem('other');
        }
    }
protected function parseUserAgent ( $ userAgentString ) { $ parser = new WhichBrowser \ Parser ( $ userAgentString ) ; if ( ! $ parser -> isDetected ( ) ) { return ; } if ( $ parser -> isType ( 'mobile' ) ) { $ this -> setType ( 'mobile' ) ; } elseif ( $ parser -> isType ( 'tablet' ) ) { $ this -> setType ( 'tablet' ) ; } elseif ( $ parser -> isType ( 'desktop' ) ) { $ this -> setType ( 'pc' ) ; } else { $ this -> setType ( 'other' ) ; } if ( $ parser -> isOs ( 'Android' ) ) { $ this -> setOperatingSystem ( 'android' ) ; } elseif ( $ parser -> isOs ( 'iOS' ) ) { $ this -> setOperatingSystem ( 'ios' ) ; } elseif ( $ parser -> isOs ( 'Windows' ) ) { $ this -> setOperatingSystem ( 'windows' ) ; } elseif ( $ parser -> isOs ( 'Windows Phone' ) ) { $ this -> setOperatingSystem ( 'windows-mobile' ) ; } else { $ this -> setOperatingSystem ( 'other' ) ; } }
parse and map device type and os from user agent string

@param $userAgentString
parse and map device type and os from user agent string