public static function toBlock(Serializer $serializer, $json)
    {
        if (empty($json)) {
            return null;
        }

        $contentArray = json_decode($json, true);
        if (!array_key_exists("type", $contentArray)) {
            return null;
        }

        $className = BlockFactory::getBlockClass($contentArray["type"]);
        if (!class_exists($className)) {
            return null;
        }

        return $serializer->deserialize($json, $className, 'json');
    }
public static function toBlock(Serializer $serializer, $json)
    {
        if (empty($json)) {
            return null;
        }

        $contentArray = json_decode($json, true);
        if (!array_key_exists("type", $contentArray)) {
            return null;
        }

        $className = BlockFactory::getBlockClass($contentArray["type"]);
        if (!class_exists($className)) {
            return null;
        }

        return $serializer->deserialize($json, $className, 'json');
    }
public static function toBlock ( Serializer $ serializer , $ json ) { if ( empty ( $ json ) ) { return null ; } $ contentArray = json_decode ( $ json , true ) ; if ( ! array_key_exists ( "type" , $ contentArray ) ) { return null ; } $ className = BlockFactory :: getBlockClass ( $ contentArray [ "type" ] ) ; if ( ! class_exists ( $ className ) ) { return null ; } return $ serializer -> deserialize ( $ json , $ className , 'json' ) ; }
De-serializes a block

@param \JMS\Serializer\Serializer $serializer
@param $json

@return \RedKiteCms\Content\Block\BaseBlock
De - serializes a block