You are here

public static function ConnectorInfo::getLibVersion in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 src/Smartling/ConnectorInfo.php \Drupal\tmgmt_smartling\Smartling\ConnectorInfo::getLibVersion()

Returns module version.

Parameters

string $name:

string $default:

Return value

string

4 calls to ConnectorInfo::getLibVersion()
BufferLogger::flush in src/Logger/BufferLogger.php
Log messages into needed destination.
ConnectorInfo::getDependenciesVersionsAsString in src/Smartling/ConnectorInfo.php
ConnectorInfo::setUpCurrentClientInfo in src/Smartling/ConnectorInfo.php
Set up current client id and version.
ConnectorInfoTest::testGetLibVersion in tests/src/Kernel/ConnectorInfoTest.php

File

src/Smartling/ConnectorInfo.php, line 35
SmartlingApiFactory.php.

Class

ConnectorInfo
Class ConnectorInfo @package Drupal\tmgmt_smartling\Smartling

Namespace

Drupal\tmgmt_smartling\Smartling

Code

public static function getLibVersion($name = 'tmgmt_smartling', $default = 'unknown') {
  try {
    $info = \Drupal::service('extension.list.module')
      ->getExtensionInfo($name);
  } catch (UnknownExtensionException $e) {
    $info = [
      'version' => $default,
    ];
  }
  $client_version = $default;
  if (!empty($info['version'])) {
    $client_version = $info['version'];
  }
  return $client_version;
}