/** * Return a Cabability Value * * @param string $deviceID * @param string $capabilityName * @return string */ function getCapabilityForDevice($deviceID, $capabilityName) { $key = $deviceID . $capabilityName; $capabilityValue = $this->_cacheProvider->get($key); if (empty($capabilityValue)) { $capabilityValue = $this->_deviceRepository->getCapabilityForDevice($deviceID, $capabilityName); // save it in cache $this->_cacheProvider->put($key, $capabilityValue); } return $capabilityValue; }
/** * Returns the value of a given capability name * * @param string $capabilityName * @return string Capability value * @throws WURFLException if the value of the $capability name is illegal */ public function getCapability($capabilityName) { if (isset($this->_device->capabilities[$capabilityName])) { return $this->_device->capabilities[$capabilityName]; } $key = $this->_device->id . "_" . $capabilityName; $capabilityValue = $this->_cacheProvider->get($key); if (empty($capabilityValue)) { $capabilityValue = $this->_deviceRepository->getCapabilityForDevice($this->_device->fallBack, $capabilityName); // save it in cache $this->_cacheProvider->put($key, $capabilityValue); } // prevent useless gets when retrieving the same capability from this device again //$this->_device->capabilities[$capabilityName] = $capabilityValue; return $capabilityValue; }