private static function generateHash($value, string $namespace = ''): string
    {
        if (\is_object($value)) {
            $value = spl_object_hash($value);
        } elseif (\is_array($value)) {
            array_walk_recursive($value, function (&$v) {
                if (\is_object($v)) {
                    $v = spl_object_hash($v);
                }
            });
        }

        return hash('sha256', $namespace.':'.serialize($value));
    }
private static function generateHash($value, string $namespace = ''): string
    {
        if (\is_object($value)) {
            $value = spl_object_hash($value);
        } elseif (\is_array($value)) {
            array_walk_recursive($value, function (&$v) {
                if (\is_object($v)) {
                    $v = spl_object_hash($v);
                }
            });
        }

        return hash('sha256', $namespace.':'.serialize($value));
    }
private static function generateHash ( $ value , string $ namespace = '' ) : string { if ( \ is_object ( $ value ) ) { $ value = spl_object_hash ( $ value ) ; } elseif ( \ is_array ( $ value ) ) { array_walk_recursive ( $ value , function ( & $ v ) { if ( \ is_object ( $ v ) ) { $ v = spl_object_hash ( $ v ) ; } } ) ; } return hash ( 'sha256' , $ namespace . ':' . serialize ( $ value ) ) ; }
Generates a SHA-256 hash for the given value.

Optionally, a namespace string can be passed. Calling this method will produce
the same values, but different namespaces, will return different hashes.

@param mixed  $value     The value to hash
@param string $namespace Optional. The namespace

@return string The SHA-256 hash
Generates a SHA - 256 hash for the given value .