Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ManifestDocumentMapper.php

function ManifestDocumentMapper::mapRequirements

1 call to ManifestDocumentMapper::mapRequirements()
ManifestDocumentMapper::map in vendor/phar-io/manifest/src/ManifestDocumentMapper.php

File

vendor/phar-io/manifest/src/ManifestDocumentMapper.php, line 80

Class

ManifestDocumentMapper

Namespace

PharIo\Manifest

Code

private function mapRequirements(RequiresElement $requires) : RequirementCollection {
    $collection = new RequirementCollection();
    $phpElement = $requires->getPHPElement();
    $parser = new VersionConstraintParser();
    try {
        $versionConstraint = $parser->parse($phpElement->getVersion());
    } catch (VersionException $e) {
        throw new ManifestDocumentMapperException(sprintf('Unsupported version constraint - %s', $e->getMessage()), (int) $e->getCode(), $e);
    }
    $collection->add(new PhpVersionRequirement($versionConstraint));
    if (!$phpElement->hasExtElements()) {
        return $collection;
    }
    foreach ($phpElement->getExtElements() as $extElement) {
        $collection->add(new PhpExtensionRequirement($extElement->getName()));
    }
    return $collection;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal