-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35eb5b2
commit f004318
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends "template.twig" %} | ||
|
||
{% block title %}Keep your dependencies up-to-date - PHP.Package.Health{% endblock %} | ||
|
||
{% block hero_type %}is-info{% endblock %} | ||
{% block hero_title %}Keep your dependencies up-to-date{% endblock %} | ||
|
||
{% block hero_subtitle %}Package.Health uses semantic versioning to detect outdated or insecure dependencies in your project's <code>composer.json</code>.{% endblock %} | ||
|
||
{% block content %} | ||
<h2 class="title is-3">Packages from {{ vendor }}</h2> | ||
<table class="table is-fullwidth is-striped is-hoverable"> | ||
<thead> | ||
<tr> | ||
<th>Package</th> | ||
<th></th> | ||
<th class="has-text-right">Status</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for package in packages %} | ||
<tr> | ||
<td><a href="{{ url_for('redirectPackage', {vendor: package.vendor, project: package.project}) }}">{{ package.name }}</a></td> | ||
<td class="has-text-grey">{{ package.description }}</td> | ||
<td class="has-text-right"><img src="{{ url_for('redirectPackageBadge', {vendor: package.vendor, project: package.project}) }}" height="20" alt="Dependency Badge" decoding="async"></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace App\Application\Action\Vendor; | ||
|
||
use App\Application\Action\AbstractAction; | ||
use App\Domain\Package\PackageRepositoryInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Psr\Log\LoggerInterface; | ||
use Slim\HttpCache\CacheProvider; | ||
use Slim\Views\Twig; | ||
|
||
final class ListPackagesAction extends AbstractAction { | ||
protected PackageRepositoryInterface $packageRepository; | ||
|
||
public function __construct( | ||
LoggerInterface $logger, | ||
CacheProvider $cacheProvider, | ||
PackageRepositoryInterface $packageRepository | ||
) { | ||
parent::__construct($logger, $cacheProvider); | ||
$this->packageRepository = $packageRepository; | ||
} | ||
|
||
protected function action(): ResponseInterface { | ||
$vendor = $this->resolveStringArg('vendor'); | ||
$packages = $this->packageRepository->findMatching(['name' => "$vendor/%"]); | ||
$twig = Twig::fromRequest($this->request); | ||
|
||
$this->logger->debug('Vendor package list was viewed.'); | ||
|
||
// if (count($packages)) { | ||
// $lastModifiedList = array_map( | ||
// function (Package $package): int { | ||
// $lastModified = $package->getUpdatedAt() ?? $package->getCreatedAt(); | ||
|
||
// return $lastModified->getTimestamp(); | ||
// }, | ||
// $packages | ||
// ); | ||
|
||
// $lastModified = max($lastModifiedList); | ||
// $this->response = $this->cacheProvider->withLastModified( | ||
// $this->response, | ||
// $lastModified | ||
// ); | ||
// $this->response = $this->cacheProvider->withEtag( | ||
// $this->response, | ||
// hash('sha1', (string)$lastModified) | ||
// ); | ||
// } | ||
|
||
return $this->respondWithHtml( | ||
$twig->fetch( | ||
'vendor/list.twig', | ||
[ | ||
'vendor' => $vendor, | ||
'packages' => $packages, | ||
'app' => [ | ||
'version' => $_ENV['VERSION'] | ||
] | ||
] | ||
) | ||
); | ||
} | ||
} |