-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composer V2 Support #100
Composer V2 Support #100
Changes from 3 commits
0a0c973
03a7ba7
dc27602
4b9d1a7
94e3f87
10ec94b
0620fc3
73af60c
6061cca
6f86109
d52edf7
12fbf4d
da1625e
80b493b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,23 @@ public function providerData(string $package, int $expireTime = self::PACKAGES_E | |
return $this->metadataProvider->fromUrl($this->getUrl($providerPath->get())); | ||
} | ||
|
||
/** | ||
* @return Option<array<mixed>> | ||
*/ | ||
public function providerDataV2(string $package, int $expireTime = self::PACKAGES_EXPIRE_TIME): Option | ||
{ | ||
if (!($fromPath = $this->metadataProvider->fromPath($package, $this->url, $expireTime))->isEmpty()) { | ||
return $fromPath; | ||
} | ||
|
||
$providerPath = $this->getProviderPathV2($package); | ||
if ($providerPath->isEmpty()) { | ||
return Option::none(); | ||
} | ||
|
||
return $this->metadataProvider->fromUrl($this->getUrl($providerPath->get())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will probably need to do it differently, in this case we will overwrite the v1 data with the v2 version. |
||
} | ||
|
||
/** | ||
* @return GenericList<string> | ||
*/ | ||
|
@@ -115,6 +132,25 @@ private function getProviderPath(string $packageName): Option | |
return Option::none(); | ||
} | ||
|
||
/** | ||
* @return Option<string> | ||
*/ | ||
private function getProviderPathV2(string $packageName): Option | ||
{ | ||
$root = $this->getRootPackages(); | ||
if (isset($root['metadata-url'])) { | ||
return Option::some( | ||
(string) str_replace( | ||
['%package%'], | ||
[$packageName], | ||
$root['metadata-url'] | ||
) | ||
); | ||
} | ||
|
||
return Option::none(); | ||
} | ||
|
||
/** | ||
* @return array<mixed> | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
~
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to be able to pass through dev packages, and they contain a
~
https://packagist.org/p2/symfony/polyfill-php72~dev.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could merge it in the previous pattern, but i wanted to make it obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we can combine it