<?php

namespace Diamond\Modules\Promoblock;



use Diamond\Application\Content\ContentService;

/**
 * Description of Promoblock
 *
 * @author Diamond Code Generator
 */
class Promoblock extends \Core\ModuleController
{

    public $code;

    private $service;

    public function __construct(ContentService $promoblock)
    {
        $this->service = $promoblock;
    }

    public function process(): string
    {

        if (!$this->code) {
            return '';
        }

        if (!$promo = $this->service->getPromoBlockContentByCode($this->code)) {
            return '';
        }

        return $promo->getBody();
    }
}               