function StageBase::getType

Gets the stage type.

The stage type can be used by stage event subscribers to implement logic specific to certain stages, without relying on the class name (which may not be part of module's public API).

Return value

string The stage type.

Throws

\LogicException Thrown if $this->type is not explicitly overridden.

2 calls to StageBase::getType()
StageBase::claim in core/modules/package_manager/src/StageBase.php
Attempts to claim the stage.
StageBase::create in core/modules/package_manager/src/StageBase.php
Copies the active code base into the stage directory.

File

core/modules/package_manager/src/StageBase.php, line 200

Class

StageBase
Creates and manages a stage directory in which to install or update code.

Namespace

Drupal\package_manager

Code

public final function getType() : string {
    $reflector = new \ReflectionProperty($this, 'type');
    // The $type property must ALWAYS be overridden. This means that different
    // subclasses can return the same value (thus allowing one stage to
    // impersonate another one), but if that happens, it is intentional.
    if ($reflector->getDeclaringClass()
        ->getName() === static::class) {
        return $this->type;
    }
    throw new \LogicException(static::class . ' must explicitly override the $type property.');
}

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