/** * Constructor * * Configure the User Agent from a user agent string. * @param String $userAgentString => the user agent string. * @param UserAgentParser $userAgentParser => the parser used to parse the string. */ public function __construct($userAgentString = null, UserAgentParser $userAgentParser = null) { if ($userAgentParser == null) { $userAgentParser = new UserAgentParser(); } $this->setUserAgentString($userAgentString); $this->fromArray($userAgentParser->parse($userAgentString)); }