## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Intune;
|
|
|
|
use Illuminate\Container\Attributes\Tag;
|
|
|
|
class PolicyNormalizer
|
|
{
|
|
/**
|
|
* @var array<int, PolicyTypeNormalizer>
|
|
*/
|
|
private array $typeNormalizers;
|
|
|
|
public function __construct(
|
|
private readonly DefaultPolicyNormalizer $defaultNormalizer,
|
|
#[Tag('policy-type-normalizers')]
|
|
iterable $typeNormalizers = [],
|
|
) {
|
|
$normalizers = is_array($typeNormalizers)
|
|
? $typeNormalizers
|
|
: iterator_to_array($typeNormalizers);
|
|
|
|
$this->typeNormalizers = array_values(array_filter(
|
|
$normalizers,
|
|
fn (mixed $normalizer) => $normalizer instanceof PolicyTypeNormalizer
|
|
));
|
|
}
|
|
|
|
/**
|
|
* @return array{status: string, settings: array<int, array<string, mixed>>, settings_table?: array<string, mixed>, warnings: array<int, string>}
|
|
*/
|
|
public function normalize(?array $snapshot, string $policyType, ?string $platform = null): array
|
|
{
|
|
return $this->resolveNormalizer($policyType)
|
|
->normalize($snapshot, $policyType, $platform);
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function flattenForDiff(?array $snapshot, string $policyType, ?string $platform = null): array
|
|
{
|
|
return $this->resolveNormalizer($policyType)
|
|
->flattenForDiff($snapshot, $policyType, $platform);
|
|
}
|
|
|
|
/**
|
|
* @param array<int, mixed> $settings
|
|
* @return array{type: string, groups: array<int, array<string, mixed>>}
|
|
*/
|
|
public function normalizeSettingsCatalogGrouped(array $settings): array
|
|
{
|
|
return $this->defaultNormalizer->normalizeSettingsCatalogGrouped($settings);
|
|
}
|
|
|
|
private function resolveNormalizer(string $policyType): PolicyTypeNormalizer
|
|
{
|
|
foreach ($this->typeNormalizers as $normalizer) {
|
|
if ($normalizer->supports($policyType)) {
|
|
return $normalizer;
|
|
}
|
|
}
|
|
|
|
return $this->defaultNormalizer;
|
|
}
|
|
}
|