Returns an associative array of capabilityName => capabilityValue for the given $deviceID

@param string $deviceID

@return array associative array of capabilityName, capabilityValue
963628
public function getAllCapabilitiesForDevice($deviceID)
    {
        $devices      = array_reverse($this->getDeviceHierarchy($deviceID));
        $capabilities = array();

        foreach ($devices as $device) {
            /** @var $device \Wurfl\Device\ModelDeviceInterface */
            if (is_array($device->capabilities)) {
                $capabilities = array_merge($capabilities, $device->capabilities);
            }
        }
        $capabilities = array_diff_key($capabilities, array_flip(VirtualCapabilityProvider::getControlCapabilities()));

        return $capabilities;
    }
271385
public function mapDeviceName(?string $deviceName): ?string
    {
        if (null === $deviceName) {
            return null;
        }

        $brandName = null;

        switch (mb_strtolower($deviceName)) {
            case '':
            case 'unknown':
            case 'other':
            case 'various':
            case 'android 1.6':
            case 'android 2.0':
            case 'android 2.1':
            case 'android 2.2':
            case 'android 2.3':
            case 'android 3.0':
            case 'android 3.1':
            case 'android 3.2':
            case 'android 4.0':
            case 'android 4.1':
            case 'android 4.2':
            case 'android 4.3':
            case 'android 4.4':
            case 'android 5.0':
            case 'android 2.2 tablet':
            case 'android 4 tablet':
            case 'android 4.1 tablet':
            case 'android 4.2 tablet':
            case 'android 4.3 tablet':
            case 'android 4.4 tablet':
            case 'android 5.0 tablet':
            case 'disguised as macintosh':
            case 'mini 1':
            case 'mini 4':
            case 'mini 5':
            case 'windows mobile 6.5':
            case 'windows mobile 7':
            case 'windows mobile 7.5':
            case 'windows phone 7':
            case 'windows phone 8':
            case 'fennec tablet':
            case 'tablet on android':
            case 'fennec':
            case 'opera for series 60':
            case 'opera mini for s60':
            case 'windows mobile (opera)':
            case 'nokia unrecognized ovi browser':
                $brandName = null;
                break;
            // Medion
            case 'p9514':
            case 'lifetab p9514':
            case 'lifetab s9512':
                $brandName = 'Medion';
                break;
            // HTC
            case 'htc desire sv':
                $brandName = 'HTC';
                break;
            // Apple
            case 'ipad':
            case 'iphone':
                $brandName = 'Apple';
                break;
            default:
                // nothing to do here
                break;
        }

        return $brandName;
    }
1015897
public function getParams($capability)
    {
        return ($this->query($capability) && is_array($out = $this->_data[Horde_String::upper($capability)]))
            ? $out
            : array();
    }
309543
public static function hasAccessInCapabilities(string $capability, string $userId): bool
    {
        $userCaps = static::fetchUserCapabilities($userId);
        if (in_array($capability, $userCaps)) {
            return true;
        }

        return false;
    }
1271038
public function getFromId( $diskId){
        $rest = $this->getService( self::API_STORAGE_DISK . $diskId);
        $rest->GET();

        return $rest->getResult( models\Storage\StorageDisk::class);
    }
1133565
public DeviceEnvelope deleteDevice(String deviceId) throws ApiException {
        ApiResponse<DeviceEnvelope> resp = deleteDeviceWithHttpInfo(deviceId);
        return resp.getData();
    }
19119
public static function list_user_evidence($userid) {
        static::require_enabled();
        if (!user_evidence::can_read_user($userid)) {
            $context = context_user::instance($userid);
            throw new required_capability_exception($context, 'moodle/competency:userevidenceview', 'nopermissions', '');
        }

        $evidence = user_evidence::get_records(array('userid' => $userid), 'name');
        return $evidence;
    }
185311
public function getLocationPath($locationId): array
    {
        try {
            $location = $this->loadLocation($locationId);

            $locationPath = $location->path;
            array_shift($locationPath);

            $translatedNames = [];

            foreach ($locationPath as $locationPathId) {
                $locationInPath = $this->loadLocation($locationPathId);
                $translatedNames[] = $this->getContentName($locationInPath->contentInfo->id);
            }

            return $translatedNames;
        } catch (Throwable $t) {
            return [];
        }
    }
461426
public function getFallBackDevices($deviceId)
    {
        $fallBackDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);

        array_shift($fallBackDevices);

        return array_map(array($this, 'deviceId'), $fallBackDevices);
    }
