getReturn example

$eventArgs->setReturn($value);
        $eventArgs->setName($event);
        $eventArgs->setProcessed(false);

        foreach ($this->getListeners($event) as $listener) {
            if (($return = $listener->execute($eventArgs)) !== null) {
                $eventArgs->setReturn($return);
            }
        }
        $eventArgs->setProcessed(true);

        return $eventArgs->getReturn();
    }

    /** * Event which is fired to collect plugin parameters * to register additionally application components or configurations. * * @param string $event * @param array|null $eventArgs * * @throws Enlight_Event_Exception * * @return ArrayCollection<mixed> */
$interval = $this->dateIntervalFieldSerializer->encode(
            new DateIntervalField('name', 'name'),
            $this->createStub(EntityExistence::class),
            $data,
            $this->createMock(WriteParameterBag::class)
        );

        static::assertNull($interval->current());

        $interval->next();

        static::assertNull($interval->getReturn());
    }

    public function testEncodeMethodWithNullWillYieldNull(): void
    {
        $data = new KeyValuePair('key', null, false);

        $interval = $this->dateIntervalFieldSerializer->encode(
            new DateIntervalField('name', 'name'),
            $this->createStub(EntityExistence::class),
            $data,
            $this->createMock(WriteParameterBag::class)
        );
            // Also allows you to add own tokens             if ($event = $this->getEventManager()->notifyUntil(
                'SwagMultiEdit_Product_DqlHelper_getDqlFromTokens_Token_' . ucfirst(strtolower($token['type'])),
                [
                    'subject' => $this,
                    'currentToken' => $token,
                    'alltokens' => $tokens,
                    'processedTokens' => $newTokens,
                ]
            )
            ) {
                $return = $event->getReturn();
                if (!\is_array($return)) {
                    $newTokens[] = $return;
                } else {
                    $newToken[] = $return[0];
                    $params[] = $return[1];
                }
                continue;
            }

            // RegExp handling             $lastToken = $tokens[$key - 1]['token'];
            


        $mail = null;
        if ($event = $this->eventManager->notifyUntil(
            'Shopware_Modules_Order_SendMail_Create',
            [
                'subject' => $this,
                'context' => $context,
                'variables' => $variables,
            ]
        )) {
            $mail = $event->getReturn();
        }

        if (!($mail instanceof Zend_Mail)) {
            $overrideConfig = $this->eventManager->filter(
                'Shopware_Modules_Order_SendMail_CreateMail_FilterOverrideConfig',
                [],
                [
                    'subject' => $this,
                    'context' => $context,
                    'variables' => $variables,
                ]
            );
default:
                    // Allow custom types. If not event handles the unknown type                     // an exception will be thrown                     if ($event = $this->getEventManager()->notifyUntil(
                        'SwagMultiEdit_Product_Grammar_generateAttributesFromColumns_Type_' . ucfirst(strtolower($type)),
                        [
                            'subject' => $this,
                            'type' => $type,
                            'mapping' => $mapping,
                        ]
                    )) {
                        $attributes[$formattedColumn] = $event->getReturn();
                    } else {
                        throw new RuntimeException(sprintf('Column with type %s was not configured, yet', $type));
                    }
            }
        }

        return $attributes;
    }

    /** * Returns an array which represents the grammar of out product resource * * @return array<string, array<int|string, string|array<string>>> */
