You are here

protected function AutomaticUpdatesPsa::isValidExtension in Automatic Updates 8

Determine if extension exists and has a version string.

Parameters

string $extension_type: The extension type i.e. module, theme, profile.

string $project_name: The project.

Return value

bool TRUE if extension exists, else FALSE.

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

File

src/Services/AutomaticUpdatesPsa.php, line 177

Class

AutomaticUpdatesPsa
Class AutomaticUpdatesPsa.

Namespace

Drupal\automatic_updates\Services

Code

protected function isValidExtension($extension_type, $project_name) {
  if (!property_exists($this, $extension_type)) {
    $this->logger
      ->error('Extension list of type "%extension" does not exist.', [
      '%extension' => $extension_type,
    ]);
    return FALSE;
  }
  return $this->{$extension_type}
    ->exists($project_name) && !empty($this->{$extension_type}
    ->getAllAvailableInfo()[$project_name]['version']);
}