You are here

protected function AutomaticUpdatesPsa::contribParser in Automatic Updates 8

Parse contrib project JSON version strings.

Parameters

array $messages: The messages array.

object $json: The JSON object.

1 call to AutomaticUpdatesPsa::contribParser()
AutomaticUpdatesPsa::getPublicServiceMessages in src/Services/AutomaticUpdatesPsa.php
Get public service messages.

File

src/Services/AutomaticUpdatesPsa.php, line 193

Class

AutomaticUpdatesPsa
Class AutomaticUpdatesPsa.

Namespace

Drupal\automatic_updates\Services

Code

protected function contribParser(array &$messages, $json) {
  $extension_version = $this->{$json->type}
    ->getAllAvailableInfo()[$json->project]['version'];
  $json->insecure = array_filter(array_map(static function ($version) {
    $version_array = explode('-', $version, 2);
    if ($version_array && $version_array[0] === \Drupal::CORE_COMPATIBILITY) {
      return isset($version_array[1]) ? $version_array[1] : NULL;
    }
    if (count($version_array) === 1) {
      return $version_array[0];
    }
    if (count($version_array) === 2 && $version_array[1] === 'dev') {
      return $version;
    }
  }, $json->insecure));
  $version_array = explode('-', $extension_version, 2);
  $extension_version = isset($version_array[1]) && $version_array[1] !== 'dev' ? $version_array[1] : $extension_version;
  $this
    ->parseConstraints($messages, $json, $extension_version);
}