Валидация workflow

@throws InvalidWorkflowDescriptorException
@throws InternalWorkflowException
@throws InvalidDescriptorException
@throws InvalidWriteWorkflowException
@throws  \OldTown\Workflow\Exception\InvalidDtdSchemaException
@return void
552606
public function validate()
    {
        $registers = $this->getRegisters();
        $triggerFunctions = $this->getTriggerFunctions();
        $globalActions = $this->getGlobalActions();
        $initialActions = $this->getInitialActions();
        $commonActions = $this->getCommonActions();
        $steps = $this->getSteps();
        $splits = $this->getSplits();
        $joins = $this->getJoins();


        ValidationHelper::validate($registers);
        ValidationHelper::validate($triggerFunctions);
        ValidationHelper::validate($globalActions);
        ValidationHelper::validate($initialActions);
        ValidationHelper::validate($commonActions);
        ValidationHelper::validate($steps);
        ValidationHelper::validate($splits);
        ValidationHelper::validate($joins);


        $actions = [];

        foreach ($globalActions as $action) {
            $actionId = $action->getId();
            if (array_key_exists($actionId, $actions)) {
                $errMsg = sprintf(
                    'Ошибка валидация. Действие с id %s уже существует',
                    $actionId
                );
                throw new InvalidWorkflowDescriptorException($errMsg);
            }
            $actions[$actionId] = $actionId;
        }

        foreach ($steps as $step) {
            $j = $step->getActions();

            foreach ($j as $action) {
                if (!$action->isCommon()) {
                    $actionId = $action->getId();
                    if (array_key_exists($actionId, $actions)) {
                        $errMsg = sprintf(
                            'Действие с id %s найденное у шага %s является дубликатом',
                            $actionId,
                            $step->getId()
                        );
                        throw new InvalidWorkflowDescriptorException($errMsg);
                    }
                    $actions[$actionId] = $actionId;
                }
            }
        }


        foreach ($commonActions as $action) {
            $actionId = $action->getId();
            if (array_key_exists($actionId, $actions)) {
                $errMsg = sprintf(
                    'common-action  с id %s является дубликатом',
                    $actionId
                );
                throw new InvalidWorkflowDescriptorException($errMsg);
            }
        }


        $this->validateDtd();
    }
1175093
public function completeFlow()
    {
        // Get the required params
        $clientId = $this->server->getRequest()->request->get('client_id', $this->server->getRequest()->getUser());
        if (is_null($clientId)) {
            throw new Exception\InvalidRequestException('client_id');
        }

        $clientSecret = $this->server->getRequest()->request->get('client_secret',
            $this->server->getRequest()->getPassword());
        if (is_null($clientSecret)) {
            throw new Exception\InvalidRequestException('client_secret');
        }

        // Validate client ID and client secret
        $client = $this->server->getClientStorage()->get(
            $clientId,
            $clientSecret,
            null,
            $this->getIdentifier()
        );

        if (($client instanceof ClientEntity) === false) {
            $this->server->getEventEmitter()->emit(new Event\ClientAuthenticationFailedEvent($this->server->getRequest()));
            throw new Exception\InvalidClientException();
        }

        // Validate any scopes that are in the request
        $scopeParam = $this->server->getRequest()->request->get('scope', '');
        $scopes = $this->validateScopes($scopeParam, $client);

        // Create a new session
        $session = new SessionEntity($this->server);
        $session->setOwner('client', $client->getId());
        $session->associateClient($client);

        // Generate an access token
        $accessToken = new AccessTokenEntity($this->server);
        $accessToken->setId(SecureKey::generate());
        $accessToken->setExpireTime($this->getAccessTokenTTL() + time());

        // Associate scopes with the session and access token
        foreach ($scopes as $scope) {
            $session->associateScope($scope);
        }

        foreach ($session->getScopes() as $scope) {
            $accessToken->associateScope($scope);
        }

        // Save everything
        $session->save();
        $accessToken->setSession($session);
        $accessToken->save();

        $this->server->getTokenType()->setSession($session);
        $this->server->getTokenType()->setParam('access_token', $accessToken->getId());
        $this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());

        return $this->server->getTokenType()->generateResponse();
    }
