Skip to content

Commit

Permalink
Adds getAuthCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
octoberapp committed Sep 6, 2023
1 parent 03ed3e8 commit f098426
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Composer/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,22 @@ public function addAuthCredentials($hostname, $username, $password, $type = null
]);
}

/**
* getAuthCredentials returns auth credentials added to the config file
*/
public function getAuthCredentials($hostname, $type = null): ?array
{
if ($type === null) {
$type = 'http-basic';
}

$authFile = $this->getAuthPath();

$config = json_decode(file_get_contents($authFile), true);

return $config[$type][$hostname] ?? null;
}

/**
* makeComposer returns a new instance of composer
*/
Expand Down

0 comments on commit f098426

Please sign in to comment.