HEX
Server: Apache/2
System: Linux server1c 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64
User: jandjware (1008)
PHP: 8.2.23
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/jandjware/public_html/wp-content/plugins/hostinger/includes/Admin/Jobs/NotifyMcpJob.php
<?php

namespace Hostinger\Admin\Jobs;
use Hostinger\Mcp\EventHandlerFactory;
use Hostinger\Mcp\Handlers\EventHandler;
use PHPUnit\Exception;

class NotifyMcpJob extends AbstractJob implements JobInterface {

    public const JOB_NAME = 'notify_mcp';

    private EventHandlerFactory $event_handler_factory;

    public function __construct( ActionScheduler $action_scheduler, EventHandlerFactory $event_handler_factory ) {
        $this->event_handler_factory = $event_handler_factory;
        parent::__construct( $action_scheduler );
    }

    public function get_name(): string {
        return self::JOB_NAME;
    }

    public function event_handler( string $event ): EventHandler {
        return $this->event_handler_factory->get_handler( $event );
    }

    public function process_items( array $args = array() ): void {
        $handler = $this->event_handler( $args['event'] );
        $handler->send( $args );
    }

    public function schedule( array $args = array() ): void {
        if ( $this->can_schedule( $args ) ) {
            $this->action_scheduler->schedule_immediate( $this->get_process_item_hook(), array( $args ) );
        }
    }

    public function can_schedule( $args = array() ): bool {
        if ( ! parent::can_schedule( $args ) ) {
            return false;
        }

        try {
            $handler = $this->event_handler( $args['event'] );
            return $handler->can_send( $args );
        } catch ( Exception $e ) {
            return false;
        }
    }
}