792442
public function edit()
    {
        if (!userHasPermission('admin:invoice:customer:edit')) {
            unauthorised();
        }

        $oCustomerModel = Factory::model('Customer', 'nails/module-invoice');
        $oUri           = Factory::service('Uri');

        $itemId             = (int) $oUri->segment(5);
        $this->data['item'] = $oCustomerModel->getById(
            $itemId,
            ['expand' => $oCustomerModel::EXPAND_ALL]
        );

        if (empty($this->data['item'])) {
            show404();
        }

        // --------------------------------------------------------------------------

        $oInput = Factory::service('Input');
        if ($oInput->post()) {

            try {

                $this->formValidation();

                if (!$oCustomerModel->update($itemId, $this->prepPostData())) {
                    throw new NailsException('Failed to update item. ' . $oCustomerModel->lastError(), 1);
                }

                $oSession = Factory::service('Session', 'nails/module-auth');
                $oSession->setFlashData('success', 'Item updated successfully.');
                redirect('admin/invoice/customer');

            } catch (\Exception $e) {
                $this->data['error'] = $e->getMessage();
            }
        }

        // --------------------------------------------------------------------------

        $this->data['page']->title = 'Edit customer';
        Helper::loadView('edit');
    }
499281
public function registerTasks(Workflow $workflow, Deployment $deployment)
    {
        parent::registerTasks($workflow, $deployment);

        $this->checkIfMandatoryOptionsExist();
        $this->buildConfiguration();
        $this->defineTasks($workflow, $deployment);

        if ($this->getOption('enableTests') !== false) {
            $workflow
                ->addTask([
                    UnitTestTask::class,
                    FunctionalTestTask::class
                ], 'test', $this);
        }

        $workflow->addTask([
                'TYPO3\\Surf\\DefinedTask\\CreateZipDistributionTask',
                'TYPO3\\Surf\\DefinedTask\\CreateTarGzDistributionTask',
                'TYPO3\\Surf\\DefinedTask\\CreateTarBz2DistributionTask',
            ], 'cleanup', $this);

        if ($this->hasOption('enableSourceforgeUpload') && $this->getOption('enableSourceforgeUpload') === true) {
            $workflow->addTask(SourceforgeUploadTask::class, 'cleanup', $this);
        }
        if ($this->hasOption('releaseHost')) {
            $workflow->addTask(PrepareReleaseTask::class, 'initialize', $this);
            $workflow->addTask(ReleaseTask::class, 'cleanup', $this);
        }
        if ($this->hasOption('releaseHost') && $this->hasOption('enableSourceforgeUpload') && $this->getOption('enableSourceforgeUpload') === true) {
            $workflow->addTask(AddDownloadTask::class, 'cleanup', $this);
        }
        if ($this->hasOption('createTags') && $this->getOption('createTags') === true) {
            $workflow->addTask(TagTask::class, 'cleanup', $this);
            if ($this->hasOption('TYPO3\\Surf\\DefinedTask\\Git\\PushTagsTask') && $this->getOption('TYPO3\\Surf\\DefinedTask\\Git\\PushTagsTask') === true) {
                $workflow->afterTask(TagTask::class, 'TYPO3\\Surf\\DefinedTask\\Git\\PushTagsTask', $this);
            }
        }

        $workflow->removeTask(MigrateTask::class);
    }
289063
public function init()
    {

        if ( empty( $this->action_save ) ){
            throw new HttpException(200, 'Ошибка контроллера. Не передано имя метода для сохранения файла (action).');
        }
        if ( empty( $this->action_read ) ){
            throw new HttpException(200, 'Ошибка виджета. Не передано имя метода для чтения данных (action).');
        }
        if ( empty( $this->action_write ) ){
            throw new HttpException(200, 'Ошибка виджета. Не передано имя метода записи данных (action).');
        }

        parent::init();
    }
