Get the configuration options for an identifier

@param mixed	  An object that implements AnObjectServiceable, AnServiceIdentifier object
or valid identifier string
@param array  An associative array of configuration options
10838
public static function getConfig($identifier)
    {
        $objIdentifier = self::getIdentifier($identifier);
        $strIdentifier = (string) $objIdentifier;

        return isset(self::$_configs[$strIdentifier])  ? self::$_configs[$strIdentifier]->toArray() : array();
    }
277130
private function extractIdentifiers(array $parameters, array $attributes)
    {
        if (isset($attributes['item_operation_name'])) {
            if (!isset($parameters['id'])) {
                throw new InvalidIdentifierException('Parameter "id" not found');
            }

            $id = $parameters['id'];

            if (null !== $this->identifierConverter) {
                return $this->identifierConverter->convert((string) $id, $attributes['resource_class']);
            }

            return $id;
        }

        if (!isset($attributes['subresource_context'])) {
            throw new RuntimeException('Either "item_operation_name" or "collection_operation_name" must be defined, unless the "_api_receive" request attribute is set to false.');
        }

        $identifiers = [];

        foreach ($attributes['subresource_context']['identifiers'] as $key => [$id, $resourceClass, $hasIdentifier]) {
            if (false === $hasIdentifier) {
                continue;
            }

            $identifiers[$id] = $parameters[$id];

            if (null !== $this->identifierConverter) {
                $identifiers[$id] = $this->identifierConverter->convert((string) $identifiers[$id], $resourceClass);
            }
        }

        return $identifiers;
    }
1311665
public static function getEntityIdentifier($identifier)
    {
        $identifier = AnService::getIdentifier($identifier);

        if (!$identifier->basepath) {
            $adapters = AnService::get('anahita:loader')->getAdapters();
            $basepath = pick($adapters[$identifier->type]->getBasePath(), ANPATH_BASE);
            $applications = array_flip(AnServiceIdentifier::getApplications());

            if (isset($applications[$basepath])) {
                $identifier->application = $applications[$basepath];
                $identifier->basepath = $basepath;
            }
        }

        return $identifier;
    }
639386
public function getEntityOptionsAsStrings(): array
    {
        $options = $this->getEntityOptions();
        foreach ($options as $key => $option) {
            $options[$key] = (string) $option;
        }
        return $options;
    }
962793
protected static function _parseIdentifier($identifier)
    {
        $parts = array();
        $hash  = $identifier;

        // Validate the variable format
        if (strpos($identifier, '.') !== false) {
            // Split the variable name into it's parts
            $parts = explode('.', $identifier);

            // Validate the hash name
            $hash   = array_shift($parts);
        }

        $hash = strtoupper($hash);

        return array($hash, $parts);
    }
511719
protected function getExpectedIdentifiers($context = null)
    {
        if ($context === null) {
            throw new Exception\RuntimeException(
                'Expected context to be an array but is null'
            );
        }

        $className = $this->objectRepository->getClassName();

        if ($context instanceof $className) {
            return $this->objectManager
                        ->getClassMetadata($this->objectRepository->getClassName())
                        ->getIdentifierValues($context);
        }

        $result = [];
        foreach ($this->getIdentifiers() as $identifierField) {
            if (! array_key_exists($identifierField, $context)) {
                throw new Exception\RuntimeException(\sprintf('Expected context to contain %s', $identifierField));
            }

            $result[$identifierField] = $context[$identifierField];
        }
        return $result;
    }
1262221
protected function getConfig($name)
    {
        if (empty($name)) {
            throw new InvalidArgumentException("Service 'name' can not be empty.");
        }

        $services = $this->app['config']['df.service'];

        return array_get($services, $name);
    }
1051236
protected static function _identifier(AnServiceIdentifier $identifier)
    {
        $identifier = clone $identifier;

        if (!$identifier->name) {
            $identifier->name = AnInflector::singularize($identifier->package);
        }

        $identifier->type = 'com';
        $identifier->path = array('domain','entity');

        return $identifier;
    }
