oont-contents/plugins/webappick-product-feed-for-woocommerce/V5/Template/GooglereviewTemplate.php
2025-03-31 21:42:48 +02:00

88 lines
1.7 KiB
PHP

<?php
/**
* Class Googlereview Template
*
* @package CTXFeed
* @subpackage CTXFeed\V5\Template
* @category MyCategory
*/
namespace CTXFeed\V5\Template;
use CTXFeed\V5\File\FileFactory;
use CTXFeed\V5\Product\ProductFactory;
/**
* Class Googlereview Template
*
* @package CTXFeed
* @subpackage CTXFeed\V5\Template
* @category MyCategory
*/
class GooglereviewTemplate implements TemplateInterface {
/**
* @var \CTXFeed\V5\Utility\Config $config Contain Feed Config.
*/
private $config;
/**
* @var array $ids Contain Product Ids.
*/
private $ids;
/**
* @var mixed
*/
private $structure;
/**
* GooglereviewTemplate constructor.
*
* @param array $ids Product Ids.
* @param \CTXFeed\V5\Utility\Config $config Feed Config.
* @param array $structure Feed Structure.
*/
public function __construct( $ids, $config, $structure ) {
$this->ids = $ids;
$this->config = $config;
$this->structure = $structure;
}
/**
* Get Feed Body.
*
* @return false|string
* @throws \Exception Exception.
*/
public function get_feed() {
$feed = ProductFactory::get_content( $this->ids, $this->config, $this->structure );
return $feed->make_body();
}
/**
* Get Feed Header.
*
* @return mixed
*/
public function get_header() {
$feed = FileFactory::get_file_data( $this->structure, $this->config );
$feed = $feed->make_header_footer();
return $feed['header'];
}
/**
* Get Feed Footer.
*
* @return mixed
*/
public function get_footer() {
$feed = FileFactory::get_file_data( $this->ids, $this->config );
$feed = $feed->make_header_footer();
return $feed['footer'];
}
}