* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ namespace PrestaShop\Module\AutoUpgrade\Twig\Block; use PrestaShop\Module\AutoUpgrade\ChannelInfo; use PrestaShop\Module\AutoUpgrade\Parameters\UpgradeConfiguration; use Twig_Environment; class ChannelInfoBlock { /** * @var UpgradeConfiguration */ private $config; /** * @var ChannelInfo */ private $channelInfo; /** * @var Twig_Environment|\Twig\Environment */ private $twig; /** * ChannelInfoBlock constructor. * * @param UpgradeConfiguration $config * @param ChannelInfo $channelInfo * @param Twig_Environment|\Twig\Environment $twig */ public function __construct(UpgradeConfiguration $config, ChannelInfo $channelInfo, $twig) { $this->config = $config; $this->channelInfo = $channelInfo; $this->twig = $twig; } /** * @return string HTML */ public function render() { $channel = $this->channelInfo->getChannel(); $upgradeInfo = $this->channelInfo->getInfo(); if ($channel == 'private') { $upgradeInfo['link'] = $this->config->get('private_release_link'); $upgradeInfo['md5'] = $this->config->get('private_release_md5'); } return $this->twig->render( '@ModuleAutoUpgrade/block/channelInfo.twig', array( 'upgradeInfo' => $upgradeInfo, ) ); } }