getAvailableData example

public function __construct(
        private readonly JsonEntityEncoder $entityEncoder,
        private readonly DefinitionInstanceRegistry $definitionRegistry
    ) {
    }

    /** * @return array<string, mixed> */
    public function encode(FlowEventAware $event): array
    {
        return $this->encodeType($event->getAvailableData()->toArray()$event);
    }

    /** * @param array<string, mixed> $data * @param array<string, mixed> $stored * * @return array<string, mixed> */
    public function encodeData(array $data, array $stored): array
    {
        foreach ($data as $key => $property) {
            
static::assertEquals('media.uploaded', $mediaUploadEvent->getName());
        static::assertEquals($mediaId$mediaUploadEvent->getMediaId());
        static::assertEquals(
            $context,
            $mediaUploadEvent->getContext()
        );
    }

    public function testGetAvailableData(): void
    {
        $eventDataCollection = MediaUploadedEvent::getAvailableData();

        static::assertInstanceOf(EventDataCollection::class$eventDataCollection);
        static::assertCount(1, $eventDataCollection->toArray());
        static::assertEquals(
            (new EventDataCollection())->add('mediaId', new ScalarValueType(ScalarValueType::TYPE_STRING)),
            $eventDataCollection
        );
    }

    public function testRestoreScalarValuesCorrectly(): void
    {
        
$name,
                    $requiredInVersion
                );
            }
        }

        return [
            'name' => $name,
            'use-case' => $description->render(),
            'class' => $hook,
            'trigger' => $docBlock->getSummary() . '<br>' . $docBlock->getDescription()->render(),
            'data' => $this->getAvailableData($reflection),
            'services' => $this->getAvailableServices($reflection),
            'since' => $since[0]->getVersion(),
            'stoppable' => mb_strtolower(var_export($reflection->implementsInterface(StoppableHook::class), true)),
            'optional' => mb_strtolower(var_export(is_subclass_of($hook, OptionalFunctionHook::class), true)),
            'deprecation' => $deprecationNotice,
        ];
    }

    /** * @param array<string, mixed> $hookData * @param class-string<InterfaceHook> $hook * * @return array<string, mixed> */
foreach ($interfaces as $interface) {
            if (is_subclass_of($interface, FlowEventAware::class)
                && $interface !== FlowEventAware::class) {
                $aware[] = lcfirst((new \ReflectionClass($interface))->getShortName());
                $aware[] = $interface;
            }
        }

        return new BusinessEventDefinition(
            $name,
            $class,
            $instance->getAvailableData()->toArray(),
            $aware
        );
    }

    private function fetchAppEvents(BusinessEventCollectorResponse $result): BusinessEventCollectorResponse
    {
        $appEvents = $this->connection->fetchAllAssociative('SELECT `app_flow_event`.`name`, `app_flow_event`.`aware` FROM `app_flow_event` JOIN `app` ON `app_flow_event`.`app_id` = `app`.`id` WHERE `app`.`active` = 1');

        array_map(function D$event) use ($result): void {
            $definition = new BusinessEventDefinition(
                $event['name'],
                

        return $this->flowEventAware->getName();
    }

    public function getWebhookPayload(): array
    {
        return $this->businessEventEncoder->encode($this->flowEventAware);
    }

    public function isAllowed(string $appId, AclPrivilegeCollection $permissions): bool
    {
        foreach ($this->flowEventAware->getAvailableData()->toArray() as $dataType) {
            if (!$this->checkPermissionsForDataType($dataType$permissions)) {
                return false;
            }
        }

        return true;
    }

    /** * @param array<mixed> $dataType */
    
Home | Imprint | This part of the site doesn't use cookies.