Firestore/src/WriteBatch.php
private function checkPrefixes(array $paths)
    {
        sort($paths);

        for ($i = 1; $i < count($paths); $i++) {
            $prefix = $paths[$i-1];
            $suffix = $paths[$i];

            $prefix = explode('.', $prefix);
            $suffix = explode('.', $suffix);

            $isPrefix = count($prefix) < count($suffix)
                && $prefix === array_slice($suffix, 0, count($prefix));

            if ($isPrefix) {
                throw new \InvalidArgumentException(sprintf(
                    'Field path conflict detected for field path `%s`. ' .
                    'Conflicts occur when a field path descends from another ' .
                    'path. For instance `a.b` is not allowed when `a` is also ' .
                    'provided.',
                    $prefix
                ));
            }
        }
    }
private function checkPrefixes(array $paths)
    {
        sort($paths);

        for ($i = 1; $i < count($paths); $i++) {
            $prefix = $paths[$i-1];
            $suffix = $paths[$i];

            $prefix = explode('.', $prefix);
            $suffix = explode('.', $suffix);

            $isPrefix = count($prefix) < count($suffix)
                && $prefix === array_slice($suffix, 0, count($prefix));

            if ($isPrefix) {
                throw new \InvalidArgumentException(sprintf(
                    'Field path conflict detected for field path `%s`. ' .
                    'Conflicts occur when a field path descends from another ' .
                    'path. For instance `a.b` is not allowed when `a` is also ' .
                    'provided.',
                    $prefix
                ));
            }
        }
    }
private function checkPrefixes ( array $ paths ) { sort ( $ paths ) ; for ( $ i = 1 ; $ i < count ( $ paths ) ; $ i ++ ) { $ prefix = $ paths [ $ i - 1 ] ; $ suffix = $ paths [ $ i ] ; $ prefix = explode ( '.' , $ prefix ) ; $ suffix = explode ( '.' , $ suffix ) ; $ isPrefix = count ( $ prefix ) < count ( $ suffix ) && $ prefix === array_slice ( $ suffix , 0 , count ( $ prefix ) ) ; if ( $ isPrefix ) { throw new \ InvalidArgumentException ( sprintf ( 'Field path conflict detected for field path `%s`. ' . 'Conflicts occur when a field path descends from another ' . 'path. For instance `a.b` is not allowed when `a` is also ' . 'provided.' , $ prefix ) ) ; } } }
Check list of FieldPaths for prefix paths and throw exception.

@param string[] $paths
@throws \InvalidArgumentException If prefix paths are found.
Check list of FieldPaths for prefix paths and throw exception .