Returns an array of indexes for of matches of higher precedence than the existing pairing.

@param MatchedPreferenceInterface[] $matchingList
@param PreferenceInterface $clientPref

@return int[]
11049
private function getMatchingIndexes(array $matchingList, PreferenceInterface $clientPref)
    {
        $matchingIndexList = array();

        foreach ($matchingList as $key => $matching) {
            $serverPref = $matching->getServerPreference();
            list($clientMimeType) = explode('/', $clientPref->getVariant());
            list($serverMimeType) = explode('/', $serverPref->getVariant());

            if ($clientMimeType == $serverMimeType
                && $clientPref->getPrecedence() > $matching->getClientPreference()->getPrecedence()) {
                $matchingIndexList[] = $key;
            }
        }

        return $matchingIndexList;
    }
357340
public function clientList(array $filter = array())
  {
    if($this->clientList === null)
    {
      $clients = $this->request("clientlist -uid -away -badges -voice -info -times -groups -icon -country -ip")->toAssocArray("clid");

      $this->clientList = array();

      foreach($clients as $clid => $client)
      {
        if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;

        $this->clientList[$clid] = new Client($this, $client);
      }

      uasort($this->clientList, array(__CLASS__, "sortClientList"));

      $this->resetNodeList();
    }

    return $this->filterList($this->clientList, $filter);
  }
1152999
public function index(): array
    {
        /** @var Client[] $clients */
        $clients = parent::index();
        foreach ($clients as $client) {
            $this->addScopeAndRedirectUris($client);
        }

        return $clients;
    }
1247566
private function compareVariant(MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue)
    {
        return strcasecmp($lValue->getVariant(), $rValue->getVariant());
    }
1306791
public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = [])
    {
        $mappingConfiguration = $this->getIndexQueueFieldsConfigurationByConfigurationName($configurationName);
        $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration);
        return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames;
    }
513813
private String analyzeSharedPreferences(final TypeElement sharedPreference) {
		Element beanElement = sharedPreference;
		String result = beanElement.getSimpleName().toString();

		// create equivalent entity in the domain of bind processor
		final BindEntity bindEntity = BindEntityBuilder.parse(null, sharedPreference);
		final PrefsEntity currentEntity = new PrefsEntity(beanElement.getSimpleName().toString(), (TypeElement) beanElement,
				AnnotationUtility.buildAnnotationList((TypeElement) beanElement, classAnnotationFilter));

		final boolean bindAllFields = AnnotationUtility.getAnnotationAttributeAsBoolean(currentEntity, BindType.class, AnnotationAttributeType.ALL_FIELDS, Boolean.TRUE);

		PropertyUtility.buildProperties(elementUtils, currentEntity, new PropertyFactory<PrefsEntity, PrefsProperty>() {

			@Override
			public PrefsProperty createProperty(PrefsEntity entity, Element propertyElement) {
				return new PrefsProperty(currentEntity, propertyElement, AnnotationUtility.buildAnnotationList(propertyElement));
			}
		}, propertyAnnotationFilter, new PropertyCreatedListener<PrefsEntity, PrefsProperty>() {

			@Override
			public boolean onProperty(PrefsEntity entity, PrefsProperty property) {
				// if @BindDisabled is present, exit immediately
				if (property.hasAnnotation(BindDisabled.class)) {
					if (bindAllFields) {
						return false;
					} else {
						throw new InvalidDefinition(String.format("@%s can not be used with @%s(allField=false)", BindDisabled.class.getSimpleName(), BindType.class.getSimpleName()));
					}
				}

				if (property.getPropertyType().isArray() || property.getPropertyType().isList()) {
					property.setPreferenceType(PreferenceType.STRING);
				} else {
					if (property.isType(Boolean.TYPE, Boolean.class)) {
						property.setPreferenceType(PreferenceType.BOOL);
					} else if (property.isType(Short.TYPE, Short.class)) {
						property.setPreferenceType(PreferenceType.INT);
					} else if (property.isType(Character.TYPE, Character.class)) {
						property.setPreferenceType(PreferenceType.STRING);
					} else if (property.isType(Integer.TYPE, Integer.class)) {
						property.setPreferenceType(PreferenceType.INT);
					} else if (property.isType(Long.TYPE, Long.class)) {
						property.setPreferenceType(PreferenceType.LONG);
					} else if (property.isType(Float.TYPE, Float.class)) {
						property.setPreferenceType(PreferenceType.FLOAT);
					} else if (property.isType(Double.TYPE, Double.class)) {
						property.setPreferenceType(PreferenceType.STRING);
					} else {
						property.setPreferenceType(PreferenceType.STRING);
					}
				}

				if (!bindAllFields && !property.hasAnnotation(BindPreference.class)) {
					// skip field
					return false;
				}

				// if field disable, skip property definition
				ModelAnnotation annotation = property.getAnnotation(BindPreference.class);
				if (annotation != null && AnnotationUtility.extractAsBoolean(property, annotation, AnnotationAttributeType.ENABLED) == false) {
					return false;
				}

				if (bindEntity.contains(property.getName())) {
					BindProperty bindProperty = bindEntity.get(property.getName());
					if (bindProperty.isBindedArray() || bindProperty.isBindedCollection() || bindProperty.isBindedMap() || bindProperty.isBindedObject()) {
						property.bindProperty = bindProperty;
					}

				} else {
					throw (new KriptonRuntimeException(String.format("In class '%s' property '%s' has a wrong definition to create SharedPreference", sharedPreference.asType(), property.getName())));
				}

				return true;
			}

		});
		
		ImmutableUtility.buildConstructors(elementUtils, currentEntity);

		model.entityAdd(currentEntity);
		return result;

	}
