public function escapeFieldPath($fieldPath)
    {
        if ($fieldPath instanceof FieldPath) {
            $parts = $fieldPath->path();

            $out = [];
            foreach ($parts as $part) {
                $out[] = $this->escapePathPart($part);
            }

            $fieldPath = implode('.', $out);
        } else {
            if (!preg_match(self::VALID_FIELD_PATH, $fieldPath)) {
                throw new \InvalidArgumentException('Paths cannot be empty and must not contain `*~/[]\`.');
            }
        }

        $this->validateFieldPath($fieldPath);
        return $fieldPath;
    }
public function escapeFieldPath($fieldPath)
    {
        if ($fieldPath instanceof FieldPath) {
            $parts = $fieldPath->path();

            $out = [];
            foreach ($parts as $part) {
                $out[] = $this->escapePathPart($part);
            }

            $fieldPath = implode('.', $out);
        } else {
            if (!preg_match(self::VALID_FIELD_PATH, $fieldPath)) {
                throw new \InvalidArgumentException('Paths cannot be empty and must not contain `*~/[]\`.');
            }
        }

        $this->validateFieldPath($fieldPath);
        return $fieldPath;
    }
public function escapeFieldPath ( $ fieldPath ) { if ( $ fieldPath instanceof FieldPath ) { $ parts = $ fieldPath -> path ( ) ; $ out = [ ] ; foreach ( $ parts as $ part ) { $ out [ ] = $ this -> escapePathPart ( $ part ) ; } $ fieldPath = implode ( '.' , $ out ) ; } else { if ( ! preg_match ( self :: VALID_FIELD_PATH , $ fieldPath ) ) { throw new \ InvalidArgumentException ( 'Paths cannot be empty and must not contain `*~/[]\`.' ) ; } } $ this -> validateFieldPath ( $ fieldPath ) ; return $ fieldPath ; }
Escape a field path and return it as a string.

@param string|FieldPath $fieldPath
@return string
@throws \InvalidArgumentException If the path is a string, and is invalid.
Escape a field path and return it as a string .