fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled

This commit is contained in:
2025-11-24 21:28:25 +01:00
parent 4eb7134853
commit 77abc65cd7
1327 changed files with 91915 additions and 9909 deletions

View File

@@ -0,0 +1,141 @@
<?php
declare(strict_types=1);
namespace App\Framework\Composer\ValueObjects;
use App\Framework\Composer\Exception\ComposerLockException;
/**
* Immutable Value Object representing composer.lock data
*/
final readonly class ComposerLock
{
/**
* @param array<array<string, mixed>> $packages
* @param array<array<string, mixed>> $packagesDev
* @param array<string, mixed> $platform
* @param array<string, mixed> $platformDev
*/
public function __construct(
public array $packages = [],
public array $packagesDev = [],
public array $platform = [],
public array $platformDev = [],
public ?string $contentHash = null
) {
}
/**
* Create ComposerLock from file path
*/
public static function fromFile(string $path): self
{
if (! file_exists($path)) {
throw ComposerLockException::fileNotFound($path);
}
$content = @file_get_contents($path);
if ($content === false) {
throw ComposerLockException::couldNotRead($path, new \RuntimeException('file_get_contents failed'));
}
$data = json_decode($content, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw ComposerLockException::invalidJson($path, new \JsonException(json_last_error_msg()));
}
return self::fromArray($data);
}
/**
* Create ComposerLock from array data
*
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
packages: $data['packages'] ?? [],
packagesDev: $data['packages-dev'] ?? [],
platform: $data['platform'] ?? [],
platformDev: $data['platform-dev'] ?? [],
contentHash: $data['content-hash'] ?? null
);
}
/**
* Get all packages (production + dev) as flat array
*
* @return array<array<string, mixed>>
*/
public function getAllPackages(): array
{
return array_merge($this->packages, $this->packagesDev);
}
/**
* Get package by name
*
* @return array<string, mixed>|null
*/
public function getPackage(string $name): ?array
{
// Check production packages first
foreach ($this->packages as $package) {
if (isset($package['name']) && $package['name'] === $name) {
return $package;
}
}
// Check dev packages
foreach ($this->packagesDev as $package) {
if (isset($package['name']) && $package['name'] === $name) {
return $package;
}
}
return null;
}
/**
* Check if package exists
*/
public function hasPackage(string $name): bool
{
return $this->getPackage($name) !== null;
}
/**
* Get packages with their type (production or dev)
*
* @return array<array{name: string, version: string, type: 'production'|'dev'}>
*/
public function getPackagesWithType(): array
{
$result = [];
foreach ($this->packages as $package) {
if (isset($package['name']) && isset($package['version'])) {
$result[] = [
'name' => $package['name'],
'version' => $package['version'],
'type' => 'production',
];
}
}
foreach ($this->packagesDev as $package) {
if (isset($package['name']) && isset($package['version'])) {
$result[] = [
'name' => $package['name'],
'version' => $package['version'],
'type' => 'dev',
];
}
}
return $result;
}
}

View File

@@ -0,0 +1,150 @@
<?php
declare(strict_types=1);
namespace App\Framework\Composer\ValueObjects;
use App\Framework\Composer\Exception\ComposerManifestException;
/**
* Immutable Value Object representing composer.json data
*/
final readonly class ComposerManifest
{
/**
* @param array<string, mixed> $autoload
* @param array<string, mixed> $autoloadDev
* @param array<string, string> $scripts
* @param array<string, string> $require
* @param array<string, string> $requireDev
* @param array<string, mixed> $config
* @param array<string, mixed> $authors
*/
public function __construct(
public string $name,
public ?string $description = null,
public ?string $type = null,
public ?string $license = null,
public array $authors = [],
public array $autoload = [],
public array $autoloadDev = [],
public array $scripts = [],
public array $require = [],
public array $requireDev = [],
public array $config = []
) {
}
/**
* Create ComposerManifest from file path
*/
public static function fromFile(string $path): self
{
if (! file_exists($path)) {
throw ComposerManifestException::fileNotFound($path);
}
$content = @file_get_contents($path);
if ($content === false) {
throw ComposerManifestException::couldNotRead($path, new \RuntimeException('file_get_contents failed'));
}
$data = json_decode($content, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw ComposerManifestException::invalidJson($path, new \JsonException(json_last_error_msg()));
}
return self::fromArray($data);
}
/**
* Create ComposerManifest from array data
*
* @param array<string, mixed> $data
*/
public static function fromArray(array $data): self
{
return new self(
name: $data['name'] ?? '',
description: $data['description'] ?? null,
type: $data['type'] ?? null,
license: $data['license'] ?? null,
authors: $data['authors'] ?? [],
autoload: $data['autoload'] ?? [],
autoloadDev: $data['autoload-dev'] ?? [],
scripts: $data['scripts'] ?? [],
require: $data['require'] ?? [],
requireDev: $data['require-dev'] ?? [],
config: $data['config'] ?? []
);
}
/**
* Get PSR-4 autoload paths as array mapping namespace prefixes to paths
*
* @return array<string, string>
*/
public function getPsr4AutoloadPaths(): array
{
$paths = [];
if (isset($this->autoload['psr-4']) && is_array($this->autoload['psr-4'])) {
foreach ($this->autoload['psr-4'] as $namespace => $path) {
$paths[(string) $namespace] = (string) $path;
}
}
return $paths;
}
/**
* Get PSR-4 autoload-dev paths as array mapping namespace prefixes to paths
*
* @return array<string, string>
*/
public function getPsr4AutoloadDevPaths(): array
{
$paths = [];
if (isset($this->autoloadDev['psr-4']) && is_array($this->autoloadDev['psr-4'])) {
foreach ($this->autoloadDev['psr-4'] as $namespace => $path) {
$paths[(string) $namespace] = (string) $path;
}
}
return $paths;
}
/**
* Get all scripts defined in composer.json
*
* @return array<string, string>
*/
public function getScripts(): array
{
return $this->scripts;
}
/**
* Check if a script exists
*/
public function hasScript(string $name): bool
{
return isset($this->scripts[$name]);
}
/**
* Get script command by name
*/
public function getScript(string $name): ?string
{
return $this->scripts[$name] ?? null;
}
/**
* Get all dependencies (require + require-dev)
*
* @return array<string, string>
*/
public function getAllDependencies(): array
{
return array_merge($this->require, $this->requireDev);
}
}