1006399
def match_client_preferences_with_provider_capabilities(self, client_preferences):
        # type: (oic.message.RegistrationRequest) -> Mapping[str, Union[str, List[str]]]
        
        matched_prefs = client_preferences.to_dict()
        for pref in ['response_types', 'default_acr_values']:
            if pref not in client_preferences:
                continue

            capability = PREFERENCE2PROVIDER[pref]
            # only preserve the common values
            matched_values = find_common_values(client_preferences[pref], self.configuration_information[capability])
            # deal with space separated values
            matched_prefs[pref] = [' '.join(v) for v in matched_values]

        return matched_prefs
801832
public function getRootAssociations($apiServiceFilterContext = null)
    {
        $result = [];

        foreach ($this->getRootAssociationIDs() as $key => $rootAssociationID) {
            try {
                $result[] = $this->getAssociation($rootAssociationID, $apiServiceFilterContext);
            } catch (ContextException $e) {
                if ($key === count($this->getRootAssociationIDs()) - 1) {
                    throw $e;
                }
            }
        }

        return $result;
    }
1170974
public function sortAscending(array $prefList)
    {
        $comparator = new MatchedPreferenceComparator();

        usort(
            $prefList,
            function (MatchedPreferenceInterface $lValue, MatchedPreferenceInterface $rValue) use ($comparator) {
                return -1 * $comparator->compare($lValue, $rValue);
            }
        );

        return $prefList;
    }
980317
public function getRelatedCompanyIdsByIdProductList(int $idProductList): array
    {
        /** @var \Orm\Zed\ProductList\Persistence\SpyProductListCompanyQuery $productListCompanyQuery */
        $productListCompanyQuery = $this->getFactory()
            ->createProductListCompanyQuery()
            ->select(SpyProductListCompanyTableMap::COL_FK_COMPANY);

        return $productListCompanyQuery
            ->findByFkProductList($idProductList)
            ->toArray();
    }
