protected function compile(Endpoint $endpoint): void
    {
        //run all extensions for each definition
        foreach ($this->plugins as $plugin) {
            //run extensions recursively in all types and fields
            foreach ($endpoint->allTypes() as $type) {
                $this->configureDefinition($plugin, $type, $endpoint);
                if ($type instanceof FieldsAwareDefinitionInterface) {
                    foreach ($type->getFields() as $field) {
                        $this->configureDefinition($plugin, $field, $endpoint);
                        foreach ($field->getArguments() as $argument) {
                            $this->configureDefinition($plugin, $argument, $endpoint);
                        }
                    }
                }
            }

            //run extension in all queries
            foreach ($endpoint->allQueries() as $query) {
                $this->configureDefinition($plugin, $query, $endpoint);
                foreach ($query->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            //run extensions in all mutations
            foreach ($endpoint->allMutations() as $mutation) {
                $this->configureDefinition($plugin, $mutation, $endpoint);
                foreach ($mutation->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            //run extensions in all subscriptions
            foreach ($endpoint->allSubscriptions() as $subscription) {
                $this->configureDefinition($plugin, $subscription, $endpoint);
                foreach ($subscription->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            $plugin->configureEndpoint($endpoint);
        }
    }
protected function compile(Endpoint $endpoint): void
    {
        //run all extensions for each definition
        foreach ($this->plugins as $plugin) {
            //run extensions recursively in all types and fields
            foreach ($endpoint->allTypes() as $type) {
                $this->configureDefinition($plugin, $type, $endpoint);
                if ($type instanceof FieldsAwareDefinitionInterface) {
                    foreach ($type->getFields() as $field) {
                        $this->configureDefinition($plugin, $field, $endpoint);
                        foreach ($field->getArguments() as $argument) {
                            $this->configureDefinition($plugin, $argument, $endpoint);
                        }
                    }
                }
            }

            //run extension in all queries
            foreach ($endpoint->allQueries() as $query) {
                $this->configureDefinition($plugin, $query, $endpoint);
                foreach ($query->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            //run extensions in all mutations
            foreach ($endpoint->allMutations() as $mutation) {
                $this->configureDefinition($plugin, $mutation, $endpoint);
                foreach ($mutation->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            //run extensions in all subscriptions
            foreach ($endpoint->allSubscriptions() as $subscription) {
                $this->configureDefinition($plugin, $subscription, $endpoint);
                foreach ($subscription->getArguments() as $argument) {
                    $this->configureDefinition($plugin, $argument, $endpoint);
                }
            }

            $plugin->configureEndpoint($endpoint);
        }
    }
protected function compile ( Endpoint $ endpoint ) : void { //run all extensions for each definition foreach ( $ this -> plugins as $ plugin ) { //run extensions recursively in all types and fields foreach ( $ endpoint -> allTypes ( ) as $ type ) { $ this -> configureDefinition ( $ plugin , $ type , $ endpoint ) ; if ( $ type instanceof FieldsAwareDefinitionInterface ) { foreach ( $ type -> getFields ( ) as $ field ) { $ this -> configureDefinition ( $ plugin , $ field , $ endpoint ) ; foreach ( $ field -> getArguments ( ) as $ argument ) { $ this -> configureDefinition ( $ plugin , $ argument , $ endpoint ) ; } } } } //run extension in all queries foreach ( $ endpoint -> allQueries ( ) as $ query ) { $ this -> configureDefinition ( $ plugin , $ query , $ endpoint ) ; foreach ( $ query -> getArguments ( ) as $ argument ) { $ this -> configureDefinition ( $ plugin , $ argument , $ endpoint ) ; } } //run extensions in all mutations foreach ( $ endpoint -> allMutations ( ) as $ mutation ) { $ this -> configureDefinition ( $ plugin , $ mutation , $ endpoint ) ; foreach ( $ mutation -> getArguments ( ) as $ argument ) { $ this -> configureDefinition ( $ plugin , $ argument , $ endpoint ) ; } } //run extensions in all subscriptions foreach ( $ endpoint -> allSubscriptions ( ) as $ subscription ) { $ this -> configureDefinition ( $ plugin , $ subscription , $ endpoint ) ; foreach ( $ subscription -> getArguments ( ) as $ argument ) { $ this -> configureDefinition ( $ plugin , $ argument , $ endpoint ) ; } } $ plugin -> configureEndpoint ( $ endpoint ) ; } }
Verify endpoint definitions and do some tasks to prepare the endpoint

@param Endpoint $endpoint
Verify endpoint definitions and do some tasks to prepare the endpoint