@param Event                   $stripeEvent
@param StripeLocalWebhookEvent $localEventEntity

@return array
426445
public function guess(Event $stripeEvent, StripeLocalWebhookEvent $localEventEntity)
    {
        $pieces = $this->guessEventPieces($stripeEvent->type);

        switch ($pieces['kind']) {
            case 'account':
                $disptachingEvent = new StripeWebhookAccountEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookAccountEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'application_fee':
                $disptachingEvent = new StripeWebhookApplicationFeeEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookApplicationFeeEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'balance':
                $disptachingEvent = new StripeWebhookBalanceEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookBalanceEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'bitcoin':
                $disptachingEvent = new StripeWebhookBitcoinEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookBitcoinEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'charge':
                $disptachingEvent = new StripeWebhookChargeEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookChargeEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'coupon':
                $disptachingEvent = new StripeWebhookCouponEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookCouponEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'customer':
                $disptachingEvent = new StripeWebhookCustomerEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookCustomerEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'invoice':
                $disptachingEvent = new StripeWebhookInvoiceEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookInvoiceEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'invpiceitem':
                $disptachingEvent = new StripeWebhookInvoiceItemEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookInvoiceItemEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'order':
                $disptachingEvent = new StripeWebhookOrderEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookOrderEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'order_return':
                $disptachingEvent = new StripeWebhookOrderReturnEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookOrderReturnEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'plan':
                $disptachingEvent = new StripeWebhookPlanEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookPlanEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'product':
                $disptachingEvent = new StripeWebhookProductEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookProductEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'recipient':
                $disptachingEvent = new StripeWebhookRecipientEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookRecipientEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'review':
                $disptachingEvent = new StripeWebhookReviewEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookReviewEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'sku':
                $disptachingEvent = new StripeWebhookSkuEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookSkuEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'source':
                $disptachingEvent = new StripeWebhookSourceEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookSourceEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'transfer':
                $disptachingEvent = new StripeWebhookTransferEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookTransferEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            case 'ping':
                $disptachingEvent = new StripeWebhookPingEventEvent($localEventEntity);

                return [
                    'type'   => constant(StripeWebhookPingEventEvent::class . '::' . $pieces['type']),
                    'object' => $disptachingEvent,
                ];
                break;

            default:
                if ($this->debug) {
                    throw new \RuntimeException('Event type not recognized. Maybe it is a new one or is not yet supported by the bundle. Report this issue to the GitHub Issue tracker.');
                }

                return ['type' => null, 'object' => null];
        }
    }
1105602
protected function getTargetDocumentDestination(
        $uuid,
        $localeSource,
        $localeDestination
    ) {
        /** @var BasePageDocument $targetDocumentSource */
        $targetDocumentSource = $this->documentManager->find($uuid, $localeSource);

        if ($this->webspaceKeySource !== $targetDocumentSource->getWebspaceName()) {
            return null;
        }

        $newPathTarget = str_replace(
            $this->sessionManager->getContentPath($this->webspaceKeySource),
            $this->sessionManager->getContentPath($this->webspaceKeyDestination),
            $targetDocumentSource->getPath()
        );

        $targetDocument = null;

        try {
            $targetDocument = $this->documentManager->find($newPathTarget, $localeDestination);
        } catch (DocumentNotFoundException $e) {
            return null;
        }

        return $targetDocument;
    }
597850
public function listeners($event): array
    {
        $name = \get_class($event);

        $localListeners  = $this->events[$name] ?? [];
        $globalListeners = static::$globalEvents[$name] ?? [];

        return array_merge($globalListeners, $localListeners);
    }
24444
@Beta
    public EventGridEvent[] deserializeEventGridEvents(final String requestContent, final SerializerAdapter<ObjectMapper> serializerAdapter) throws IOException {
        EventGridEvent[] eventGridEvents = serializerAdapter.<EventGridEvent[]>deserialize(requestContent, EventGridEvent[].class);
        for (EventGridEvent receivedEvent : eventGridEvents) {
            if (receivedEvent.data() == null) {
                continue;
            } else {
                final String eventType = receivedEvent.eventType();
                final Type eventDataType;
                if (SystemEventTypeMappings.containsMappingFor(eventType)) {
                    eventDataType = SystemEventTypeMappings.getMapping(eventType);
                } else if (containsCustomEventMappingFor(eventType)) {
                    eventDataType = getCustomEventMapping(eventType);
                } else {
                    eventDataType = null;
                }
                if (eventDataType != null) {
                    final String eventDataAsString = serializerAdapter.serializeRaw(receivedEvent.data());
                    final Object eventData = serializerAdapter.<Object>deserialize(eventDataAsString, eventDataType);
                    setEventData(receivedEvent, eventData);
                }
            }
        }
        return eventGridEvents;
    }
297404
private void publishLocalEvent(String cacheId, Object eventData, Extractors extractors) {
        Collection<EventRegistration> eventRegistrations = getRegistrations(cacheId);
        if (eventRegistrations.isEmpty()) {
            return;
        }

        for (EventRegistration eventRegistration : eventRegistrations) {
            Registration registration = (Registration) eventRegistration;
            Object listener = registration.getListener();
            if (!(listener instanceof QueryCacheListenerAdapter)) {
                continue;
            }
            Object eventDataToPublish = eventData;
            int orderKey = -1;
            if (eventDataToPublish instanceof LocalCacheWideEventData) {
                orderKey = cacheId.hashCode();
            } else if (eventDataToPublish instanceof LocalEntryEventData) {
                LocalEntryEventData localEntryEventData = (LocalEntryEventData) eventDataToPublish;
                if (localEntryEventData.getEventType() != EventLostEvent.EVENT_TYPE) {
                    EventFilter filter = registration.getFilter();
                    if (!canPassFilter(localEntryEventData, filter, extractors)) {
                        continue;
                    } else {
                        boolean includeValue = isIncludeValue(filter);
                        eventDataToPublish = includeValue
                                ? localEntryEventData : localEntryEventData.cloneWithoutValue();
                        Data keyData = localEntryEventData.getKeyData();
                        orderKey = keyData == null ? -1 : keyData.hashCode();
                    }
                }
            }

            publishEventInternal(registration, eventDataToPublish, orderKey);
        }
    }
1335138
protected function extractBasicFields(EventInterface $event, $serialize = true)
    {
        $fields = [
            'transaction' => $event->getTransactionId(),
            'type' => $event->getEventType(),
            'source' => $event->getSourceName(),
            'parent_source' => null,
            'original' => null,
            'changed' => null,
            'created' => new \DateTime($event->getTimestamp())
        ];

        if (method_exists($event, 'getParentSourceName')) {
            $fields['parent_source'] = $event->getParentSourceName();
        }

        if ($event instanceof BaseEvent) {
            $fields['original'] = $serialize ? $this->serialize($event->getOriginal()) : $event->getOriginal();
            $fields['changed'] = $serialize ? $this->serialize($event->getChanged()) : $event->getChanged();
        }

        return $fields;
    }
89871
public static function getStaticReforgedRunes( string $locale = 'en_US', string $version = null ) : array
	{
		$url = self::getStaticDataFileUrl(self::STATIC_RUNESREFORGED, null, $locale, $version);
		return self::loadStaticData($url);
	}
144837
private function initEventDispatcher(
        OutputInterface $output,
        string $formatterName,
        bool $verbose
    ): EventDispatcherInterface {
        if ('dot' === $formatterName) {
            $formatter = new DotFormatter($output);
        } elseif ('pretty' === $formatterName) {
            $formatter = new PrettyFormatter($output, $verbose);
        } elseif ('simple' === $formatterName) {
            $formatter = new SimpleFormatter();
        } else {
            throw new \RuntimeException(
                sprintf('Format "%s" is unknown. Available formats: %s.', $formatterName, implode(', ', $this->formats))
            );
        }

        $eventDispatcher = new EventDispatcher();
        $eventDispatcher->addSubscriber($formatter);

        return $eventDispatcher;
    }
440621
private function getEntryFields(Source $source, BaseAcumulusEntry $localEntryInfo, array $entry)
    {
        /* keys in $entry array:
         *   - entryid
         *   * entrydate: yy-mm-dd
         *   - entrytype
         *   - entrydescription
         *   - entrynote
         *   - fiscaltype
         *   * vatreversecharge: 0 or 1
         *   * foreigneu: 0 or 1
         *   * foreignnoneu: 0 or 1
         *   * marginscheme: 0 or 1
         *   * foreignvat: 0 or 1
         *   - contactid
         *   - accountnumber
         *   - costcenterid
         *   - costtypeid
         *   * invoicenumber
         *   - invoicenote
         *   - descriptiontext
         *   - invoicelayoutid
         *   - totalvalueexclvat
         *   - totalvalue
         *   - paymenttermdays
         *   * paymentdate: yy-mm-dd
         *   * paymentstatus: 1 or 2
         *   * deleted: timestamp
         */
        $fields = $this->getVatTypeField($entry)
            + $this->getAmountFields($source, $entry)
            + $this->getPaymentStatusFields($source, $entry)
            + $this->getLinksField($localEntryInfo->getToken());

        return $fields;
    }
377826
public static function getStaticChampionDetails( string $champion_id, string $locale = 'en_US', string $version = null ) : array
	{
		$url = self::getStaticDataFileUrl(self::STATIC_CHAMPION, $champion_id, $locale, $version);
		return self::loadStaticData($url);
	}
1084826
public function getEventTypes()
    {
        $this->endpoint = 'eventtypes';
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
        $response = $this->get($this->url);
        return new AuthnetWebhooksResponse($response);
    }
688561
private function getPageNotFoundException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();

        if ($exception instanceof PageNotFoundException) {
            return $exception;
        }
        if ($exception->getPrevious() instanceof PageNotFoundException) {
            return $exception->getPrevious();
        }

        return null;
    }
788965
private function getFields1Source(Source $source, $localEntryInfo)
    {
        $this->resetStatus();
        // Get invoice status field and other invoice status related info.
        $statusInfo = $this->getInvoiceStatusInfo($localEntryInfo);

        $this->setStatus($statusInfo['severity'], $statusInfo['severity-message']);
        /** @var string $invoiceStatus */
        $invoiceStatus = $statusInfo['status'];
        /** @var string $statusText */
        $statusText = $statusInfo['text'];
        /** @var string $statusDescription */
        $statusDescription = $statusInfo['description'];
        /** @var Result|null $result */
        $result = $statusInfo['result'];
        /** @var array $entry */
        $entry = $statusInfo['entry'];

        // Create and add additional fields based on invoice status.
        switch ($invoiceStatus) {
            case static::Invoice_NotSent:
                $additionalFields = $this->getNotSentFields($source);
                break;
            case static::Invoice_SentConcept:
                $additionalFields = $this->getConceptFields($source);
                break;
            case static::Invoice_CommunicationError:
                /** @noinspection PhpUndefinedVariableInspection */
                $additionalFields = $this->getCommunicationErrorFields($result);
                break;
            case static::Invoice_NonExisting:
                $additionalFields = $this->getNonExistingFields($source);
                break;
            case static::Invoice_Deleted:
                $additionalFields = $this->getDeletedFields($source);
                break;
            case static::Invoice_Sent:
                $additionalFields = $this->getEntryFields($source, $localEntryInfo, $entry);
                break;
            default:
                $additionalFields = array(
                    'unknown' => array(
                        'type' => 'markup',
                        'value' => sprintf($this->t('invoice_status_unknown'), $invoiceStatus),
                    )
                );
                break;
        }

        // Create main status field after we have the other fields, so we can
        // use the results in rendering the overall status.
        $fields = array(
            'status' => array(
                'type' => 'markup',
                'label' => $this->getStatusIcon($this->status),
                'attributes' => array(
                    'class' => str_replace('_', '-', $invoiceStatus),
                    'label' => $this->getStatusLabelAttributes($this->status, $this->statusMessage),
                ),
                'value' => $statusText,
                'description' => $statusDescription,
            ),
        ) + $additionalFields;
        return $fields;
    }
661195
public function loadAnnotatedEvents()
    {
        if ($this->app->environment('local') && $this->scanWhenLocal) {
            $this->scanEvents();
        }

        $scans = $this->eventScans();

        if (!empty($scans) && $this->finder->eventsAreScanned()) {
            $this->loadScannedEvents();
        }
    }
493599
public static String getConnectionEventString(int eventID) {
        switch (eventID) {

            case ConnectionEvent.CONNECTION_CLOSED: 
                return "CONNECTION CLOSED (" + eventID + ')'; 

            case ConnectionEvent.LOCAL_TRANSACTION_STARTED: 
                return "LOCAL TRANSACTION STARTED (" + eventID + ')'; 

            case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED: 
                return "LOCAL TRANSACTION COMMITTED (" + eventID + ')'; 

            case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK: 
                return "LOCAL TRANSACTION ROLLEDBACK (" + eventID + ')'; 

            case ConnectionEvent.CONNECTION_ERROR_OCCURRED: 
                return "CONNECTION ERROR OCCURRED (" + eventID + ')'; 

            case WSConnectionEvent.CONNECTION_ERROR_OCCURRED_NO_EVENT:
                return "CONNECTION ERROR OCCURRED NO EVENT (" + eventID + ')';

            case WSConnectionEvent.SINGLE_CONNECTION_ERROR_OCCURRED:
                return "SINGLE CONNECTION ERROR OCCURRED (" + eventID + ')';
        }

        return "UNKNOWN CONNECTION EVENT CONSTANT (" + eventID + ')'; 
    }
593849
public function readFromLocalImage($localImage, $remoteFolder, $barcodeReadType)
    {
        $folder = new Folder();
        $folder->UploadFile($localImage, $remoteFolder);
        $data = $this->ReadR(basename($localImage), $remoteFolder, $barcodeReadType);
        return $data;
    }
1194543
public static function findMainCode($localeCodes)
    {
        $languageLocaleCodes = [];
        foreach ($localeCodes as $localeCode) {
            $languageCode = static::languageCode($localeCode);
            if (!isset($languageLocaleCodes[$languageCode])) {
                $languageLocaleCodes[$languageCode] = $localeCode;
            }
        }

        if ($mainLanguageCode = Language::findMainCode(array_keys($languageLocaleCodes))) {
            return $languageLocaleCodes[$mainLanguageCode];
        }

        return null;
    }