src/Concerns/ChecksTypes.php
protected function isTypeWithinArray($type, array $haystackTypes)
    {
        $iterator = new \ArrayIterator($haystackTypes);

        while($iterator->valid()) {
            $seenValue = $iterator->current();

            if ($seenValue === $type) {
                return true;
            }

            $parts = explode('.', $seenValue);
            if (count($parts) > 1) {
                array_shift($parts);

                $newKey = implode('.', $parts);
                $iterator->append($newKey);
            }

            $iterator->next();
        }

        return false;
    }
protected function isTypeWithinArray($type, array $haystackTypes)
    {
        $iterator = new \ArrayIterator($haystackTypes);

        while($iterator->valid()) {
            $seenValue = $iterator->current();

            if ($seenValue === $type) {
                return true;
            }

            $parts = explode('.', $seenValue);
            if (count($parts) > 1) {
                array_shift($parts);

                $newKey = implode('.', $parts);
                $iterator->append($newKey);
            }

            $iterator->next();
        }

        return false;
    }
protected function isTypeWithinArray ( $ type , array $ haystackTypes ) { $ iterator = new \ ArrayIterator ( $ haystackTypes ) ; while ( $ iterator -> valid ( ) ) { $ seenValue = $ iterator -> current ( ) ; if ( $ seenValue === $ type ) { return true ; } $ parts = explode ( '.' , $ seenValue ) ; if ( count ( $ parts ) > 1 ) { array_shift ( $ parts ) ; $ newKey = implode ( '.' , $ parts ) ; $ iterator -> append ( $ newKey ) ; } $ iterator -> next ( ) ; } return false ; }
Checks if the given type exists within the array of types.

@param string $type
@param array $haystackTypes
@return boolean
Checks if the given type exists within the array of types .