Patch an existing $device with a $patchingDevice
@param WURFL_Xml_ModelDevice $device
@param WURFL_Xml_ModelDevice $patchingDevice
@return WURFL_Xml_ModelDevice Patched device
489753
public function patch($device, $patchingDevice)
    {
        if (!$this->haveSameId($device, $patchingDevice)) {
            return $patchingDevice;
        }
        $groupIdCapabilitiesMap = WURFL_WURFLUtils::array_merge_recursive_unique($device->getGroupIdCapabilitiesMap(), $patchingDevice->getGroupIdCapabilitiesMap());
        return new WURFL_Xml_ModelDevice($device->id, $device->userAgent, $device->fallBack, $device->actualDeviceRoot, $device->specific, $groupIdCapabilitiesMap);
    }
671028
public boolean isDeviceCompatible(final IoDevice device)
    {
        List<IoDevice> ioDevices = new LinkedList<IoDevice>();
        for (PriorityIoDeviceTuple tuple : mCompatibleDevices)
        {
            if (tuple.getIoDevice().equals(device))
            {
                return true;
            }
        }
        return false;
    }
1023110
public function getDeviceIDFromRIS($userAgent, $tolerance)
    {
        if ($tolerance === null) {
            return WurflConstants::NO_MATCH;
        }

        $match = Utils::risMatch($this->userAgents, $userAgent, $tolerance);

        if (!empty($match)) {
            return $this->userAgentsWithDeviceID[$match];
        }

        return WurflConstants::NO_MATCH;
    }
785207
@SuppressWarnings("unchecked")
     private static String patch(final byte[] data, final String externalIp) throws UnknownHostException, SdpException {
         final String text = new String(data);
         if(logger.isInfoEnabled()){
             logger.info("About to patch ");
             logger.info("SDP :" + text);
             logger.info("Using externalIP: " + externalIp);
         }
         final SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(text);
         SessionName sessionName = SdpFactory.getInstance().createSessionName("Restcomm B2BUA");
         sdp.setSessionName(sessionName);
         // Handle the connection at the session level.
         fix(sdp.getConnection(), externalIp);
         // Handle the connections at the media description level.
         final Vector<MediaDescription> descriptions = sdp.getMediaDescriptions(false);
         for (final MediaDescription description : descriptions) {
             fix(description.getConnection(), externalIp);
         }
         sdp.getOrigin().setAddress(externalIp);
         return sdp.toString();
     }
1099773
public function patch(ResourceManager $resourceManager, ApiRequest $request, int $version, string $resource, $id)
    {
        $resourceManager->version($version);

        /** @var \Ipunkt\LaravelJsonApi\Contracts\RequestHandlers\HandlesPatchRequest $handler */
        $handler = $this->initializeHandler($resourceManager, $resource, $request, HandlesPatchRequest::class);

        $parameters = $request->asParameters();

        $result = $handler->patch($id, $request, $parameters);

        if ($result === true) {
            return $this->respondNoContent();
        }
        if ($result === false) {
            //  @TODO: Result false means nothing changed! Result okay? Wishful changes are set, so okay is fine.
            return $this->respondNoContent();
        }

        $document = $this->makeDocumentFromResource($resourceManager, $resource, $result, $parameters, $handler);

        return $this->respond($document);
    }
825920
protected synchronized void addDeviceToStore(AndroidDevice device) throws AndroidDeviceException {
    if (androidDevices.containsKey(device.getTargetPlatform())) {
      List<AndroidDevice> platformDevices = androidDevices.get(device.getTargetPlatform());
      if (!platformDevices.contains(device)) {
        platformDevices.add(device);
      }
    } else {
      androidDevices.put(device.getTargetPlatform(), Lists.newArrayList(device));
    }
  }
423244
protected function replaceTemplateExtension($name, $device)
    {
        if (strstr($name, 'twig')) {
            return str_replace('html.twig', $device . '.html.twig', $name);
        }
        if (strstr($name, 'smarty')) {
            return str_replace('html.smarty', $device . '.html.smarty', $name);
        }

        return $name;
    }
264315
public function setToDevice(\Sopinet\ChatBundle\Entity\Device $toDevice = null)
    {
        $this->toDevice = $toDevice;

        return $this;
    }
1134732
private function classifyAndPersistDevice($device)
    {
        if ($this->validateDevice($device) === false) {
            return;
        }

        array_push($this->devices, $device->id);
        if ($device->fallBack != 'root') {
            $this->fallbacks[$device->fallBack]= $device->id;
        }

        $this->userAgentHandlerChain->filter($device->userAgent, $device->id);
        $this->persistenceProvider->save($device->id, $device);
    }
