// search an existing identification in the session
$storage =
$this->
getStorage($userAgent);
if (!
$storage->
isEmpty()) { // If the user agent and features are already existing, the
// Zend_Http_UserAgent object is serialized in the session
$object =
$storage->
read();
$this->
unserialize($object);
} else { // Otherwise, the identification is made and stored in the session.
// Find the browser type:
$this->
setBrowserType($this->
_matchUserAgent());
$this->
_createDevice();
// put the result in storage:
$this->
getStorage($userAgent) ->
write($this->
serialize());
} // Mark the object as immutable
$this->_immutable = true;
// Return the device instance