48575
public function make_draft()
    {
        if (!userHasPermission('admin:invoice:invoice:edit')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        $oUri     = Factory::service('Uri');
        $oInvoice = $this->oInvoiceModel->getById($oUri->segment(5));
        if (!$oInvoice) {
            show404();
        }

        // --------------------------------------------------------------------------

        //  Allow getting a constant
        $oInvoiceModel = $this->oInvoiceModel;

        $aData = [
            'state' => $oInvoiceModel::STATE_DRAFT,
        ];
        if ($this->oInvoiceModel->update($oInvoice->id, $aData)) {
            $sStatus  = 'success';
            $sMessage = 'Invoice updated successfully!';
        } else {
            $sStatus  = 'error';
            $sMessage = 'Invoice failed to update invoice. ' . $this->oInvoiceModel->lastError();
        }

        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->setFlashData($sStatus, $sMessage);

        redirect('admin/invoice/invoice/edit/' . $oInvoice->id);
    }
443169
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$input->getOption('delete') && !$input->getOption('info')) {
            throw new \InvalidArgumentException('You must specify whether you want to --delete or --info the specified workflow.');
        }

        $workflowService = $this->getWorkflowService();
        $workflowNameOrPath = $input->getArgument('workflow');

        if ($input->getOption('info')) {
            $output->writeln('');

            $workflow = $workflowService->getWorkflow($workflowNameOrPath);
            if ($workflow == null) {
                throw new \InvalidArgumentException(sprintf('The workflow "%s" does not exist in the database table.', $workflowNameOrPath));
            }

            switch ($workflow->status) {
                case Migration::STATUS_DONE:
                    $status = '<info>executed</info>';
                    break;
                case Migration::STATUS_STARTED:
                    $status = '<comment>execution started</comment>';
                    break;
                case Migration::STATUS_TODO:
                    // bold to-migrate!
                    $status = '<error>not executed</error>';
                    break;
                case Migration::STATUS_SKIPPED:
                    $status = '<comment>skipped</comment>';
                    break;
                case Migration::STATUS_PARTIALLY_DONE:
                    $status = '<comment>partially executed</comment>';
                    break;
                case Migration::STATUS_SUSPENDED:
                    $status = '<comment>suspended</comment>';
                    break;
                case Migration::STATUS_FAILED:
                    $status = '<error>failed</error>';
                    break;
            }

            $output->writeln('<info>Workflow: ' . $workflow->name . '</info>');
            $output->writeln('Status: ' . $status);
            $output->writeln('Executed on: <info>' . ($workflow->executionDate != null ? date("Y-m-d H:i:s", $workflow->executionDate) : '--'). '</info>');
            $output->writeln('Execution notes: <info>' . $workflow->executionError . '</info>');
            $output->writeln('Signal: <info>' . $workflow->signalName . '</info>');

            if ($workflow->status == Migration::STATUS_SUSPENDED) {
                /// @todo decode the suspension context: date, step, ...
            }

            $output->writeln('Definition path: <info>' . $workflow->path . '</info>');
            $output->writeln('Definition md5: <info>' . $workflow->md5 . '</info>');

            if ($workflow->path != '') {
                // q: what if we have a loader which does not work with is_file? We could probably remove this check...
                if (is_file($workflow->path)) {
                    try {
                        $workflowDefinitionCollection = $workflowService->getWorkflowsDefinitions(array($workflow->path));
                        if (count($workflowDefinitionCollection)) {
                            $workflowDefinition = reset($workflowDefinitionCollection);
                            $workflowDefinition = $workflowService->parseWorkflowDefinition($workflowDefinition);

                            if ($workflowDefinition->status != MigrationDefinition::STATUS_PARSED) {
                                $output->writeln('Definition error: <error>' . $workflowDefinition->parsingError . '</error>');
                            }

                            if (md5($workflowDefinition->rawDefinition) != $workflow->md5) {
                                $output->writeln('Notes: <comment>The workflow definition file has now a different checksum</comment>');
                            }

                            $output->writeln('Switch User: <info>' . (($workflowDefinition->runAs === false) ? '-' : $workflowDefinition->runAs) . '</info>');
                            $output->writeln('Use transaction: <info>' . ($workflowDefinition->useTransaction ? 'Y' : 'N') . '</info>');

                        } else {
                            $output->writeln('Definition error: <error>The workflow definition file can not be loaded</error>');
                        }
                    } catch (\Exception $e) {
                        /// @todo one day we should be able to limit the kind of exceptions we have to catch here...
                        $output->writeln('Definition parsing error: <error>' . $e->getMessage() . '</error>');
                    }
                } else {
                    $output->writeln('Definition error: <error>The workflow definition file can not be found any more</error>');
                }
            }

            $output->writeln('');
            return;
        }

        // ask user for confirmation to make changes
        if ($input->isInteractive() && !$input->getOption('no-interaction')) {
            $dialog = $this->getHelperSet()->get('dialog');
            if (!$dialog->askConfirmation(
                $output,
                '<question>Careful, the database will be modified. Do you want to continue Y/N ?</question>',
                false
            )
            ) {
                $output->writeln('<error>Workflow change cancelled!</error>');
                return 0;
            }
        }

        if ($input->getOption('delete')) {
            $workflow = $workflowService->getWorkflow($workflowNameOrPath);
            if ($workflow == null) {
                throw new \InvalidArgumentException(sprintf('The workflow "%s" does not exist in the database table.', $workflowNameOrPath));
            }

            $workflowService->deleteWorkflow($workflow);

            return;
        }
    }
