function Dependency::offsetGet

File

core/lib/Drupal/Core/Extension/Dependency.php, line 128

Class

Dependency
A value object representing dependency information.

Namespace

Drupal\Core\Extension

Code

public function offsetGet($offset) {
    switch ($offset) {
        case 'name':
            @trigger_error(sprintf('Array access to the %s name property is deprecated. Use %s::getName() instead. See https://www.drupal.org/node/2756875', __CLASS__, __CLASS__), E_USER_DEPRECATED);
            return $this->getName();
        case 'project':
            @trigger_error(sprintf('Array access to the %s project property is deprecated. Use %s::getProject() instead. See https://www.drupal.org/node/2756875', __CLASS__, __CLASS__), E_USER_DEPRECATED);
            return $this->getProject();
        case 'original_version':
            @trigger_error(sprintf('Array access to the %s original_version property is deprecated. Use %s::getConstraintString() instead. See https://www.drupal.org/node/2756875', __CLASS__, __CLASS__), E_USER_DEPRECATED);
            $constraint = $this->getConstraintString();
            if ($constraint) {
                $constraint = ' (' . $constraint . ')';
            }
            return $constraint;
        case 'versions':
            @trigger_error(sprintf('Array access to the %s versions property is deprecated. See https://www.drupal.org/node/2756875', __CLASS__), E_USER_DEPRECATED);
            return $this->getConstraint()
                ->toArray();
    }
    throw new \InvalidArgumentException("The {$offset} key is not supported");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.