Skip to content

Unify empty responses #5951

@Findus23

Description

@Findus23

Changing this would probably break backwards compatibility, so I'm not sure if this could be changed, but I want to document this nevertheless:

The output of the different methods return different values if nothing can be detected (null, empty array and "").

Example script:

<?php
require_once 'vendor/autoload.php';
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\DeviceParserAbstract;

$userAgent = "thisissomeunknownuseragent";
$dd = new DeviceDetector($userAgent);
$dd->parse();

$botInfo = $dd->getBot();
$clientInfo = $dd->getClient();
$osInfo = $dd->getOs();
$device = $dd->getDeviceName();
$brand = $dd->getBrandName();
$model = $dd->getModel();

var_dump($botInfo);
var_dump($clientInfo);
var_dump($osInfo);
var_dump($device);
var_dump($brand);
var_dump($model);

Output:

NULL
NULL
array(0) {
}
string(0) ""
string(0) ""
string(0) ""

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions