FluidTYPO3\Vhs\ViewHelpers\Iterator\FirstViewHelper::render PHP Method

render() public method

Render method
public render ( ) : mixed | null
return mixed | null
    public function render()
    {
        $haystack = $this->arguments['haystack'];
        if (null === $haystack) {
            $haystack = $this->renderChildren();
        }
        if (false === is_array($haystack) && false === $haystack instanceof \Iterator && null !== $haystack) {
            throw new Exception('Invalid argument supplied to Iterator/FirstViewHelper - expected array, Iterator or NULL but got ' . gettype($haystack), 1351958398);
        }
        if (null === $haystack) {
            return null;
        }
        foreach ($haystack as $needle) {
            return $needle;
        }
        return null;
    }