1303393
public function writeXml(DOMDocument $dom = null)
    {
        if (null === $dom) {
            $errMsg = 'Не передан DOMDocument';
            throw new InvalidWriteWorkflowException($errMsg);
        }
        $descriptor = $dom->createElement('register');


        if ($this->hasId()) {
            $id = $this->getId();
            $descriptor->setAttribute('id', $id);
        }

        $variableName = $this->getVariableName();
        if (null === $variableName) {
            $errMsg = 'Некорректное значение для атрибута variable-name';
            throw new InvalidDescriptorException($errMsg);
        }
        $descriptor->setAttribute('variable-name', $variableName);

        $type = $this->getType();
        if (null === $type) {
            $errMsg = 'Некорректное значение для атрибута type';
            throw new InvalidDescriptorException($errMsg);
        }

        $descriptor->setAttribute('type', $type);

        $this->writeArgs($descriptor);

        return $descriptor;
    }
90091
public function run()
    {
        if (!empty($this->_fields)) {
            throw new InvalidCallException('Each beginField() should have a matching endField() call.');
        }

        if ($this->enableClientScript) {
            $id = $this->options['id'];
            $options = Json::htmlEncode($this->getClientOptions());
            $attributes = Json::htmlEncode($this->attributes);
            $view = $this->getView();
            ActiveFormAsset::register($view);
            $view->registerJs("jQuery('#$id').yiiActiveForm($attributes, $options);");
        }

        echo Html::endForm();
    }
793442
protected function printPreFunctions(DOMDocument $dom)
    {
        $preFunctions = $this->getPreFunctions();
        if ($preFunctions->count() > 0) {
            $preFunctionsElements = $dom->createElement('pre-functions');
            foreach ($preFunctions as $function) {
                try {
                    $functionElement = $function->writeXml($dom);
                } catch (\Exception $e) {
                    $errMsg  = 'Ошибка сохранения workflow. Ошибка в pre-function';
                    throw new InvalidWriteWorkflowException($errMsg, $e->getCode(), $e);
                }
                $preFunctionsElements->appendChild($functionElement);
            }

            return $preFunctionsElements;
        }

        return null;
    }
5829
def create
      @workflow = Workflow.new(workflow_params)


      respond_to do |format|
        if @workflow.save
          format.html {
            if(@workflow.stages.count > 1)
              redirect_to configure_stages_workflow_path(@workflow), notice: 'Workflow was successfully created. Please configure transitions.'
            else
              redirect_to @workflow, notice: 'Workflow was successfully created.'
            end

          }
          format.json { render json: @workflow, status: :created, location: @workflow }
        else
          format.html { render action: "new" }
          format.json { render json: @workflow.errors, status: :unprocessable_entity }
        end
      end
    end
