function FailureMarker::getData

Gets the data from the file if it exists.

Return value

array|null The data from the file if it exists.

Throws

\Drupal\package_manager\Exception\StageFailureMarkerException Thrown if failure marker exists but cannot be decoded.

1 call to FailureMarker::getData()
FailureMarker::getMessage in core/modules/package_manager/src/FailureMarker.php
Gets the message from the file if it exists.

File

core/modules/package_manager/src/FailureMarker.php, line 82

Class

FailureMarker
Handles failure marker file operation.

Namespace

Drupal\package_manager

Code

private function getData() : ?array {
    $path = $this->getPath();
    if (file_exists($path)) {
        $data = file_get_contents($path);
        try {
            return Yaml::parse($data);
        } catch (ParseException $exception) {
            throw new StageFailureMarkerException('Failure marker file exists but cannot be decoded.', $exception->getCode(), $exception);
        }
    }
    return NULL;
}

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