class ConnectorInfo in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 src/Smartling/ConnectorInfo.php \Drupal\tmgmt_smartling\Smartling\ConnectorInfo
Class ConnectorInfo @package Drupal\tmgmt_smartling\Smartling
Hierarchy
- class \Drupal\tmgmt_smartling\Smartling\ConnectorInfo
Expanded class hierarchy of ConnectorInfo
3 files declare their use of ConnectorInfo
- BufferLogger.php in src/
Logger/ BufferLogger.php - ConnectorInfoTest.php in tests/
src/ Kernel/ ConnectorInfoTest.php - SmartlingTranslator.php in src/
Plugin/ tmgmt/ Translator/ SmartlingTranslator.php - Contains \Drupal\tmgmt_smartling\Plugin\tmgmt\Translator\SmartlingTranslator.
File
- src/
Smartling/ ConnectorInfo.php, line 17 - SmartlingApiFactory.php.
Namespace
Drupal\tmgmt_smartling\SmartlingView source
class ConnectorInfo {
/**
* Returns module name.
*
* @return string
*/
public static function getLibName() {
return 'drupal-tmgmt-connector';
}
/**
* Returns module version.
*
* @param string $name
* @param string $default
* @return string
*/
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;
}
public static function getDependenciesVersionsAsString() {
$result = [];
$dependencies = [
'tmgmt_extension_suit',
'tmgmt',
];
foreach ($dependencies as $dependency) {
$result[] = "{$dependency}/" . self::getLibVersion($dependency);
}
return implode(' ', $result);
}
/**
* Set up current client id and version.
*/
public static function setUpCurrentClientInfo() {
BaseApiAbstract::setCurrentClientId(self::getLibName());
BaseApiAbstract::setCurrentClientVersion(self::getLibVersion());
BaseApiAbstract::setCurrentClientUserAgentExtension(self::getDependenciesVersionsAsString());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConnectorInfo:: |
public static | function | ||
ConnectorInfo:: |
public static | function | Returns module name. | |
ConnectorInfo:: |
public static | function | Returns module version. | |
ConnectorInfo:: |
public static | function | Set up current client id and version. |