55334
public function getDevice($deviceID, $request=null)
    {
        if ($request !== null) {
            if (!($request instanceof WURFL_Request_GenericRequest)) {
                throw new InvalidArgumentException("Error: Request parameter must be null or instance of WURFL_Request_GenericRequest");
            }

            // Normalization must be performed if request is passed so virtual capabilities can be
            // resolved correctly.  This is normally handled in self::deviceIdForRequest()
            $generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();
            $request->userAgentNormalized = $generic_normalizer->normalize($request->userAgent);
        }
        return $this->getWrappedDevice($deviceID, $request);
    }
761666
public static function getDeviceById($id)
    {
        $device = static::lookupDevice('id', $id);
        if (!empty($device) && isset($device['class_name'])) {
            /** @var DeviceInterface $class */
            $class = $device['class_name'];
            $client = static::getClientByDevice($device);
            return new $class($id, $client);
        }

        // Search device in wemo link
        $bridge = new Bridge('wemo_link', new WemoClient($device['ip'], $device['port']));
        $devices = $bridge->getPairedDevices();

        foreach ($devices as $d) {
            if ($id === $d['id']) {
                if ($d['productName'] === 'Lighting') {
                    return new WemoBulb('wemo_link', $id);
                }
            }
        }

        throw new \Exception('Invalid device id supplied. No base device found by id ' . $id);
    }
3898
public function getPairedDevices($refresh = false)
    {
        if ($refresh === false) {
            $device = Discovery::lookupDevice('ip', $this->ip);
            if (isset($device['device']) && is_array($device['device'])) {
                return $device['device'];
            }
        }

        $service = $this->services['BridgeService']['serviceType'];
        $controlUrl = $this->services['BridgeService']['controlURL'];
        $method = 'GetEndDevices';
        $arguments = [
            'DevUDN'      => $this->getUDN($refresh),
            'ReqListType' => 'PAIRED_LIST'
        ];

        $rs = $this->client->request($controlUrl, $service, $method, $arguments);
        $rs = $this->unwrapResponse($rs);
        $rs = WemoClient::xmlToArray($rs['u:GetEndDevicesResponse']['DeviceLists']);

        // Standalone devices.
        $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos'];
        if(static::isArrayAssoc($devices)) {
            $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos']['DeviceInfo'];
        }
        foreach ($devices as $k => $d) {
            $d['IsGroupAction'] = 'NO';
            $devices[$k] = $d;
        }
        // Grouped devices.
        $groupedDeviceList = [];
        $groupedDevices = $rs['DeviceLists']['DeviceList']['GroupInfos'];
        if(static::isArrayAssoc($groupedDevices)) {
            $groupedDeviceList[] = $rs['DeviceLists']['DeviceList']['GroupInfos']['GroupInfo'];
        }
        foreach ($groupedDeviceList as $gd) {
            if(!empty($gd['GroupID']) && !empty($gd['GroupName']) && !empty($gd['GroupCapabilityValues'])) {
                $devices[] = [
                    'DeviceID'      => $gd['GroupID'],
                    'FriendlyName'  => $gd['GroupName'],
                    'CurrentState'  => $gd['GroupCapabilityValues'],
                    'productName'   => $gd['DeviceInfos']['DeviceInfo'][0]['productName'],
                    'IsGroupAction' => 'YES'
                ];
                if(isset($gd['DeviceInfos']) && isset($gd['DeviceInfos']['DeviceInfo'])){
                    foreach($gd['DeviceInfos']['DeviceInfo'] as $gdi){
                        $gdi['IsGroupAction'] = 'NO';
                        $devices[] = $gdi;
                    }
                }
            }
        }
        return $devices;
    }
