function PhpTufValidator::getRepositoryStatus

Gets the TUF protection status of Composer repositories.

Parameters

string $dir: The directory in which to run Composer.

Return value

bool[] An array of booleans, keyed by repository URL, indicating whether TUF protection is enabled for that repository.

1 call to PhpTufValidator::getRepositoryStatus()
PhpTufValidator::validateTuf in core/modules/package_manager/src/Validator/PhpTufValidator.php
Flags messages if PHP-TUF is not installed and configured properly.

File

core/modules/package_manager/src/Validator/PhpTufValidator.php, line 178

Class

PhpTufValidator
Validates that PHP-TUF is installed and correctly configured.

Namespace

Drupal\package_manager\Validator

Code

private function getRepositoryStatus(string $dir) : array {
    $status = [];
    $repositories = $this->composerInspector
        ->getConfig('repositories', $dir);
    $repositories = Json::decode($repositories);
    foreach ($repositories as $repository) {
        // Only Composer repositories can have TUF protection.
        if ($repository['type'] === 'composer') {
            $url = $repository['url'];
            $status[$url] = !empty($repository['tuf']);
        }
    }
    return array_intersect_key($status, array_flip($this->repositories));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.