HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/lcc.kaunokolegija.lt/wp-content/plugins/codepress-admin-columns/classes/Admin/Banner.php
<?php

namespace AC\Admin;

use AC\IntegrationRepository;
use AC\Integrations;
use AC\Promo;
use AC\PromoCollection;
use AC\View;

class Banner
{

    private $integrations;

    public function __construct()
    {
        $this->integrations = new IntegrationRepository();
    }

    private function get_active_promotion(): ?Promo
    {
        return (new PromoCollection())->find_active();
    }

    private function get_missing_integrations(): Integrations
    {
        return $this->integrations->find_all_by_active_plugins();
    }

    public function render(): string
    {
        $banner = new View([
            'promo'        => $this->get_active_promotion(),
            'integrations' => $this->get_missing_integrations()->all(),
            'discount'     => 10,
        ]);

        $banner->set_template('admin/side-banner');

        return $banner->render();
    }

    public function __toString()
    {
        return $this->render();
    }

}