1122418
public function build()
    {
        $workflow = new Workflow($this->workflowId, $this->workflowName);

        foreach ($this->roles as $id => $role) {
            list($name) = $role;
            $workflow->addRole(new Role($id, $name));
        }

        foreach ($this->startEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new StartEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->endEvents as $id => $event) {
            list($roleId, $name) = $event;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new EndEvent($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->tasks as $id => $task) {
            list($roleId, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new Task($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->serviceTasks as $id => $task) {
            list($roleId, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ServiceTask($id, $workflow->getRole($roleId), $operation, $name));
        }

        foreach ($this->sendTasks as $id => $task) {
            list($roleId, $message, $operation, $name) = $task;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new SendTask($id, $workflow->getRole($roleId), $message, $operation, $name));
        }

        foreach ($this->exclusiveGateways as $id => $gateway) {
            list($roleId, $name) = $gateway;
            $this->assertWorkflowHasRole($workflow, $roleId);

            $workflow->addFlowObject(new ExclusiveGateway($id, $workflow->getRole($roleId), $name));
        }

        foreach ($this->sequenceFlows as $id => $flow) {
            list($source, $destination, $name, $condition) = $flow;

            if (array_key_exists($id, $this->defaultableFlowObjects) && $condition !== null) {
                throw new \LogicException(sprintf('The sequence flow "%s" has the condition "%s". A condition cannot be set to the default sequence flow.', $id, $condition));
            }

            $flowObject = $workflow->getFlowObject($source); /* @var $flowObject TransitionalInterface */
            $workflow->addConnectingObject(new SequenceFlow($id, $flowObject, $workflow->getFlowObject($destination), $name, $condition === null ? null : new Expression($condition)));

            if (array_key_exists($id, $this->defaultableFlowObjects)) {
                $flowObject = $workflow->getFlowObject($this->defaultableFlowObjects[$id]);
                /* @var $flowObject ConditionalInterface */$flowObject->setDefaultSequenceFlowId($id);
            }
        }

        return $workflow;
    }
429139
public function doProcess()
	{

		// card errors
		$rc = $this->doProcessCards();
		if ($rc !== '00') {
			$this->payment->rc = $rc;
			$this->payment->rrn = '';
			$this->payment->irn = '';
			$this->payment->status = Status::ERROR;
			$this->payment->save();

			return;
		}

		// process type errors
		$rc = $this->doProcessType();
		if ($rc !== '00') {
			$this->payment->rc = $rc;
			$this->payment->status = Status::ERROR;
			$this->payment->save();

			return;
		}

		// auth
		$this->doDetectAuth();

		// approved
		if($this->payment->status != Status::AUTHORIZATION){
			$this->payment->status = Status::SUCCESS;
		}
		$this->payment->rc = '00';
		$this->payment->approval = mt_rand(100000, 999999);
		$this->payment->save();

	}
717523
public function Form()
    {
        $svc            = singleton(WorkflowService::class);
        $active         = $svc->getWorkflowFor($this->getContextObject());

        if (!$active) {
            return;
            //throw new Exception('Workflow not found, or not specified for Context Object');
        }

        $wfFields     = $active->getFrontEndWorkflowFields();
        $wfActions    = $active->getFrontEndWorkflowActions();
        $wfValidator  = $active->getFrontEndRequiredFields();

        //Get DataObject for Form (falls back to ContextObject if not defined in WorkflowAction)
        $wfDataObject = $active->getFrontEndDataObject();

        // set any requirements spcific to this contextobject
        $active->setFrontendFormRequirements();

        // hooks for decorators
        $this->extend('updateFrontEndWorkflowFields', $wfFields);
        $this->extend('updateFrontEndWorkflowActions', $wfActions);
        $this->extend('updateFrontEndRequiredFields', $wfValidator);
        $this->extend('updateFrontendFormRequirements');

        $form = new FrontendWorkflowForm($this, 'Form/' . $this->getContextID(), $wfFields, $wfActions, $wfValidator);

        $form->addExtraClass("fwf");

        if ($wfDataObject) {
            $form->loadDataFrom($wfDataObject);
        }

        return $form;
    }
11967
public function writeXml(DOMDocument $dom = null)
    {
        if (null === $dom) {
            $errMsg = 'Не передан DOMDocument';
            throw new InvalidWriteWorkflowException($errMsg);
        }
        $descriptor = $dom->createElement('step');

        if (!$this->hasId()) {
            $errMsg = 'Отсутствует атрибут id';
            throw new InvalidDescriptorException($errMsg);
        }
        $id = $this->getId();
        $descriptor->setAttribute('id', $id);

        $name = (string)$this->getName();
        $name = trim($name);
        if (strlen($name) > 0) {
            $nameEncode = XmlUtil::encode($name);
            $descriptor->setAttribute('name', $nameEncode);
        }


        $metaAttributes = $this->getMetaAttributes();
        $baseMeta = $dom->createElement('meta');
        foreach ($metaAttributes as $metaAttributeName => $metaAttributeValue) {
            $metaAttributeNameEncode = XmlUtil::encode($metaAttributeName);
            $metaAttributeValueEnEncode = XmlUtil::encode($metaAttributeValue);

            $metaElement = clone $baseMeta;
            $metaElement->setAttribute('name', $metaAttributeNameEncode);
            $metaValueElement = $dom->createTextNode($metaAttributeValueEnEncode);
            $metaElement->appendChild($metaValueElement);

            $descriptor->appendChild($metaElement);
        }


        $preFunctions = $this->getPreFunctions();
        if ($preFunctions->count() > 0) {
            $preFunctionsElement = $dom->createElement('pre-functions');
            foreach ($preFunctions as $function) {
                $functionElement = $function->writeXml($dom);
                $preFunctionsElement->appendChild($functionElement);
            }

            $descriptor->appendChild($preFunctionsElement);
        }


        $permissions = $this->getPermissions();
        if ($permissions->count() > 0) {
            $permissionsElement = $dom->createElement('external-permissions');
            foreach ($permissions as $permission) {
                $permissionElement = $permission->writeXml($dom);
                $permissionsElement->appendChild($permissionElement);
            }

            $descriptor->appendChild($permissionsElement);
        }

        $actions = $this->getActions();
        $commonActions = $this->getCommonActions();

        if ($actions->count() > 0 || count($commonActions) > 0) {
            $actionsElement = $dom->createElement('actions');

            $commonActionElementBase = $dom->createElement('common-action');
            foreach ($commonActions as $commonActionId) {
                $commonActionElement = clone $commonActionElementBase;
                $commonActionElement->setAttribute('id', $commonActionId);

                $actionsElement->appendChild($commonActionElement);
            }

            foreach ($actions as $action) {
                if (!$action->isCommon()) {
                    $actionElement = $action->writeXml($dom);
                    $actionsElement->appendChild($actionElement);
                }
            }

            $descriptor->appendChild($actionsElement);
        }

        $postFunctions = $this->getPostFunctions();
        if ($postFunctions->count() > 0) {
            $postFunctionsElement = $dom->createElement('post-functions');
            foreach ($postFunctions as $function) {
                $functionElement = $function->writeXml($dom);
                $postFunctionsElement->appendChild($functionElement);
            }

            $descriptor->appendChild($postFunctionsElement);
        }


        return $descriptor;
    }
905149
public function validate()
    {
        $preFunctions = $this->getPreFunctions();
        $postFunctions = $this->getPostFunctions();
        $validators = $this->getValidators();

        ValidationHelper::validate($preFunctions);
        ValidationHelper::validate($postFunctions);
        ValidationHelper::validate($validators);

        $split = $this->getSplit();
        $join = $this->getJoin();

        $parent = $this->getParent();
        if ((null === $split) && (null === $join) && !($parent instanceof ActionDescriptor && ($parent->isFinish()))) {
            $errMsg = '';
            $id = (integer)$this->getId();
            if (is_numeric($id)) {
                $errMsg .= sprintf('#%s:', $id);
            }
            $errMsg .= 'Если не указано значение атрибутов split или join, необходимо указать';

            if (!$this->hasStep) {
                $errMsg .= ' id следующего шага';
                throw new InvalidWorkflowDescriptorException($errMsg);
            }

            $status = $this->getStatus();
            if (!$status) {
                $errMsg .= ' статус';
                throw new InvalidWorkflowDescriptorException($errMsg);
            }
        }
    }
623239
public function isValid($value)
    {
        if (!$value instanceof WorkflowDispatchEventInterface) {
            $this->error(self::VALIDATE_VALUE_INVALID);
            return false;
        }

        if (null === $this->getAllowedHttpMethods()) {
            return true;
        }

        $request = $value->getMvcEvent()->getRequest();
        if (!$request instanceof Request) {
            $this->error(self::REQUEST_INVALID);
            return false;
        }

        /** @var Request  $request*/
        $method = $request->getMethod();
        $method = strtolower($method);

        $allowedHttpMethods = $this->getAllowedHttpMethods();
        if (!array_key_exists($method, $allowedHttpMethods)) {
            $this->error(self::HTTP_METHOD_INVALID);
            return false;
        }



        return true;
    }