<?php

namespace Opentalent\OtTemplating\ViewHelpers\Request;

use Closure;
use Opentalent\OtCore\ViewHelpers\OtAbstractViewHelper;
use Opentalent\OtCore\Website\OtWebsiteRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;

/**
 *   Returns the current Typo3 Fe User if any (FE only)
 *
 *     {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 *
 *     {ot:request.getFeUser()}
 *
 * @package Opentalent\OtTemplating\ViewHelpers
 */
class GetFeUserViewHelper extends OtAbstractViewHelper {

    /**
     * -- This method is expected by Fluid --
     * Renders the content as html
     *
     * @param array $arguments
     * @param Closure $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     * @return string|null
     */
    public static function renderStatic(
        array $arguments,
        Closure $renderChildrenClosure,
        RenderingContextInterface $renderingContext
    ) {
        return $GLOBALS['TSFE']->fe_user->user;
    }
}
