src/Patch.php
public static function fromJson($json)
    {
        if (!is_object($json)) {
            $json = json_decode($json);
        }
        $properties = ['package', 'description', 'url', 'sha1', 'depth'];
        $patch = new static();

        foreach ($properties as $property) {
            if (isset($json->{$property})) {
                $patch->{$property} = $json->{$property};
            }
        }

        return $patch;
    }
public static function fromJson($json)
    {
        if (!is_object($json)) {
            $json = json_decode($json);
        }
        $properties = ['package', 'description', 'url', 'sha1', 'depth'];
        $patch = new static();

        foreach ($properties as $property) {
            if (isset($json->{$property})) {
                $patch->{$property} = $json->{$property};
            }
        }

        return $patch;
    }
public static function fromJson ( $ json ) { if ( ! is_object ( $ json ) ) { $ json = json_decode ( $ json ) ; } $ properties = [ 'package' , 'description' , 'url' , 'sha1' , 'depth' ] ; $ patch = new static ( ) ; foreach ( $ properties as $ property ) { if ( isset ( $ json -> { $ property } ) ) { $ patch -> { $ property } = $ json -> { $ property } ; } } return $ patch ; }
Create a Patch from a serialized representation.

@param $json
A json_encode'd representation of a Patch.

@return Patch
A Patch with all of the serialized properties set.
Create a Patch from a serialized representation .