Skip to content
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

Update ModuleCustomTrait.php #3661

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/Module/ModuleCustomTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
return '';
}

/**
* Fetch the version information from the given content string.
*
* @param string $content
*
* @return string
*/
protected function extractVersion(string $content): string

Check warning on line 92 in app/Module/ModuleCustomTrait.php

View check run for this annotation

Codecov / codecov/patch

app/Module/ModuleCustomTrait.php#L92

Added line #L92 was not covered by tests
{
return $content;

Check warning on line 94 in app/Module/ModuleCustomTrait.php

View check run for this annotation

Codecov / codecov/patch

app/Module/ModuleCustomTrait.php#L94

Added line #L94 was not covered by tests
}

/**
* Fetch the latest version of this module.
*
Expand All @@ -103,7 +115,7 @@
$response = $client->get($this->customModuleLatestVersionUrl());

if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) {
$version = $response->getBody()->getContents();
$version = $this->extractVersion($response->getBody()->getContents());

Check warning on line 118 in app/Module/ModuleCustomTrait.php

View check run for this annotation

Codecov / codecov/patch

app/Module/ModuleCustomTrait.php#L118

Added line #L118 was not covered by tests

// Does the response look like a version?
if (preg_match('/^\d+\.\d+\.\d+/', $version)) {
Expand Down
Loading