| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace Spiral\Router; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Psr\Http\Message\ResponseFactoryInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Psr\Http\Message\ResponseInterface as Response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Psr\Http\Message\ServerRequestInterface as Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Psr\Http\Server\RequestHandlerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Spiral\Core\CoreInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Spiral\Core\ScopeInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Spiral\Http\Exception\ClientException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Spiral\Http\Exception\ClientException\BadRequestException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Spiral\Http\Exception\ClientException\ForbiddenException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Spiral\Http\Exception\ClientException\NotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Spiral\Http\Exception\ClientException\ServerErrorException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Spiral\Http\Exception\ClientException\UnauthorizedException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Spiral\Http\Stream\GeneratorStream; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Spiral\Http\Traits\JsonTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Spiral\Interceptors\Context\CallContext; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Spiral\Interceptors\Context\Target; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use Spiral\Interceptors\Exception\TargetCallException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use Spiral\Interceptors\HandlerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Spiral\Router\Exception\HandlerException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Spiral\Telemetry\NullTracer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Spiral\Telemetry\TracerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | final class CoreHandler implements RequestHandlerInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     use JsonTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     private readonly TracerInterface $tracer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** @readonly */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     private ?string $controller = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     /** @readonly */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     private ?string $action = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** @readonly */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 56 |  |     private ?bool $verbActions = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /** @readonly */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     private ?array $parameters = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     private bool $isLegacyPipeline; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 56 |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         private readonly HandlerInterface|CoreInterface $core, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         private readonly ScopeInterface $scope, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         private readonly ResponseFactoryInterface $responseFactory, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         ?TracerInterface $tracer = null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 54 |  |         $this->tracer = $tracer ?? new NullTracer($scope); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $this->isLegacyPipeline = !$core instanceof HandlerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 54 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 54 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 54 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 54 |  |      * @mutation-free | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 54 |  |     public function withContext(string $controller, string $action, array $parameters): CoreHandler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $handler = clone $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $handler->controller = $controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $handler->action = $action; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $handler->parameters = $parameters; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         return $handler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 54 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 54 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 54 |  |      * Disable or enable HTTP prefix for actions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 54 |  |      * @mutation-free | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |     public function withVerbActions(bool $verbActions): CoreHandler | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |         $handler = clone $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |         $handler->verbActions = $verbActions; | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 79 | 54 |  |         return $handler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 | 54 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 | 53 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 53 |  |      * @psalm-suppress UnusedVariable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @throws \Throwable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 | 53 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 53 |  |     public function handle(Request $request): Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 53 |  |         $this->checkValues(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 | 53 |  |         $controller = $this->controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         $parameters = $this->parameters; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 53 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         $outputLevel = \ob_get_level(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 | 53 |  |         \ob_start(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 | 52 |  |         $result = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         $output = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 53 |  |         $response = $this->responseFactory->createResponse(200); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 | 53 |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 | 53 |  |             $action = $this->verbActions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 | 53 |  |                 ? \strtolower($request->getMethod()) . \ucfirst($this->action) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 | 53 |  |                 : $this->action; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 53 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 53 |  |             // run the core withing PSR-7 Request/Response scope | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 | 53 |  |             $result = $this->scope->runScope( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 53 |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 53 |  |                     Request::class  => $request, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 53 |  |                     Response::class => $response, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 | 53 |  |                 ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 53 |  |                 fn (): mixed => $this->tracer->trace( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 53 |  |                     name: 'Controller [' . $controller . ':' . $action . ']', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 | 53 |  |                     callback: $this->isLegacyPipeline | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 | 53 |  |                         ? fn (): mixed => $this->core->callAction( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 53 |  |                             controller: $controller, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 | 53 |  |                             action: $action, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 53 |  |                             parameters: $parameters, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 9 |  |                         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 6 |  |                         : fn (): mixed => $this->core->handle( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 | 6 |  |                             new CallContext( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 3 |  |                                 Target::fromPair($controller, $action), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 3 |  |                                 $parameters, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 3 |  |                             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                         ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 53 |  |                     attributes: [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 | 3 |  |                         'route.controller' => $this->controller, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |                         'route.action' => $action, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                         'route.parameters' => \array_keys($parameters), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |                     ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 | 44 |  |                 ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 | 44 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 44 |  |         } catch (TargetCallException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 44 |  |             \ob_get_clean(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 44 |  |             throw $this->mapException($e); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |         } catch (\Throwable $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             \ob_get_clean(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |             throw $e; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |         } finally { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |             while (\ob_get_level() > $outputLevel + 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                 $output = \ob_get_clean() . $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 | 44 |  |         return $this->wrapResponse( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             $response, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 | 44 |  |             $result, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 1 |  |             \ob_get_clean() . $output, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 | 1 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 | 1 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      * Convert endpoint result into valid response. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 43 |  |      * @param Response $response Initial pipeline response. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      * @param mixed    $result   Generated endpoint output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      * @param string   $output   Buffer output. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 | 43 |  |     private function wrapResponse(Response $response, mixed $result = null, string $output = ''): Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 11 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |         if ($result instanceof Response) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 33 |  |             if ($output !== '' && $result->getBody()->isWritable()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |                 $result->getBody()->write($output); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 43 |  |             return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 | 43 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         if ($result instanceof \Generator) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             return $response->withBody(new GeneratorStream($result)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         if (\is_array($result) || $result instanceof \JsonSerializable) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 | 6 |  |             $response = $this->writeJson($response, $result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 6 |  |             $response->getBody()->write((string)$result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 | 6 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 6 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 | 6 |  |         //Always glue buffered output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 | 6 |  |         $response->getBody()->write($output); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 | 6 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 | 6 |  |         return $response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * Converts core specific ControllerException into HTTP ClientException. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     private function mapException(TargetCallException $exception): ClientException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         return match ($exception->getCode()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 | 54 |  |             TargetCallException::BAD_ACTION, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |             TargetCallException::NOT_FOUND => new NotFoundException('Not found', $exception), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 | 54 |  |             TargetCallException::FORBIDDEN => new ForbiddenException('Forbidden', $exception), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 | 1 |  |             TargetCallException::UNAUTHORIZED => new UnauthorizedException('Unauthorized', $exception), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |             TargetCallException::INVALID_CONTROLLER => new ServerErrorException('Server error', $exception), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |             default => new BadRequestException('Bad request', $exception), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * @psalm-assert !null $this->controller | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * @psalm-assert !null $this->action | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * @psalm-assert !null $this->parameters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      * @mutation-free | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     private function checkValues(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         if ($this->controller === null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |             throw new HandlerException('Controller and action pair are not set.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 210 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 211 |  |  |  |