public function getHash($object)
    {
        // Bail out if a non-object was passed.
        if (!is_object($object)) {
            throw Object_Freezer_Util::getInvalidArgumentException(1, 'object');
        }

        $attributes = Object_Freezer_Util::readAttributes($object);
        ksort($attributes);

        if (isset($attributes['__php_object_freezer_hash'])) {
            unset($attributes['__php_object_freezer_hash']);
        }

        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $attributes[$key] = '<array>';
            } elseif (is_object($value)) {
                if (!isset($value->__php_object_freezer_uuid)) {
                    $value->__php_object_freezer_uuid =
                    $this->idGenerator->getId();
                }

                $attributes[$key] = $value->__php_object_freezer_uuid;
            } elseif (is_resource($value)) {
                $attributes[$key] = null;
            }
        }

        return sha1(get_class($object).implode(':', $attributes));
    }
public function getHash($object)
    {
        // Bail out if a non-object was passed.
        if (!is_object($object)) {
            throw Object_Freezer_Util::getInvalidArgumentException(1, 'object');
        }

        $attributes = Object_Freezer_Util::readAttributes($object);
        ksort($attributes);

        if (isset($attributes['__php_object_freezer_hash'])) {
            unset($attributes['__php_object_freezer_hash']);
        }

        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $attributes[$key] = '<array>';
            } elseif (is_object($value)) {
                if (!isset($value->__php_object_freezer_uuid)) {
                    $value->__php_object_freezer_uuid =
                    $this->idGenerator->getId();
                }

                $attributes[$key] = $value->__php_object_freezer_uuid;
            } elseif (is_resource($value)) {
                $attributes[$key] = null;
            }
        }

        return sha1(get_class($object).implode(':', $attributes));
    }
public function getHash ( $ object ) { // Bail out if a non-object was passed. if ( ! is_object ( $ object ) ) { throw Object_Freezer_Util :: getInvalidArgumentException ( 1 , 'object' ) ; } $ attributes = Object_Freezer_Util :: readAttributes ( $ object ) ; ksort ( $ attributes ) ; if ( isset ( $ attributes [ '__php_object_freezer_hash' ] ) ) { unset ( $ attributes [ '__php_object_freezer_hash' ] ) ; } foreach ( $ attributes as $ key => $ value ) { if ( is_array ( $ value ) ) { $ attributes [ $ key ] = '<array>' ; } elseif ( is_object ( $ value ) ) { if ( ! isset ( $ value -> __php_object_freezer_uuid ) ) { $ value -> __php_object_freezer_uuid = $ this -> idGenerator -> getId ( ) ; } $ attributes [ $ key ] = $ value -> __php_object_freezer_uuid ; } elseif ( is_resource ( $ value ) ) { $ attributes [ $ key ] = null ; } } return sha1 ( get_class ( $ object ) . implode ( ':' , $ attributes ) ) ; }
Implementation of Object_Freezer_HashGenerator that uses the SHA1
hashing function on the attribute values of an object without recursing
into aggregated arrays or objects.

@param object $object The object that is to be hashed.

@return string

@throws InvalidArgumentException
Implementation of Object_Freezer_HashGenerator that uses the SHA1 hashing function on the attribute values of an object without recursing into aggregated arrays or objects .