45939
public function getIdValue($object)
    {
        if (!$object) {
            return;
        }

        if (!$this->om->contains($object)) {
            throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', \get_class($object)));
        }

        $this->om->initializeObject($object);

        $idValue = current($this->classMetadata->getIdentifierValues($object));

        if ($this->associationIdReader) {
            $idValue = $this->associationIdReader->getIdValue($idValue);
        }

        return $idValue;
    }
56720
public function getConfigurationObjectForIdentifier(string $identifier): ObjectInterface
    {
        if (isset($this->identifiers[$identifier]) === true) {
            return $this->identifiers[$identifier];
        }

        return new Blackhole();
    }
241611
public function checkIdPSettings($settings)
    {
        assert('is_array($settings)');

        if (!is_array($settings) || empty($settings)) {
            return array('invalid_syntax');
        }

        $errors = array();

        if (!isset($settings['idp']) || empty($settings['idp'])) {
            $errors[] = 'idp_not_found';
        } else {
            $idp = $settings['idp'];
            if (!isset($idp['entityId']) || empty($idp['entityId'])) {
                $errors[] = 'idp_entityId_not_found';
            }

            if (!isset($idp['singleSignOnService'])
                || !isset($idp['singleSignOnService']['url'])
                || empty($idp['singleSignOnService']['url'])
            ) {
                $errors[] = 'idp_sso_not_found';
            } else if (!filter_var($idp['singleSignOnService']['url'], FILTER_VALIDATE_URL)) {
                $errors[] = 'idp_sso_url_invalid';
            }

            if (isset($idp['singleLogoutService'])
                && isset($idp['singleLogoutService']['url'])
                && !empty($idp['singleLogoutService']['url'])
                && !filter_var($idp['singleLogoutService']['url'], FILTER_VALIDATE_URL)
            ) {
                $errors[] = 'idp_slo_url_invalid';
            }

            if (isset($settings['security'])) {
                $security = $settings['security'];

                $existsX509 = isset($idp['x509cert']) && !empty($idp['x509cert']);
                $existsMultiX509Sign = isset($idp['x509certMulti']) && isset($idp['x509certMulti']['signing']) && !empty($idp['x509certMulti']['signing']);
                $existsMultiX509Enc = isset($idp['x509certMulti']) && isset($idp['x509certMulti']['encryption']) && !empty($idp['x509certMulti']['encryption']);

                $existsFingerprint = isset($idp['certFingerprint']) && !empty($idp['certFingerprint']);
                if (!($existsX509 || $existsFingerprint || $existsMultiX509Sign)
                ) {
                    $errors[] = 'idp_cert_or_fingerprint_not_found_and_required';
                }
                if ((isset($security['nameIdEncrypted']) && $security['nameIdEncrypted'] == true)
                    && !($existsX509 || $existsMultiX509Enc)
                ) {
                    $errors[] = 'idp_cert_not_found_and_required';
                }
            }
        }

        return $errors;
    }
640884
private List<String> getIds(ConfigurationAdmin ca, String[] pids) {
        final String methodName = "getIds(): ";
        if (pids == null) {
            return Collections.emptyList();
        }
        List<String> ids = new ArrayList<String>();
        for (String pid : pids) {
            try {
                String filter = "(" + org.osgi.framework.Constants.SERVICE_PID + "=" + pid + ")";
                Configuration[] config = ca.listConfigurations(filter);
                if (config == null) {
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, methodName + "Configuration not found for pid " + pid);
                } else {
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, methodName + "Found config for " + pid);
                    String id = (String) config[0].getProperties().get("id");
                    ids.add(id);
                }
            } catch (IOException e) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
            } catch (InvalidSyntaxException e) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
            }
        }
        return Collections.unmodifiableList(ids);
    }
1135495
function get_options_keys() {
            if ( is_array( $this->_options ) ) {
                return array_keys( $this->_options );
            } else if ( is_object( $this->_options ) ) {
                return array_keys( get_object_vars( $this->_options ) );
            }

            return array();
        }