702238
private function processPreferences($preferences, $processedPreferences)
    {
        foreach ($preferences as $preference) {
            $formattedPreference = [];
            $formattedPreference['isPreference'] = $preference->isPreference;
            if (! $preference->isPreference) {
                if (! isset($preference->preferences)) {
                    continue;
                }
                $formattedPreference['catLabel'] = $preference->publicName;
                $formattedCatPreferences = [];
                foreach ($preference->preferences as $catPreference) {
                    $formattedCatPreference = [];
                    $formattedCatPreference['label'] = $catPreference->publicName;
                    isset($catPreference->isOptedIn)? $formattedCatPreference['isOptedIn'] = $catPreference->isOptedIn :
                        $formattedCatPreference['isOptedIn'] = false;
                    $formattedCatPreferences[$catPreference->id] = $formattedCatPreference;
                }
                $formattedPreference['catPreferences'] = $formattedCatPreferences;
            } else {
                $formattedPreference['label'] = $preference->publicName;
                isset($catPreference->isOptedIn)? $formattedPreference['isOptedIn'] = $preference->isOptedIn :
                    $formattedPreference['isOptedIn'] = false;
            }
            $processedPreferences[$preference->id] = $formattedPreference;
        }
        return $processedPreferences;
    }
441957
public function getMatches($content, $sourceKey)
    {
        $filteredResults = array();

        $this->getSelector()->setContent($content);
        $this->getSelector()->setSourceKey($sourceKey);

        $matches = $this->getSelector()->getMatches();

        if ($matches) {
            foreach ($matches as $matchLine) {
                $filteredResult = $this->fetch($matchLine);

                if ($filteredResult) {
                    $filteredResults[] = $filteredResult;
                }
            }
        } else {
            $this->addLog('The HTML or Selector expression is broken');
        }

        return $filteredResults;
    }
817721
@Override
    public List find(List<IndexClause> ixClause, EntityMetadata m, boolean isRelation, List<String> relations,
            int maxResult, List<String> columns)
    {
        List<Object> entities = new ArrayList<Object>();
        Connection conn = null;
        try
        {
            // ixClause can be 0,1 or more!
            SlicePredicate slicePredicate = new SlicePredicate();

            if (columns != null && !columns.isEmpty())
            {
                List asList = new ArrayList(32);
                for (String colName : columns)
                {
                    if (colName != null)
                    {
                        asList.add(UTF8Type.instance.decompose(colName));
                    }
                }
                slicePredicate.setColumn_names(asList);
            }
            else
            {
                SliceRange sliceRange = new SliceRange();
                sliceRange.setStart(ByteBufferUtil.EMPTY_BYTE_BUFFER);
                sliceRange.setFinish(ByteBufferUtil.EMPTY_BYTE_BUFFER);
                slicePredicate.setSlice_range(sliceRange);
            }
            conn = getConnection();

            if (ixClause.isEmpty())
            {
                KeyRange keyRange = new KeyRange(maxResult);
                keyRange.setStart_key(ByteBufferUtil.EMPTY_BYTE_BUFFER);
                keyRange.setEnd_key(ByteBufferUtil.EMPTY_BYTE_BUFFER);

                if (m.isCounterColumnType())
                {
                    List<KeySlice> ks = conn.getClient().get_range_slices(new ColumnParent(m.getTableName()),
                            slicePredicate, keyRange, getConsistencyLevel());
                    entities = onCounterColumn(m, isRelation, relations, ks);

                }
                else
                {
                    List<KeySlice> keySlices = conn.getClient().get_range_slices(new ColumnParent(m.getTableName()),
                            slicePredicate, keyRange, getConsistencyLevel());

                    if (m.getType().isSuperColumnFamilyMetadata())
                    {
                        Map<ByteBuffer, List<SuperColumn>> qResults = ThriftDataResultHelper.transformThriftResult(
                                ColumnFamilyType.SUPER_COLUMN, keySlices, null);
                        entities = new ArrayList<Object>(qResults.size());
                        computeEntityViaSuperColumns(m, isRelation, relations, entities, qResults);
                    }
                    else
                    {
                        Map<ByteBuffer, List<Column>> qResults = ThriftDataResultHelper.transformThriftResult(
                                ColumnFamilyType.COLUMN, keySlices, null);
                        entities = new ArrayList<Object>(qResults.size());
                        computeEntityViaColumns(m, isRelation, relations, entities, qResults);
                    }
                }
            }
            else
            {
                entities = new ArrayList<Object>();
                for (IndexClause ix : ixClause)
                {
                    List<KeySlice> keySlices = conn.getClient().get_indexed_slices(new ColumnParent(m.getTableName()),
                            ix, slicePredicate, getConsistencyLevel());

                    Map<ByteBuffer, List<Column>> qResults = ThriftDataResultHelper.transformThriftResult(
                            ColumnFamilyType.COLUMN, keySlices, null);
                    // iterate through complete map and populate.
                    entities = new ArrayList<Object>(qResults.size());

                    computeEntityViaColumns(m, isRelation, relations, entities, qResults);
                }
            }
        }
        catch (InvalidRequestException irex)
        {
            log.error("Error during executing find of column family {}, Caused by: .", m.getTableName(), irex);
            throw new PersistenceException(irex);
        }
        catch (UnavailableException uex)
        {
            log.error("Error during executing find of column family {}, Caused by: .", m.getTableName(), uex);
            throw new PersistenceException(uex);
        }
        catch (TimedOutException tex)
        {
            log.error("Error during executing find of column family {}, Caused by: .", m.getTableName(), tex);
            throw new PersistenceException(tex);
        }
        catch (TException tex)
        {
            log.error("Error during executing find of column family {}, Caused by: .", m.getTableName(), tex);
            throw new PersistenceException(tex);
        }
        finally
        {

            releaseConnection(conn);
        }
        return entities;
    }
