private function compiledRouteHttpMethodMatch(
        PHPCodeCollection $code,
        MatchedRouteDataMap $routeDataMap,
        array $parameters
    ): void {
        $code->appendLine('switch ($method) {');

        $code->indent++;

        foreach ($routeDataMap->getHttpMethodRouteDataMap() as $item) {
            [$httpMethods, $routeData] = $item;

            foreach ($httpMethods as $httpMethod) {
                $code->appendLine('case \'' . $httpMethod . '\':');
            }

            $code->indent++;

            $this->compileFoundRoute($code, $routeData, $parameters);

            $code->indent--;
        }

        $code->appendLine('default:');

        $code->indent++;

        foreach ($routeDataMap->allowedHttpMethods() as $method) {
            $code->appendLine('$allowedHttpMethods[] = \'' . $method . '\';');
        }

        $code->appendLine('break;');

        $code->indent--;
        $code->indent--;

        $code->appendLine('}');
    }
private function compiledRouteHttpMethodMatch(
        PHPCodeCollection $code,
        MatchedRouteDataMap $routeDataMap,
        array $parameters
    ): void {
        $code->appendLine('switch ($method) {');

        $code->indent++;

        foreach ($routeDataMap->getHttpMethodRouteDataMap() as $item) {
            [$httpMethods, $routeData] = $item;

            foreach ($httpMethods as $httpMethod) {
                $code->appendLine('case \'' . $httpMethod . '\':');
            }

            $code->indent++;

            $this->compileFoundRoute($code, $routeData, $parameters);

            $code->indent--;
        }

        $code->appendLine('default:');

        $code->indent++;

        foreach ($routeDataMap->allowedHttpMethods() as $method) {
            $code->appendLine('$allowedHttpMethods[] = \'' . $method . '\';');
        }

        $code->appendLine('break;');

        $code->indent--;
        $code->indent--;

        $code->appendLine('}');
    }
private function compiledRouteHttpMethodMatch ( PHPCodeCollection $ code , MatchedRouteDataMap $ routeDataMap , array $ parameters ) : void { $ code -> appendLine ( 'switch ($method) {' ) ; $ code -> indent ++ ; foreach ( $ routeDataMap -> getHttpMethodRouteDataMap ( ) as $ item ) { [ $ httpMethods , $ routeData ] = $ item ; foreach ( $ httpMethods as $ httpMethod ) { $ code -> appendLine ( 'case \'' . $ httpMethod . '\':' ) ; } $ code -> indent ++ ; $ this -> compileFoundRoute ( $ code , $ routeData , $ parameters ) ; $ code -> indent -- ; } $ code -> appendLine ( 'default:' ) ; $ code -> indent ++ ; foreach ( $ routeDataMap -> allowedHttpMethods ( ) as $ method ) { $ code -> appendLine ( '$allowedHttpMethods[] = \'' . $ method . '\';' ) ; } $ code -> appendLine ( 'break;' ) ; $ code -> indent -- ; $ code -> indent -- ; $ code -> appendLine ( '}' ) ; }
Compile the route http method match switch.

@param \Viserio\Component\Routing\TreeGenerator\PHPCodeCollection   $code
@param \Viserio\Component\Routing\TreeGenerator\MatchedRouteDataMap $routeDataMap
@param array                                                        $parameters
Compile the route http method match switch .