<?php
/**
 * @author Robin 'codeFareith' von den Bergen <robinvonberg@gmx.de>
 * @copyright (c) 2018 by Robin von den Bergen
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version 1.0.0
 *
 * @link https://github.com/codeFareith/cf_google_authenticator
 * @see https://www.fareith.de
 * @see https://typo3.org
 */

namespace CodeFareith\CfGoogleAuthenticator\Application\Utility;

use function explode;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
 * Helper class to fetch basic data of the extension
 *
 * This utility class provides the basic data of the extension.
 */
final class ExtensionMetaData
{
    public static function vendorName(): string
    {
        return static::sliceNameSpace()[0];
    }

    private static function sliceNameSpace(): array
    {
        return explode('\\', __NAMESPACE__);
    }

    public static function extensionName(): string
    {
        return static::sliceNameSpace()[1];
    }

    public static function extensionKey(): string
    {
        return GeneralUtility::camelCaseToLowerCaseUnderscored(
            static::extensionName()
        );
    }
}