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

Breadcrumb

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

class Link

Same name in this branch
  1. 11.1.x vendor/open-telemetry/sdk/Trace/Link.php \OpenTelemetry\SDK\Trace\Link
  2. 11.1.x vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Trace/V1/Span/Link.php \Opentelemetry\Proto\Trace\V1\Span\Link
  3. 11.1.x vendor/symfony/dom-crawler/Link.php \Symfony\Component\DomCrawler\Link
  4. 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php \phpDocumentor\Reflection\DocBlock\Tags\Link
  5. 11.1.x core/lib/Drupal/Core/Link.php \Drupal\Core\Link
  6. 11.1.x core/lib/Drupal/Core/Render/Element/Link.php \Drupal\Core\Render\Element\Link
  7. 11.1.x core/modules/jsonapi/src/JsonApiResource/Link.php \Drupal\jsonapi\JsonApiResource\Link

Represents a link between two packages, represented by their names

@author Nils Adermann <naderman@naderman.de>

Hierarchy

  • class \Composer\Package\Link

Expanded class hierarchy of Link

12 files declare their use of Link
ArrayLoader.php in vendor/composer/composer/src/Composer/Package/Loader/ArrayLoader.php
BaseDependencyCommand.php in vendor/composer/composer/src/Composer/Command/BaseDependencyCommand.php
CheckPlatformReqsCommand.php in vendor/composer/composer/src/Composer/Command/CheckPlatformReqsCommand.php
InstalledRepository.php in vendor/composer/composer/src/Composer/Repository/InstalledRepository.php
Installer.php in vendor/composer/composer/src/Composer/Installer.php

... See full list

61 string references to 'Link'
ckeditor5.ckeditor5.yml in core/modules/ckeditor5/ckeditor5.ckeditor5.yml
core/modules/ckeditor5/ckeditor5.ckeditor5.yml
claro_form_alter in core/themes/claro/claro.theme
Implements hook_form_alter().
claro_page_attachments_alter in core/themes/claro/claro.theme
Implements hook_page_attachments_alter().
ContentTranslationHandler::entityFormSharedElements in core/modules/content_translation/src/ContentTranslationHandler.php
Process callback: determines which elements get clue in the form.
contextual.views.schema.yml in core/modules/contextual/config/schema/contextual.views.schema.yml
core/modules/contextual/config/schema/contextual.views.schema.yml

... See full list

File

vendor/composer/composer/src/Composer/Package/Link.php, line 22

Namespace

Composer\Package
View source
class Link {
    public const TYPE_REQUIRE = 'requires';
    public const TYPE_DEV_REQUIRE = 'devRequires';
    public const TYPE_PROVIDE = 'provides';
    public const TYPE_CONFLICT = 'conflicts';
    public const TYPE_REPLACE = 'replaces';
    
    /**
     * Special type
     * @internal
     */
    public const TYPE_DOES_NOT_REQUIRE = 'does not require';
    private const TYPE_UNKNOWN = 'relates to';
    
    /**
     * Will be converted into a constant once the min PHP version allows this
     *
     * @internal
     * @var string[]
     * @phpstan-var array<self::TYPE_REQUIRE|self::TYPE_DEV_REQUIRE|self::TYPE_PROVIDE|self::TYPE_CONFLICT|self::TYPE_REPLACE>
     */
    public static $TYPES = [
        self::TYPE_REQUIRE,
        self::TYPE_DEV_REQUIRE,
        self::TYPE_PROVIDE,
        self::TYPE_CONFLICT,
        self::TYPE_REPLACE,
    ];
    
    /**
     * @var string
     */
    protected $source;
    
    /**
     * @var string
     */
    protected $target;
    
    /**
     * @var ConstraintInterface
     */
    protected $constraint;
    
    /**
     * @var string
     * @phpstan-var string $description
     */
    protected $description;
    
    /**
     * @var ?string
     */
    protected $prettyConstraint;
    
    /**
     * Creates a new package link.
     *
     * @param ConstraintInterface $constraint       Constraint applying to the target of this link
     * @param self::TYPE_*        $description      Used to create a descriptive string representation
     */
    public function __construct(string $source, string $target, ConstraintInterface $constraint, $description = self::TYPE_UNKNOWN, ?string $prettyConstraint = null) {
        $this->source = strtolower($source);
        $this->target = strtolower($target);
        $this->constraint = $constraint;
        $this->description = self::TYPE_DEV_REQUIRE === $description ? 'requires (for development)' : $description;
        $this->prettyConstraint = $prettyConstraint;
    }
    public function getDescription() : string {
        return $this->description;
    }
    public function getSource() : string {
        return $this->source;
    }
    public function getTarget() : string {
        return $this->target;
    }
    public function getConstraint() : ConstraintInterface {
        return $this->constraint;
    }
    
    /**
     * @throws \UnexpectedValueException If no pretty constraint was provided
     */
    public function getPrettyConstraint() : string {
        if (null === $this->prettyConstraint) {
            throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
        }
        return $this->prettyConstraint;
    }
    public function __toString() : string {
        return $this->source . ' ' . $this->description . ' ' . $this->target . ' (' . $this->constraint . ')';
    }
    public function getPrettyString(PackageInterface $sourcePackage) : string {
        return $sourcePackage->getPrettyString() . ' ' . $this->description . ' ' . $this->target . ' ' . $this->constraint
            ->getPrettyString();
    }

}

Members

Title Sort descending Modifiers Object type Summary
Link::$constraint protected property
Link::$description protected property @phpstan-var string $description
Link::$prettyConstraint protected property
Link::$source protected property
Link::$target protected property
Link::$TYPES public static property Will be converted into a constant once the min PHP version allows this
Link::getConstraint public function
Link::getDescription public function
Link::getPrettyConstraint public function
Link::getPrettyString public function
Link::getSource public function
Link::getTarget public function
Link::TYPE_CONFLICT public constant
Link::TYPE_DEV_REQUIRE public constant
Link::TYPE_DOES_NOT_REQUIRE public constant Special type
@internal
Link::TYPE_PROVIDE public constant
Link::TYPE_REPLACE public constant
Link::TYPE_REQUIRE public constant
Link::TYPE_UNKNOWN private constant
Link::__construct public function Creates a new package link.
Link::__toString public function

API Navigation

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