Device detection using the Universal Device Detection library

I have tried to receive values:

require_once 'vendor/autoload.php';
$userAgent = $_SERVER[‘HTTP_USER_AGENT’];

use DeviceDetector\Parser\Bot AS BotParser;

$botParser = new BotParser();

// OPTIONAL: discard bot information. parse() will then return true instead of information

$result = $botParser->parse();

if (!is_null($result)) {
    // do not do anything if a bot is detected

// handle non-bot requests

How to handle non-bot requests?
Is it correct the bottom code?

// handle non-bot requests
  $clientInfo = $dd->getClient(); // holds information about browser, feed reader, media player, ...
  $osInfo = $dd->getOs();
  $device = $dd->getDeviceName();
  $brand = $dd->getBrandName();
  $model = $dd->getModel();