@param string $keyName

@return array

@throws OneLogin_Saml2_ValidationError
355684
private function _getAttributesByKeyName($keyName="Name")
    {
        $attributes = array();

        $entries = $this->_queryAssertion('/saml:AttributeStatement/saml:Attribute');

        /** @var $entry DOMNode */
        foreach ($entries as $entry) {
            $attributeKeyNode = $entry->attributes->getNamedItem($keyName);

            if ($attributeKeyNode === null) {
                continue;
            }

            $attributeKeyName = $attributeKeyNode->nodeValue;

            if (in_array($attributeKeyName, array_keys($attributes))) {
                throw new OneLogin_Saml2_ValidationError(
                    "Found an Attribute element with duplicated ".$keyName,
                    OneLogin_Saml2_ValidationError::DUPLICATED_ATTRIBUTE_NAME_FOUND
                );
            }

            $attributeValues = array();
            foreach ($entry->childNodes as $childNode) {
                $tagName = ($childNode->prefix ? $childNode->prefix.':' : '') . 'AttributeValue';
                if ($childNode->nodeType == XML_ELEMENT_NODE && $childNode->tagName === $tagName) {
                    $attributeValues[] = $childNode->nodeValue;
                }
            }

            $attributes[$attributeKeyName] = $attributeValues;
        }
        return $attributes;
    }
874312
public function getMetaPrimaryKeys($tableName){
        $stmt = $this->query(self::META_KEYS_SQL, $tableName);
        if ($stmt === false){
            return array();
        }

        $rows = array();
        foreach ($stmt as $row){
            $seq = str_replace('nextval(\'', '', $row[1]);
            $seq = str_replace('\'::regclass)', '', $seq);
            $rows[$row[0]] = $seq;
        }

        return $rows;
    }
1306385
public function getIssuers()
    {
        $issuers = array();

        $responseIssuer = OneLogin_Saml2_Utils::query($this->document, '/samlp:Response/saml:Issuer');
        if ($responseIssuer->length > 0) {
            if ($responseIssuer->length == 1) {
                $issuers[] = $responseIssuer->item(0)->textContent;
            } else {
                throw new OneLogin_Saml2_ValidationError(
                    "Issuer of the Response is multiple.",
                    OneLogin_Saml2_ValidationError::ISSUER_MULTIPLE_IN_RESPONSE
                );
            }
        }

        $assertionIssuer = $this->_queryAssertion('/saml:Issuer');
        if ($assertionIssuer->length == 1) {
            $issuers[] = $assertionIssuer->item(0)->textContent;
        } else {
            throw new OneLogin_Saml2_ValidationError(
                "Issuer of the Assertion not found or multiple.",
                OneLogin_Saml2_ValidationError::ISSUER_NOT_FOUND_IN_ASSERTION
            );
        }

        return array_unique($issuers);
    }
416632
protected function _getFormattedErrors($controllerName)
    {
        $errors = $this->_getErrors($controllerName);
        $formattedErrors = [];
        if (is_array($errors) && count($errors)) {
            foreach ($errors as $location => $ex2) {
                foreach ($ex2 as $key => $er) {
                    $error = unserialize($er);
                    $formattedErrors[$location][$key] = $error->getOxMessage();
                }
            }
        }

        return $formattedErrors;
    }
55205
public function load($keyName)
    {
        $file = $this->buildFilePath($keyName);

        $keyValue = file_get_contents($file);

        if ($keyValue === false) {
            throw new VirgilException('Could not read key.');
        }

        $keyValueData = json_decode($keyValue, true);

        return new KeyEntry($keyName, $keyValueData['value'], $keyValueData['meta']);
    }
1087341
public function &toArrayOf($fieldName, $keyField = null)
    {
        $arr = [];
        foreach ($this as $object) {
            if ($keyField === null) {
                $arr[] = $object->$fieldName;
            } else {
                $arr[$object->$keyField] = $object->$fieldName;
            }
        }

        return $arr;
    }
637203
protected function postKeyToLaravelForgeServer($keyName=null)
    {
        $keyName ? $keyName : $this->getUniqueKeyNameFromEmail();
        return $this->http->post($this->url,
            [
                'form_params' => [
                    'name' => $keyName,
                    'key' => file_get_contents($_SERVER['HOME'] . self::SSH_ID_RSA_PUB)
                ],
                'headers' => [
                    'X-Requested-With' => 'XMLHttpRequest',
                    'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCESS_TOKEN')
                ]
            ]
        );
    }
