Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/app/bundles/CampaignBundle/Executioner/Result/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CampaignBundle/Executioner/Result/Responses.php
<?php

namespace Mautic\CampaignBundle\Executioner\Result;

use Doctrine\Common\Collections\ArrayCollection;
use Mautic\CampaignBundle\Entity\Event;
use Mautic\CampaignBundle\Entity\LeadEventLog;

class Responses
{
    private array $actionResponses = [];

    private array $conditionResponses = [];

    public function setFromLogs(ArrayCollection $logs): void
    {
        /** @var LeadEventLog $log */
        foreach ($logs as $log) {
            $metadata = $log->getMetadata();
            $response = $metadata;

            if (isset($metadata['timeline']) && 1 === count($metadata)) {
                // Legacy listeners set a string in CampaignExecutionEvent::setResult that Lead::appendToMetadata put into
                // under a timeline key for BC support. To keep BC for decisions, we have to extract that back out for the bubble
                // up responses

                $response = $metadata['timeline'];
            }

            $this->setResponse($log->getEvent(), $response);
        }
    }

    /**
     * @param mixed $response
     */
    public function setResponse(Event $event, $response): void
    {
        switch ($event->getEventType()) {
            case Event::TYPE_ACTION:
                if (!isset($this->actionResponses[$event->getType()])) {
                    $this->actionResponses[$event->getType()] = [];
                }
                $this->actionResponses[$event->getType()][$event->getId()] = $response;
                break;
            case Event::TYPE_CONDITION:
                if (!isset($this->conditionResponses[$event->getType()])) {
                    $this->conditionResponses[$event->getType()] = [];
                }
                $this->conditionResponses[$event->getType()][$event->getId()] = $response;
                break;
        }
    }

    /**
     * @param string|null $type
     *
     * @return array
     */
    public function getActionResponses($type = null)
    {
        if ($type) {
            return $this->actionResponses[$type] ?? [];
        }

        return $this->actionResponses;
    }

    /**
     * @param string|null $type
     *
     * @return array
     */
    public function getConditionResponses($type = null)
    {
        if ($type) {
            return $this->conditionResponses[$type] ?? [];
        }

        return $this->conditionResponses;
    }

    public function containsResponses(): int
    {
        return count($this->actionResponses) + count($this->conditionResponses);
    }
}

Spamworldpro Mini