1319768
private static function deviceParser() {

        // build the obj that will be returned
        $deviceObj = new \stdClass();

        // run the regexes to match things up
        $deviceRegexes = self::$regexes['device_parsers'];
        foreach ($deviceRegexes as $deviceRegex) {
            if (preg_match("/".str_replace("/","\/",$deviceRegex['regex'])."/i",self::$ua,$matches)) {

                // Make sure device matches are null
                // Device Name, Major and Minor defaults
                if (!isset($matches[1])) { $matches[1] = null; }
                    if (!isset($matches[2])) { $matches[2] = null; }
                        if (!isset($matches[3])) { $matches[3] = null; }

                            // basic properties
                            $deviceObj->deviceMajor  = isset($deviceRegex['device_v1_replacement']) ? $deviceRegex['device_v1_replacement'] : $matches[2];
                $deviceObj->deviceMinor  = isset($deviceRegex['device_v2_replacement']) ? $deviceRegex['device_v2_replacement'] : $matches[3];
                $deviceObj->device       = isset($deviceRegex['device_replacement']) ? str_replace("$1",$matches[1],$deviceRegex['device_replacement']) : str_replace("_"," ",$matches[1]);

                // device version?
                $deviceObj->deviceVersion = isset($deviceObj->deviceMajor) ? $deviceObj->deviceMajor : "";
                $deviceObj->deviceVersion = isset($deviceObj->deviceMinor) ? $deviceObj->deviceVersion.'.'.$deviceObj->deviceMinor : $deviceObj->deviceVersion;

                // prettify
                $deviceObj->deviceFull = $deviceObj->device." ".$deviceObj->deviceVersion;

                // check to see if this is a mobile device
                // this isn't really needed because if it matches a mobile browser it'll automatically mark it as a mobile device
                $deviceObj->isMobileDevice = false;
                $mobileDevices  = array("iPhone","iPod","iPad","HTC","Kindle","Lumia","Amoi","Asus","Bird","Dell","DoCoMo","Huawei","i-mate","Kyocera",
                    "Lenovo","LG","Kin","Motorola","Philips","Samsung","Softbank","Palm","HP ","Generic Feature Phone","Generic Smartphone",
                    "Nintendo DSi","Nintendo 3DS","PlayStation Vita");
                foreach($mobileDevices as $mobileDevice) {
                    if (stristr($deviceObj->device, $mobileDevice)) {
                        $deviceObj->isMobileDevice = true;
                        break;
                    }
                }

                // check to see if this is a tablet (not perfect)
                $deviceObj->isTablet = false;
                $tablets = array("Kindle","iPad","Playbook","TouchPad","Dell Streak","Galaxy Tab","Xoom");
                foreach($tablets as $tablet) {
                    if (stristr($deviceObj->device, $tablet)) {
                        $deviceObj->isTablet = true;
                        break;
                    }
                }

                return $deviceObj;
            }
        }
        return false;
    }
352831
public void addDeviceAppender(final String deviceTargetName, final Class<?> deviceClassName,
            final String loggingDeviceName) throws DevFailed {
        if (rootLoggerBack != null) {
            logger.debug("add device appender {} on {}", deviceTargetName, loggingDeviceName);
            final DeviceAppender appender = new DeviceAppender(deviceTargetName, loggingDeviceName);
            deviceAppenders.put(loggingDeviceName.toLowerCase(Locale.ENGLISH), appender);
            rootLoggerBack.addAppender(appender);
            // debug level by default
            setLoggingLevel(LoggingLevel.DEBUG.toInt(), deviceClassName);
            setLoggingLevel(loggingDeviceName, LoggingLevel.DEBUG.toInt());
            appender.start();
        }
    }
230362
public function setDeviceType($deviceType = null) {
        switch ($deviceType) {
            case self::DEVICE_ANDROID :
                $this -> deviceType = self::DEVICE_ANDROID;
                break;
            case self::DEVICE_IOS :
                $this -> deviceType = self::DEVICE_IOS;
                break;
            default :
                $this -> deviceType = null;
        }
    }
636364
public ApiResponse<DeviceEnvelope> addDeviceWithHttpInfo(Device device) throws ApiException {
        com.squareup.okhttp.Call call = addDeviceValidateBeforeCall(device, null, null);
        Type localVarReturnType = new TypeToken<DeviceEnvelope>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1161807
public DeviceEnvelope addDevice(Device device) throws ApiException {
        ApiResponse<DeviceEnvelope> resp = addDeviceWithHttpInfo(device);
        return resp.getData();
    }
164748
public void connectToDeviceWithLink(Device device, Link link)
            throws ShanksException {
        this.connectToLink(link);
        try {
            device.connectToLink(link);
        } catch (ShanksException e) {
            this.disconnectFromLink(link);
            throw e;
        }
    }
371537
public function toDevice($device)
    {
        if (is_array($device)) {
            $this->devices = array_merge($device, $this->devices);

            return $this;
        }
        $this->devices[] = $device;

        return $this;
    }
1061882
public static function set_user_device_type($newdevice) {
        $devicetype = self::get_device_type();
        if ($newdevice == $devicetype) {
            unset_user_preference('switchdevice'.$devicetype);
            return true;
        } else {
            $devicetypes = self::get_device_type_list();
            if (in_array($newdevice, $devicetypes)) {
                set_user_preference('switchdevice'.$devicetype, $newdevice);
                return true;
            }
        }
        throw new coding_exception('Invalid device type provided to set_user_device_type');
    }