/** @return object */ public static function getBrowserIndex() { // Lazy-init and cache if (self::$browserIndex === null) { global $swarmInstallDir, $swarmContext; // Convert from array with string values // to an object with boolean values $browserIndex = new stdClass(); $userAgents = $swarmContext->getConf()->userAgents; foreach ($userAgents as $uaID => $uaData) { $keys = array_keys(get_object_vars($swarmContext->getBrowserInfo()->getUaData())); $data = new stdClass(); // Filter out unwanted properties, and set missing properties. foreach ($keys as $key) { $data->{$key} = isset($uaData->{$key}) ? $uaData->{$key} : ''; } $data->displayInfo = self::getDisplayInfo($data); $browserIndex->{$uaID} = $data; } self::$browserIndex = $browserIndex; } return self::$browserIndex; }