Skip to content

Internals Package Manifest Service ManifestService

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

package\manifest\service\ManifestService

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/package/manifest/service/ManifestService.php · Snapshot 8411f4287706.

Package metadata is persisted in awt_package. Manifest readers validate input and package services build installed models; startup executes enabled nonzero-type packages.

Imports and dependencies

use package\dependency\Dependency;
use package\manifest\reader\interfaces\IManifestReader;
use package\manifest\service\interface\IManifestService;
use package\model\Package;

ManifestService

Declaration and architectural role

class ManifestService implements IManifestService

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
Constructor-promoted private readonly IManifestReader $reader Initialized from the constructor argument; default expression is evaluated when the argument is omitted.

Method index

Method Signature
__construct public function __construct( private readonly IManifestReader $reader )
buildPackage public function buildPackage(): Package
buildDependencies private function buildDependencies(array $data, Package $package): Package
buildDependency public function buildDependency(array $data): Dependency

__construct

Source line 12

public function __construct(
        private readonly IManifestReader $reader
    );

Parameters

Parameter Type, modifiers and default Purpose
$reader private readonly IManifestReader $reader Operation input; the exact use, validation and propagation are shown in the implementation trace.

Concrete no-op/default hook: this method performs no work. Override it where the lifecycle or extension contract calls for behavior.

buildPackage

Source line 18

public function buildPackage(): Package

Return expressions (including local callbacks): $this->buildDependencies($deps, $package).

Implementation, validation guards and interaction order
public function buildPackage(): Package
    {
        $manifest = $this->reader->getManifest();
        $deps = $manifest['dependencies'] ?? [];

        if( !is_array($deps))
            $deps = [];

        unset($manifest['dependencies']);

        $package = new Package();

        $package->setDependencies($deps);
        $package->fromArray($manifest);

        return $this->buildDependencies($deps, $package);
    }

buildDependencies

Source line 36

private function buildDependencies(array $data, Package $package): Package

Parameters

Parameter Type, modifiers and default Purpose
$data array $data Input data array or payload; see allowed fields and validation guards below.
$package Package $package Package identifier or InstalledPackage metadata as indicated by the declared type.

Return expressions (including local callbacks): $package.

Implementation, validation guards and interaction order
private function buildDependencies(array $data, Package $package): Package
    {
        foreach ($data as $dep) {
            $package->dependenciesCollection->add($this->buildDependency($dep));
        }
        return $package;
    }

buildDependency

Source line 44

public function buildDependency(array $data): Dependency

Parameters

Parameter Type, modifiers and default Purpose
$data array $data Input data array or payload; see allowed fields and validation guards below.

Return expressions (including local callbacks): Dependency::fromArray($data).

Implementation, validation guards and interaction order
public function buildDependency(array $data): Dependency
    {
        return Dependency::fromArray($data);
    }

Related types

Clone this wiki locally