public static function has($data, string $path): bool
    {
        Assert::isArrayAccessible($data);
        Assert::stringNotEmpty($path);

        $path = explode('/', $path);

        while (($part = array_shift($path)) !== null) {
            if (! ($data instanceof ArrayAccess) && ! is_array($data)) {
                return false;
            }
            if (! (isset($data[$part]) || array_key_exists($part, $data))) {
                return false;
            }
            $data = $data[$part];
        }

        return true;
    }
public static function has($data, string $path): bool
    {
        Assert::isArrayAccessible($data);
        Assert::stringNotEmpty($path);

        $path = explode('/', $path);

        while (($part = array_shift($path)) !== null) {
            if (! ($data instanceof ArrayAccess) && ! is_array($data)) {
                return false;
            }
            if (! (isset($data[$part]) || array_key_exists($part, $data))) {
                return false;
            }
            $data = $data[$part];
        }

        return true;
    }
public static function has ( $ data , string $ path ) : bool { Assert :: isArrayAccessible ( $ data ) ; Assert :: stringNotEmpty ( $ path ) ; $ path = explode ( '/' , $ path ) ; while ( ( $ part = array_shift ( $ path ) ) !== null ) { if ( ! ( $ data instanceof ArrayAccess ) && ! is_array ( $ data ) ) { return false ; } if ( ! ( isset ( $ data [ $ part ] ) || array_key_exists ( $ part , $ data ) ) ) { return false ; } $ data = $ data [ $ part ] ; } return true ; }
Returns whether a key exists from an array or `ArrayAccess` object using path syntax to check nested data.

This method does not allow for keys that contain `/`.

Example:

// Check if the the bar key of a set of nested arrays exists.
// This is equivalent to isset($data['foo']['baz']['bar']) but won't
// throw warnings for missing keys.
Arr::has($data, 'foo/baz/bar');

<br>
Note: Using `isset()` with nested data, like `isset($data['a']['b'])`, won't call `offsetExists` for 'a'.
It calls `offsetGet('a')` and if 'a' doesn't exist and an `isset` check isn't done in `offsetGet`, a warning is
triggered. It could be argued that that `ArrayAccess` object should fix this in their implementation of
`offsetGet`, and I would agree. Regardless I think this is nicer syntax.

@param array|ArrayAccess $data Data to check values from
@param string            $path Path to traverse and check keys from
Returns whether a key exists from an array or ArrayAccess object using path syntax to check nested data .