625264
public function spartanRemote(string $name): array
    {
        $remotes = $this->spartanRemotes();

        list($user, $host, $path, $port) = preg_split('/[@\:]/', $name) + [null, null, null, 22];

        if (isset($remotes[$user])) {
            $globalRemote = $remotes[$user];
            $path         = $host;

            $user = $globalRemote['user'];
            $host = $globalRemote['host'];
            $port = (int)$globalRemote['port'];
        }

        return [
            'user' => $user,
            'host' => $host,
            'path' => $path ?: '~',
            'port' => $port,
            'auth' => "{$user}@{$host}",
        ];
    }
1346871
public function keyBy($keyBy)
    {
        $results = [];
        foreach ($this->items as $key => $item) {
            $resolvedKey = is_object($item) ? $item->{$keyBy}  : $item[$keyBy];
            $results[$resolvedKey] = $item;
        }
        return new static($results);
    }
1243157
protected function keyReplacementPattern($keyName)
    {
        $key = $this->laravel['config']['webpush.vapid'];

        if ($keyName === 'VAPID_PUBLIC_KEY') {
            $key = $key['public_key'];
        } else {
            $key = $key['private_key'];
        }

        $escaped = preg_quote('='.$key, '/');

        return "/^{$keyName}{$escaped}/m";
    }
1014126
public static function &all($fieldName = null, $keyField = null)
    {
        $collection = new static();
        if ($fieldName !== null) {
            return $collection->toArrayOf($fieldName, $keyField);
        }

        return $collection;
    }
308553
public function getKeyUses($tablename, $keyname) {

        $uses = array();

        // Check if some foreign key in the whole structure is using it
        // (by comparing the reftable and reffields with the fields in the key)
        $mytable = $this->getTable($tablename);
        $mykey = $mytable->getKey($keyname);
        if ($this->tables && $mykey) {
            foreach ($this->tables as $table) {
                $allkeys = $table->getKeys();
                if ($allkeys) {
                    foreach ($allkeys as $key) {
                        if ($key->getType() != XMLDB_KEY_FOREIGN) {
                            continue;
                        }
                        if ($key->getRefTable() == $tablename &&
                            implode(',', $key->getRefFields()) == implode(',', $mykey->getFields())) {
                                $uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
                        }
                    }
                }
            }
        }

        // Return result
        if (!empty($uses)) {
            return $uses;
        } else {
            return false;
        }
    }
725502
public function getKey($keyname = self::DEFAULT_KEY)
    {
        if (!isset($this->_keyCache[$keyname])) {
            if (isset($_COOKIE[$keyname . '_key'])) {
                $key = $_COOKIE[$keyname . '_key'];
            } else {
                $key = session_id();
                $this->_setCookie($keyname, $key);
            }

            $this->_keyCache[$keyname] = $key;
        }

        return $this->_keyCache[$keyname];
    }
103149
function getPrimaryKeys($tableName) {
        $primary_key_index = $this->schema->listTableDetails($tableName)->getPrimaryKey();
        return $primary_key_index ? $primary_key_index->getColumns() : [];
    }
397698
protected function getEbayHeaders($operationName)
    {
        $headers = array();

        // Add required headers first.
        $headers[self::HDR_AUTH_TOKEN] = $this->config('authToken');
        $headers[self::HDR_OPERATION_NAME] = $operationName;

        // Add optional headers.
        if ($this->config('apiVersion')) {
            $headers[self::HDR_API_VERSION] = $this->config('apiVersion');
        }

        return $headers;
    }
312174
public function getByField($fieldName, $keys)
    {
        $keys = (array)$keys;
        if (empty($keys)) {
            return [];
        }
        $table = $this->entity->getTable();
        if (!empty($this->with)) {
            if (strpos($fieldName, '.') === false) {
                $fieldName = $this->getTableAlias($table) . '.' . $fieldName;
            }
        }
        $this->manager->commit();

        return $this->process(
            $this->getSelectQuery($table, $this->getFields($table), $fieldName, $keys)
                 ->query($this->parameters)
        );
    }
566680
private function getTokens($methodName)
    {
        preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
        $result = array();
        $lastToken = null;
        $seenBy = false;
        foreach ($rawTokens[0] as $token) {
            $newToken = $this->getToken($token, $seenBy);

            if ($newToken instanceof ValueToken) {
                $lastToken = $lastToken !== null && $lastToken instanceof ValueToken ?
                    new ValueToken($lastToken->getSource() . $newToken->getSource()) :
                    $newToken;
            } else {
                if ($lastToken instanceof ValueToken) {
                    // Add the last token too
                    $result[] = $lastToken;
                    $lastToken = null;
                }
                $result[] = $newToken;
            }
        }

        if ($lastToken !== null) {
            $result[] = $lastToken;
        }


        return $result;
    }