src/Freezer.php
public function generateHash($object)
    {
        if (!is_object($object)) {
            throw new InvalidArgumentException(1, 'object');
        }

        $properties = call_user_func($this->propertyReader, $object);
        ksort($properties);

        if (isset($properties['__freezer'])) {
            unset($properties['__freezer']);
        }

        foreach ($properties as $name => $value) {
            if (is_array($value)) {
                $properties[$name] = '<array>';
            } elseif (is_object($value)) {
                if (!isset($value->{$this->idProperty})) {
                    $value->{$this->idProperty} = $this->generateId();
                }

                $properties[$name] = (string)$value->{$this->idProperty};
            } elseif (is_resource($value)) {
                $properties[$name] = null;
            }
        }

        return sha1(get_class($object) . join(':', $properties));
    }
public function generateHash($object)
    {
        if (!is_object($object)) {
            throw new InvalidArgumentException(1, 'object');
        }

        $properties = call_user_func($this->propertyReader, $object);
        ksort($properties);

        if (isset($properties['__freezer'])) {
            unset($properties['__freezer']);
        }

        foreach ($properties as $name => $value) {
            if (is_array($value)) {
                $properties[$name] = '<array>';
            } elseif (is_object($value)) {
                if (!isset($value->{$this->idProperty})) {
                    $value->{$this->idProperty} = $this->generateId();
                }

                $properties[$name] = (string)$value->{$this->idProperty};
            } elseif (is_resource($value)) {
                $properties[$name] = null;
            }
        }

        return sha1(get_class($object) . join(':', $properties));
    }
public function generateHash ( $ object ) { if ( ! is_object ( $ object ) ) { throw new InvalidArgumentException ( 1 , 'object' ) ; } $ properties = call_user_func ( $ this -> propertyReader , $ object ) ; ksort ( $ properties ) ; if ( isset ( $ properties [ '__freezer' ] ) ) { unset ( $ properties [ '__freezer' ] ) ; } foreach ( $ properties as $ name => $ value ) { if ( is_array ( $ value ) ) { $ properties [ $ name ] = '<array>' ; } elseif ( is_object ( $ value ) ) { if ( ! isset ( $ value -> { $ this -> idProperty } ) ) { $ value -> { $ this -> idProperty } = $ this -> generateId ( ) ; } $ properties [ $ name ] = ( string ) $ value -> { $ this -> idProperty } ; } elseif ( is_resource ( $ value ) ) { $ properties [ $ name ] = null ; } } return sha1 ( get_class ( $ object ) . join ( ':' , $ properties ) ) ; }
Hashes an object using the SHA1 hashing function on the property 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
Hashes an object using the SHA1 hashing function on the property values of an object without recursing into aggregated arrays or objects .