283379
public function refresh($identifiers = null) {
		
		if(true === is_string($identifiers)) {
			$identifiers = [$identifiers];
		}

		if(null !== $identifiers && false === is_array($identifiers)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($identifiers)), E_USER_ERROR);
		}

		if(null === $this -> getAdapter()) {
			return trigger_error('Adapter is not set. Set the adapter with the setAdapter() method', E_USER_ERROR);
		}

		$class  	 = new \ReflectionClass(get_class($this));
		$values  	 = $identifiers ? $identifiers : $this -> toArray();
		$identifiers = $identifiers ? array_keys($identifiers) : $this -> getIdentifier();	
		$where 		 = [];
		$escape 	 = [];

		if(0 === count($identifiers)) {
			return trigger_error(sprintf('Identifier is NULL. Can not refresh entity without a valid value as identifier in %s', $class -> getFileName()), E_USER_ERROR);
		}

		if(true === is_array($identifiers)) {

			foreach($identifiers as $identifier) {

				if(true === isset($values[$identifier])) {
					
					$where[]  = $this -> getAdapter() -> escape($identifier) . ' = ?';
					$escape[] = $values[$identifier];
				}
			}
		}

		if(0 === count($where)) {
			return trigger_error('No valid identifiers found. Either no identifier is set or one or more identifier values are empty.', E_USER_ERROR);
		}

		$query = sprintf('SELECT * FROM %s WHERE %s LIMIT 1', $this -> getAdapter() -> escape($this -> getTable()), implode($where, ' AND '));

		return $this -> fromArray($this -> getAdapter() -> query($query, $escape) -> toArray() -> current());
	}
1295218
public function getIdentifierValues($object)
    {
        $fields = $this->getReflectionFields();
        return $fields[$this->identifierPropertyName]->getValue($object);
    }
437680
protected function autowireArguments(array &$objectConfigurations)
    {
        foreach ($objectConfigurations as $objectConfiguration) {
            /** @var Configuration $objectConfiguration */
            if ($objectConfiguration->getClassName() === '') {
                continue;
            }

            if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
                continue;
            }


            $className = $objectConfiguration->getClassName();
            if (!$this->reflectionService->hasMethod($className, '__construct')) {
                continue;
            }

            $autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, '__construct', Flow\Autowiring::class);
            if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
                continue;
            }

            $arguments = $objectConfiguration->getArguments();
            foreach ($this->reflectionService->getMethodParameters($className, '__construct') as $parameterName => $parameterInformation) {
                $debuggingHint = '';
                $index = $parameterInformation['position'] + 1;
                if (!isset($arguments[$index])) {
                    if ($parameterInformation['optional'] === true) {
                        $defaultValue = (isset($parameterInformation['defaultValue'])) ? $parameterInformation['defaultValue'] : null;
                        $arguments[$index] = new ConfigurationArgument($index, $defaultValue, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif ($parameterInformation['class'] !== null && isset($objectConfigurations[$parameterInformation['class']])) {
                        $arguments[$index] = new ConfigurationArgument($index, $parameterInformation['class'], ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
                    } elseif ($parameterInformation['allowsNull'] === true) {
                        $arguments[$index] = new ConfigurationArgument($index, null, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif (interface_exists($parameterInformation['class'])) {
                        $debuggingHint = sprintf('No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ', $parameterInformation['class']);
                    }
                }

                if (!isset($arguments[$index]) && $objectConfiguration->getScope() === Configuration::SCOPE_SINGLETON) {
                    throw new UnresolvedDependenciesException(sprintf('Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.', $parameterName, $className, $debuggingHint), 1298629392);
                }
            }

            $objectConfiguration->setArguments($arguments);
        }
    }
330150
public function assignIdentifier($object, array $identifier) : void
    {
        if (! $object instanceof IdentifiableInterface) {
            throw new InvalidArgumentException(sprintf('%s must implement IdentifiableInterface.', get_class($object)));
        }

        $object->assignIdentifier($identifier);
    }