public function unserialize($str)
    {
        $data = @unserialize($str);

        if ($data === false) {
            throw new \RuntimeException(sprintf('Can\'t unserialize model data: %s', $str));
        }

        if (!is_array($data)) {
            throw new \RuntimeException(sprintf('Unserialized data must be array, "%s" given.', gettype($data)));
        }

        foreach ($data as $propertyName => $propertyValue) {
            if (!property_exists($this, $propertyName)) {
                throw new \LogicException(sprintf('Undefined property "%s" in model "%s". Allowed properies: "%s".', $propertyName, get_class($this), implode('", "', array_keys(get_object_vars($this)))));
            }

            $this->{$propertyName} = $propertyValue;
        }
    }
public function unserialize($str)
    {
        $data = @unserialize($str);

        if ($data === false) {
            throw new \RuntimeException(sprintf('Can\'t unserialize model data: %s', $str));
        }

        if (!is_array($data)) {
            throw new \RuntimeException(sprintf('Unserialized data must be array, "%s" given.', gettype($data)));
        }

        foreach ($data as $propertyName => $propertyValue) {
            if (!property_exists($this, $propertyName)) {
                throw new \LogicException(sprintf('Undefined property "%s" in model "%s". Allowed properies: "%s".', $propertyName, get_class($this), implode('", "', array_keys(get_object_vars($this)))));
            }

            $this->{$propertyName} = $propertyValue;
        }
    }
public function unserialize ( $ str ) { $ data = @ unserialize ( $ str ) ; if ( $ data === false ) { throw new \ RuntimeException ( sprintf ( 'Can\'t unserialize model data: %s' , $ str ) ) ; } if ( ! is_array ( $ data ) ) { throw new \ RuntimeException ( sprintf ( 'Unserialized data must be array, "%s" given.' , gettype ( $ data ) ) ) ; } foreach ( $ data as $ propertyName => $ propertyValue ) { if ( ! property_exists ( $ this , $ propertyName ) ) { throw new \ LogicException ( sprintf ( 'Undefined property "%s" in model "%s". Allowed properies: "%s".' , $ propertyName , get_class ( $ this ) , implode ( '", "' , array_keys ( get_object_vars ( $ this ) ) ) ) ) ; } $ this -> { $ propertyName } = $ propertyValue ; } }
Implements if \Serializable
Implements if \ Serializable