public static function prepareApplicationToken(ObjectManagerInterface $objectManager): string
    {
        $configurationManager = $objectManager->get(ConfigurationManager::class);
        $tokenSetting = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.applicationToken');

        if (!in_array($tokenSetting, ['ApplicationName', 'MinorVersion', 'MajorVersion'])) {
            return '';
        }

        $applicationPackageKey = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationPackageKey');
        $applicationName = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationName');
        $applicationIsNotFlow = ($applicationPackageKey !== 'Neos.Flow');

        if ($tokenSetting === 'ApplicationName') {
            return 'Flow' . ($applicationIsNotFlow ? ' ' . $applicationName : '');
        }

        $packageManager = $objectManager->get(PackageManager::class);
        $flowPackage = $packageManager->getPackage('Neos.Flow');
        $applicationPackage = $applicationIsNotFlow ? $packageManager->getPackage($applicationPackageKey) : null;

        // At this point the $tokenSetting must be either "MinorVersion" or "MajorVersion" so lets use it.

        $versionRenderer = 'render' . $tokenSetting;
        $flowVersion = static::$versionRenderer($flowPackage->getInstalledVersion());
        $applicationVersion = $applicationIsNotFlow ? static::$versionRenderer($applicationPackage->getInstalledVersion()) : null;

        return 'Flow/' . ($flowVersion ?: 'dev') . ($applicationIsNotFlow ? ' ' . $applicationName . '/' . ($applicationVersion ?: 'dev') : '');
    }
public static function prepareApplicationToken(ObjectManagerInterface $objectManager): string
    {
        $configurationManager = $objectManager->get(ConfigurationManager::class);
        $tokenSetting = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.applicationToken');

        if (!in_array($tokenSetting, ['ApplicationName', 'MinorVersion', 'MajorVersion'])) {
            return '';
        }

        $applicationPackageKey = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationPackageKey');
        $applicationName = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.core.applicationName');
        $applicationIsNotFlow = ($applicationPackageKey !== 'Neos.Flow');

        if ($tokenSetting === 'ApplicationName') {
            return 'Flow' . ($applicationIsNotFlow ? ' ' . $applicationName : '');
        }

        $packageManager = $objectManager->get(PackageManager::class);
        $flowPackage = $packageManager->getPackage('Neos.Flow');
        $applicationPackage = $applicationIsNotFlow ? $packageManager->getPackage($applicationPackageKey) : null;

        // At this point the $tokenSetting must be either "MinorVersion" or "MajorVersion" so lets use it.

        $versionRenderer = 'render' . $tokenSetting;
        $flowVersion = static::$versionRenderer($flowPackage->getInstalledVersion());
        $applicationVersion = $applicationIsNotFlow ? static::$versionRenderer($applicationPackage->getInstalledVersion()) : null;

        return 'Flow/' . ($flowVersion ?: 'dev') . ($applicationIsNotFlow ? ' ' . $applicationName . '/' . ($applicationVersion ?: 'dev') : '');
    }
public static function prepareApplicationToken ( ObjectManagerInterface $ objectManager ) : string { $ configurationManager = $ objectManager -> get ( ConfigurationManager :: class ) ; $ tokenSetting = $ configurationManager -> getConfiguration ( ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , 'Neos.Flow.http.applicationToken' ) ; if ( ! in_array ( $ tokenSetting , [ 'ApplicationName' , 'MinorVersion' , 'MajorVersion' ] ) ) { return '' ; } $ applicationPackageKey = $ configurationManager -> getConfiguration ( ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , 'Neos.Flow.core.applicationPackageKey' ) ; $ applicationName = $ configurationManager -> getConfiguration ( ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , 'Neos.Flow.core.applicationName' ) ; $ applicationIsNotFlow = ( $ applicationPackageKey !== 'Neos.Flow' ) ; if ( $ tokenSetting === 'ApplicationName' ) { return 'Flow' . ( $ applicationIsNotFlow ? ' ' . $ applicationName : '' ) ; } $ packageManager = $ objectManager -> get ( PackageManager :: class ) ; $ flowPackage = $ packageManager -> getPackage ( 'Neos.Flow' ) ; $ applicationPackage = $ applicationIsNotFlow ? $ packageManager -> getPackage ( $ applicationPackageKey ) : null ; // At this point the $tokenSetting must be either "MinorVersion" or "MajorVersion" so lets use it. $ versionRenderer = 'render' . $ tokenSetting ; $ flowVersion = static :: $ versionRenderer ( $ flowPackage -> getInstalledVersion ( ) ) ; $ applicationVersion = $ applicationIsNotFlow ? static :: $ versionRenderer ( $ applicationPackage -> getInstalledVersion ( ) ) : null ; return 'Flow/' . ( $ flowVersion ? : 'dev' ) . ( $ applicationIsNotFlow ? ' ' . $ applicationName . '/' . ( $ applicationVersion ? : 'dev' ) : '' ) ; }
Generate an application information header for the response based on settings and package versions.
Will statically compile in production for performance benefits.

@param ObjectManagerInterface $objectManager
@return string
@throws \Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException
@Flow\CompileStatic
Generate an application information header for the response based on settings and package versions . Will statically compile in production for performance benefits .