Skip to content

Commit 558b852

Browse files
authored
Merge pull request #146 from cakephp/optimization
Don't bother generating additional metadata for abandoned packages.
2 parents 36643c0 + 3c5dddd commit 558b852

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Command/SyncPackagesCommand.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,26 @@ public function execute(Arguments $args, ConsoleIo $io)
134134

135135
/**
136136
* @param string $packageName
137-
* @return array
137+
* @return array{package: string, description: string, repo_url: string, downloads: int, stars: int, tag_list: array, latest_stable_version: ?string, is_abandoned: bool}
138138
*/
139139
private function getDataForPackage(string $packageName): array
140140
{
141141
/** @var \Packagist\Api\Result\Package $metaDetails */
142142
$metaDetails = $this->client->get($packageName);
143+
144+
if ($metaDetails->isAbandoned()) {
145+
return [
146+
'package' => $packageName,
147+
'description' => $metaDetails->getDescription(),
148+
'repo_url' => $metaDetails->getRepository(),
149+
'downloads' => $metaDetails->getDownloads()->getTotal(),
150+
'stars' => $metaDetails->getGithubStars(),
151+
'tag_list' => [],
152+
'latest_stable_version' => null,
153+
'is_abandoned' => true,
154+
];
155+
}
156+
143157
$versions = $metaDetails->getVersions();
144158

145159
$meta = [];

0 commit comments

Comments
 (0)