888648
private function selectChildSettings(array $instanceList): ?SettingsInterface
    {
        $count = count($instanceList);
        assert($count > 1);
        $selected = $this->selectChildSettingsAmongTwo($instanceList[0], $instanceList[1]);
        if ($selected !== null) {
            for ($index = 2; $index < $count; ++$index) {
                $selected = $this->selectChildSettingsAmongTwo($selected, $instanceList[$index]);
                if ($selected === null) {
                    break;
                }
            }
        }

        return $selected;
    }
115627
static public function jiraGetIssueList(array $configuration, array $keyList, array $parameterList = [])
    {
        $issueList = [];

        if (empty($keyList)) {
            return $issueList;
        }

        foreach (array_chunk($keyList, 50) as $chunk) {
            $parameterList['jql'] = 'key IN(' . implode(', ', $chunk) . ')';

            $json = self::jiraGet(
                $configuration['host'] . $configuration['endpoint']['search'],
                $configuration['loginHash'],
                $parameterList
            );

            if (!isset($json->issues)) {
                throw new ContextRuntimeException(
                    'No issues found',
                    StatusCode::INTERNAL_SERVER_ERROR,
                    ['response' => $json]
                );
            }

            foreach ($json->issues as $issue) {
                $issueList[] = $issue;
            }
        }

        return $issueList;
    }
573099
private ArrayList<Pair<String, ?>> getKeyValues() {
		ArrayList<Pair<String, ?>> keyValPair = new ArrayList<>();
		Map<String, ?> map = preferenceUtils.getAll();
		Set<String> strings = map.keySet();
		Object value;
		for (String key : strings) {
			if (!key.contains(SharedPreferenceUtils.keyTestMode)) {
				value = map.get(key);
				keyValPair.add(new Pair<String, Object>(key, value));
			}
		}
		return keyValPair;
	}
182755
public static function getStatusList($withLabelsAsIndexes = false, array $filterStatus = null)
    {
        // Build $statusValues if this is the first call
        if (null === static::$statusValues) {
            static::$statusValues = array();
            $refClass = new \ReflectionClass(get_called_class());
            $classConstants = $refClass->getConstants();
            $className = $refClass->getShortName();

            $constantPrefix = 'STATUS_';
            foreach ($classConstants as $key => $val) {
                if (substr($key, 0, strlen($constantPrefix)) === $constantPrefix) {
                    static::$statusValues[$val] = static::getLowerCaseClassName().'.status.'.$val;
                }
            }
        }

        $statusValues = static::$statusValues;

        // Filter on specified status list
        if (isset($filterStatus)) {
            $statusValues = array_filter($statusValues, function ($key) use ($filterStatus) {
                return in_array($key, $filterStatus);
            }, ARRAY_FILTER_USE_KEY);
        }

        if ($withLabelsAsIndexes) {
            return array_flip($statusValues);
        }

        return array_keys($statusValues);
    }