if ($fallbackName !== null && !$event && $fallbackName !== $id) {
            $event = $eventManager->notifyUntil(
                'Enlight_Bootstrap_InitResource_' . $fallbackName,
                ['subject' => $this]
            );
        }

        $circularReference = false;

        try {
            if ($event) {
                $this->services[$id] = $event->getReturn();
            } else {
                $this->services[$id] = parent::get($id$invalidBehavior);
            }
        } catch (ServiceCircularReferenceException $e) {
            $circularReference = true;
            throw $e;
        } finally {
            if ($circularReference === false) {
                $eventManager->notify(
                    'Enlight_Bootstrap_AfterInitResource_' . $id,
                    ['subject' => $this]
                );
return true;
    }

    public function onFilterRender(Enlight_Event_EventArgs $args)
    {
        /** @var Enlight_Controller_Request_RequestHttp $request */
        $request = $args->getSubject()->Action()->Request();
        /** @var Enlight_Controller_Response_ResponseHttp $response */
        $response = $args->getSubject()->Action()->Response();

        $source = $args->getReturn();

        $headers = $response->getHeaders();
        foreach ($headers as $header) {
            if ($header['name'] === 'Content-Type' && str_starts_with($header['value'], 'application/javascript')) {
                $source = str_replace(["\r\n", "\r"], "\n", $source);
                $expressions = [
                    // Remove comments                     '#/\*.*?\*/#ms' => '',
                    '#^\s*//.*$#m' => '',
                    // '#\n\s+#ms' => '',                     '#^\s+#ms' => '',
                    

        $controllerName = $request->getControllerName();
        $controllerName = $this->formatControllerName($controllerName);
        $moduleName = $this->formatModuleName($this->curModule);
        $controllerId = $this->getControllerServiceId($moduleName$controllerName);
        $request->unsetAttribute('controllerId');

        if ($event = Shopware()->Events()->notifyUntil(
            'Enlight_Controller_Dispatcher_ControllerPath_' . $moduleName . self::CLASS_NAMESPACE_SEPARATOR . $controllerName,
            ['subject' => $this, 'request' => $request])
        ) {
            return $event->getReturn();
        }

        if ($controllerId) {
            $request->setAttribute('controllerId', $controllerId);

            return clone $this->container->get($controllerId);
        }

        return null;
    }

    
 else {
            static::expectException(InvalidSerializerFieldException::class);
        }

        $existence = new EntityExistence('product', [], false, false, false, []);
        $field = new StringField('password', 'password');

        $kv = new KeyValuePair($field->getPropertyName(), null, true);

        $params = new WriteParameterBag(new ProductDefinition(), WriteContext::createFromContext(Context::createDefaultContext()), '', new WriteCommandQueue());

        $this->serializer->encode($field$existence$kv$params)->getReturn();
    }

    /** * @dataProvider encodeProvider * * @param array<int, Constraint> $constraints */
    public function testEncode(string $for, int $minPasswordValue, array $constraints, bool $shouldThrowViolationException, ?string $inputPassword): void
    {
        $constraintViolations = new ConstraintViolationList();
        if ($shouldThrowViolationException) {
            


        $request = EnlightRequest::createFromGlobals();
        $request->setBaseUrl($context->getBaseUrl());
        $request->setPathInfo($pathInfo);

        $event = $this->eventManager->notifyUntil('Enlight_Controller_Router_Route', [
            'request' => $request,
            'context' => $context,
        ]);

        return $event !== null ? $event->getReturn() : false;
    }
}
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
    {
        $eventManager = $this->kernel->getContainer()->get('events');

        $event = $eventManager->notifyUntil('Shopware_Command_Before_Run', [
            'command' => $command,
            'input' => $input,
            'output' => $output,
        ]);

        if ($event) {
            return (int) $event->getReturn();
        }

        $exitCode = parent::doRunCommand($command$input$output);

        $eventManager->notify('Shopware_Command_After_Run', [
           'exitCode' => $exitCode,
           'command' => $command,
           'input' => $input,
           'output' => $output,
       ]);

        
'subject' => $this,
                'job' => $job,
            ]);
            $jobArgs->setReturn($job->getData());

            $jobArgs = $this->eventManager->notifyUntil(
                $job->getAction(),
                $jobArgs
            );

            if ($jobArgs !== null) {
                $job->setData($jobArgs->getReturn());
                $this->adapter->updateJob($job);
            }

            $this->endJob($job);
            $this->eventManager->notify('Shopware_CronJob_Finished_' . $job->getAction()[
                'subject' => $this,
                'job' => $job,
            ]);

            $this->eventManager->notify('Shopware_CronJob_Finished', [
                'subject' => $this,
                

        if ($event = $this->eventManager->notifyUntil(
            'Shopware_Modules_Admin_Execute_Risk_Rule_' . $rule,
            [
                'rule' => $rule,
                'user' => $user,
                'basket' => $basket,
                'value' => $value,
                'paymentID' => $paymentID,
            ]
        )) {
            return $event->getReturn();
        }

        return $this->$rule($user$basket$value);
    }

    /** * Risk management - Order value greater then * * @param array $user User data * @param array $order Order data * @param mixed $value Value to compare against * * @return bool Rule validation result */
$interval = $this->intervalFieldSerializer->encode(
            new CronIntervalField('name', 'name'),
            $this->createStub(EntityExistence::class),
            $data,
            $this->createMock(WriteParameterBag::class)
        );

        static::assertNull($interval->current());

        $interval->next();

        static::assertNull($interval->getReturn());
    }

    public function testEncodeMethodWithIncorrectDataWillThrowException(): void
    {
        $data = new KeyValuePair('key', new CronIntervalField('name', 'name'), false);

        $this->validator
            ->expects(static::exactly(2))
            ->method('validate')
            ->with($data->getValue()static::callback(static function D$constraint): bool {
                return $constraint instanceof NotNull || ($constraint instanceof Type && $constraint->type === CronExpression::class);
            }))


class Shopware_Components_Cron_CronJob extends Enlight_Components_Cron_EventArgs
{
    /** * Returns the job data */
    public function getData()
    {
        return $this->getReturn();
    }

    /** * Sets a value of an element in the list. * * @param string $key * @param mixed|null $value * * @return Shopware_Components_Cron_CronJob */
    public function set($key$value)
    {
Home | Imprint | This part of the site doesn't use cookies.