FluidTYPO3\Vhs\ViewHelpers\Condition\Iterator\ContainsViewHelper::assertHaystackIsQueryResultAndHasNeedle PHP Method

assertHaystackIsQueryResultAndHasNeedle() protected static method

protected static assertHaystackIsQueryResultAndHasNeedle ( mixed $haystack, mixed $needle ) : boolean | integer
$haystack mixed
$needle mixed
return boolean | integer
    protected static function assertHaystackIsQueryResultAndHasNeedle($haystack, $needle)
    {
        if (true === $needle instanceof DomainObjectInterface) {
            /** @var $needle DomainObjectInterface */
            $needle = $needle->getUid();
        }
        foreach ($haystack as $index => $candidate) {
            /** @var $candidate DomainObjectInterface */
            if ((int) $candidate->getUid() === (int) $needle) {
                return $index;
            }
        }
        return false;
    }