FluidTYPO3\Vhs\ViewHelpers\Condition\Iterator\ContainsViewHelper::assertHaystackIsArrayAndHasNeedle PHP Метод

assertHaystackIsArrayAndHasNeedle() защищенный статический Метод

protected static assertHaystackIsArrayAndHasNeedle ( mixed $haystack, mixed $needle, array $arguments ) : boolean | integer
$haystack mixed
$needle mixed
$arguments array
Результат boolean | integer
    protected static function assertHaystackIsArrayAndHasNeedle($haystack, $needle, $arguments)
    {
        if (false === $needle instanceof DomainObjectInterface) {
            if (true === (bool) $arguments['considerKeys']) {
                $result = (bool) (false !== array_search($needle, $haystack) || true === isset($haystack[$needle]));
            } else {
                $result = array_search($needle, $haystack);
            }
            return $result;
        } else {
            /** @var $needle DomainObjectInterface */
            foreach ($haystack as $index => $straw) {
                /** @var $straw DomainObjectInterface */
                if ((int) $straw->getUid() === (int) $needle->getUid()) {
                    return $index;
                }
            }
        }
        return false;
    }