function ManifestSerializer::addContains
1 call to ManifestSerializer::addContains()
- ManifestSerializer::serializeToString in vendor/
phar-io/ manifest/ src/ ManifestSerializer.php
File
-
vendor/
phar-io/ manifest/ src/ ManifestSerializer.php, line 63
Class
- ManifestSerializer
- @psalm-suppress MissingConstructor
Namespace
PharIo\ManifestCode
private function addContains(ApplicationName $name, Version $version, Type $type) : void {
$this->xmlWriter
->startElement('contains');
$this->xmlWriter
->writeAttribute('name', $name->asString());
$this->xmlWriter
->writeAttribute('version', $version->getVersionString());
switch (true) {
case $type->isApplication():
$this->xmlWriter
->writeAttribute('type', 'application');
break;
case $type->isLibrary():
$this->xmlWriter
->writeAttribute('type', 'library');
break;
case $type->isExtension():
$this->xmlWriter
->writeAttribute('type', 'extension');
/* @var $type Extension */
$this->addExtension($type->getApplicationName(), $type->getVersionConstraint());
break;
default:
$this->xmlWriter
->writeAttribute('type', 'custom');
}
$this->xmlWriter
->endElement();
}