1310823
public function mapDeviceName(?string $deviceName): ?string
    {
        if (null === $deviceName) {
            return null;
        }

        $marketingName = null;

        switch (mb_strtolower($deviceName)) {
            case '':
            case 'unknown':
            case 'other':
            case 'various':
            case 'android 1.6':
            case 'android 2.0':
            case 'android 2.1':
            case 'android 2.2':
            case 'android 2.3':
            case 'android 3.0':
            case 'android 3.1':
            case 'android 3.2':
            case 'android 4.0':
            case 'android 4.1':
            case 'android 4.2':
            case 'android 4.3':
            case 'android 4.4':
            case 'android 5.0':
            case 'android 2.2 tablet':
            case 'android 4 tablet':
            case 'android 4.1 tablet':
            case 'android 4.2 tablet':
            case 'android 4.3 tablet':
            case 'android 4.4 tablet':
            case 'android 5.0 tablet':
            case 'disguised as macintosh':
            case 'mini 1':
            case 'mini 4':
            case 'mini 5':
            case 'windows mobile 6.5':
            case 'windows mobile 7':
            case 'windows mobile 7.5':
            case 'windows phone 7':
            case 'windows phone 8':
            case 'fennec tablet':
            case 'tablet on android':
            case 'fennec':
            case 'opera for series 60':
            case 'opera mini for s60':
            case 'windows mobile (opera)':
            case 'mobi for android':
            case 'nokia unrecognized ovi browser':
            case 'mozilla firefox for android':
            case 'firefox for android tablet':
            case 'firefox for android':
                $marketingName = null;
                break;
            // Acer
            case 'acer e320':
                $marketingName = 'Liquid Express';
                break;
            // HP
            case 'touchpad':
                $marketingName = 'Touchpad';
                break;
            // Medion
            case 'p9514':
            case 'lifetab p9514':
                $marketingName = 'LifeTab P9514';
                break;
            case 'lifetab s9512':
                $marketingName = 'LifeTab S9512';
                break;
            // HTC
            case 'htc desire sv':
                $marketingName = 'Desire SV';
                break;
            // Apple
            case 'ipad':
                $marketingName = 'iPad';
                break;
            case 'iphone':
                $marketingName = 'iPhone';
                break;
            case 'e610':
                $marketingName = 'Optimus L5';
                break;
            default:
                // nothing to do here
                break;
        }

        return $marketingName;
    }
1147778
public static function getProviderById($providerId)
    {
        foreach (self::getAllProviders() as $provider) {
            if ($provider->getId() == $providerId && $provider->isAvailable()) {
                return $provider;
            }
        }
        
        return null;
    }
1296124
private function capabilityFilter($capabilityFilter)
    {
        $filter = array();
        if ($capabilityFilter) {
            foreach ($capabilityFilter as $filterElement) {
                $filter[] = (string)$filterElement;
            }
        }
        return $filter;
    }
873171
public function getTransportConfig($storeId)
    {
        $config = [
            'port' => $this->getSmtpPort($storeId),
            'auth' => 'login',
            'username' => $this->getSmtpUsername($storeId),
            'password' => $this->getSmtpPassword($storeId),
            'ssl' => 'tls',
        ];

        if ($this->isDebugEnabled($storeId)) {
            $this->_logger->debug('Mail transport config : ' . implode(',', $config));
        }

        return $config;
    }
596889
public function setDeviceStatus($deviceId, $state = null, $level = null)
    {
        $groupAction = 'NO';
        $devices = $this->getPairedDevices();
        foreach ($devices as $d) {
            if ($deviceId === $d['DeviceID']) {
                $groupAction = $d['IsGroupAction'];
            }
        }

        if (intval($level) > 0 && $state === 0) {
            $state = '1';
        }

        $capids = [];
        $capval = [];
        if ($state !== null) {
            $capids[] = '10006';
            $capval[] = $state;
        }
        if ($level !== null) {
            $capids[] = '10008';
            $capval[] = $level . ':0';
        }

        $capIdsString = implode(',', $capids);
        $capValString = implode(',', $capval);

        $service = $this->services['BridgeService']['serviceType'];
        $controlUrl = $this->services['BridgeService']['controlURL'];
        $method = 'SetDeviceStatus';
        $arguments = [
            'DeviceStatusList' => '&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;DeviceStatusList&gt;&lt;DeviceStatus&gt;&lt;IsGroupAction&gt;' .
                $groupAction .
                '&lt;/IsGroupAction&gt;&lt;DeviceID available=&quot;YES&quot;&gt;' .
                $deviceId .
                '&lt;/DeviceID&gt;&lt;CapabilityID&gt;' .
                $capIdsString .
                '&lt;/CapabilityID&gt;&lt;CapabilityValue&gt;' .
                $capValString .
                '&lt;/CapabilityValue&gt;&lt;LastEventTimeStamp&gt;0&lt;/LastEventTimeStamp&gt;&lt;/DeviceStatus&gt;&lt;/DeviceStatusList&gt;'
        ];

        $rs = $this->client->request($controlUrl, $service, $method, $arguments);
        $rs = $this->unwrapResponse($rs);

        if (isset($rs['s:Fault'])) {
            throw new \Exception('Failed to change bulb state. ' . print_r($rs, true));
        }

        return true;
    }