automatewoo/includes/DataTypes/Comment.php
fei-source 47d3c9a8b6 Update to v6.2.2
Source: GrootMade/Festinger Vault
2026-03-15 08:31:15 +08:00

44 lines
651 B
PHP

<?php
// phpcs:ignoreFile
namespace AutomateWoo\DataTypes;
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* @class Comment
*/
class Comment extends AbstractDataType {
/**
* @param $item
* @return bool
*/
function validate( $item ) {
return is_object( $item );
}
/**
* @param $item
* @return mixed
*/
function compress( $item ) {
return $item->comment_ID;
}
/**
* @param $compressed_item
* @param $compressed_data_layer
* @return \WP_Comment|false
*/
function decompress( $compressed_item, $compressed_data_layer ) {
if ( ! $compressed_item ) {
return false;
}
return get_comment( $compressed_item );
}
}