src/Manager.php
private function getWrappedDevice($deviceId, Request\GenericRequest $request = null)
    {
        $modelDevices = $this->getCacheStorage()->load('DEVS_' . $deviceId);

        if (empty($modelDevices)) {
            $modelDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
        }

        $this->getCacheStorage()->save('DEVS_' . $deviceId, $modelDevices);

        if ($request === null) {
            // If a request was not provided, we generate one from the WURFL entry itself
            // to help resolve the virtual capabilities
            $requestFactory    = new GenericRequestFactory();
            $request           = $requestFactory->createRequestForUserAgent($modelDevices[0]->userAgent);
            $genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();

            $request->setUserAgentNormalized($genericNormalizer->normalize($request->getUserAgent()));
        }

        // The CustomDevice is not cached since virtual capabilities must be recalculated
        // for every different request.
        return new CustomDevice($modelDevices, $request);
    }
private function getWrappedDevice($deviceId, Request\GenericRequest $request = null)
    {
        $modelDevices = $this->getCacheStorage()->load('DEVS_' . $deviceId);

        if (empty($modelDevices)) {
            $modelDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);
        }

        $this->getCacheStorage()->save('DEVS_' . $deviceId, $modelDevices);

        if ($request === null) {
            // If a request was not provided, we generate one from the WURFL entry itself
            // to help resolve the virtual capabilities
            $requestFactory    = new GenericRequestFactory();
            $request           = $requestFactory->createRequestForUserAgent($modelDevices[0]->userAgent);
            $genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();

            $request->setUserAgentNormalized($genericNormalizer->normalize($request->getUserAgent()));
        }

        // The CustomDevice is not cached since virtual capabilities must be recalculated
        // for every different request.
        return new CustomDevice($modelDevices, $request);
    }
private function getWrappedDevice ( $ deviceId , Request \ GenericRequest $ request = null ) { $ modelDevices = $ this -> getCacheStorage ( ) -> load ( 'DEVS_' . $ deviceId ) ; if ( empty ( $ modelDevices ) ) { $ modelDevices = $ this -> getDeviceRepository ( ) -> getDeviceHierarchy ( $ deviceId ) ; } $ this -> getCacheStorage ( ) -> save ( 'DEVS_' . $ deviceId , $ modelDevices ) ; if ( $ request === null ) { // If a request was not provided, we generate one from the WURFL entry itself // to help resolve the virtual capabilities $ requestFactory = new GenericRequestFactory ( ) ; $ request = $ requestFactory -> createRequestForUserAgent ( $ modelDevices [ 0 ] -> userAgent ) ; $ genericNormalizer = UserAgentHandlerChainFactory :: createGenericNormalizers ( ) ; $ request -> setUserAgentNormalized ( $ genericNormalizer -> normalize ( $ request -> getUserAgent ( ) ) ) ; } // The CustomDevice is not cached since virtual capabilities must be recalculated // for every different request. return new CustomDevice ( $ modelDevices , $ request ) ; }
Wraps the model device with \Wurfl\Xml\ModelDeviceInterface. This function takes the
Device ID and returns the \Wurfl\CustomDevice with all capabilities.

@param string                 $deviceId
@param Request\GenericRequest $request

@return \Wurfl\CustomDevice
Wraps the model device with \ Wurfl \ Xml \ ModelDeviceInterface . This function takes the Device ID and returns the \ Wurfl \ CustomDevice with all capabilities .