芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/mctv/vendor/slim/slim/Slim/Factory/AppFactory.php
has(ResponseFactoryInterface::class) ? $container->get(ResponseFactoryInterface::class) : self::determineResponseFactory(); $callableResolver = $container->has(CallableResolverInterface::class) ? $container->get(CallableResolverInterface::class) : null; $routeCollector = $container->has(RouteCollectorInterface::class) ? $container->get(RouteCollectorInterface::class) : null; $routeResolver = $container->has(RouteResolverInterface::class) ? $container->get(RouteResolverInterface::class) : null; $middlewareDispatcher = $container->has(MiddlewareDispatcherInterface::class) ? $container->get(MiddlewareDispatcherInterface::class) : null; return new App( $responseFactory, $container, $callableResolver, $routeCollector, $routeResolver, $middlewareDispatcher ); } /** * @return ResponseFactoryInterface * @throws RuntimeException */ public static function determineResponseFactory(): ResponseFactoryInterface { if (static::$responseFactory) { if (static::$streamFactory) { return static::attemptResponseFactoryDecoration(static::$responseFactory, static::$streamFactory); } return static::$responseFactory; } $psr17FactoryProvider = static::$psr17FactoryProvider ?? new Psr17FactoryProvider(); /** @var Psr17Factory $psr17factory */ foreach ($psr17FactoryProvider->getFactories() as $psr17factory) { if ($psr17factory::isResponseFactoryAvailable()) { $responseFactory = $psr17factory::getResponseFactory(); if (static::$streamFactory || $psr17factory::isStreamFactoryAvailable()) { $streamFactory = static::$streamFactory ?? $psr17factory::getStreamFactory(); return static::attemptResponseFactoryDecoration($responseFactory, $streamFactory); } return $responseFactory; } } throw new RuntimeException( "Could not detect any PSR-17 ResponseFactory implementations. " . "Please install a supported implementation in order to use `AppFactory::create()`. " . "See https://github.com/slimphp/Slim/blob/4.x/README.md for a list of supported implementations." ); } /** * @param ResponseFactoryInterface $responseFactory * @param StreamFactoryInterface $streamFactory * @return ResponseFactoryInterface */ protected static function attemptResponseFactoryDecoration( ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory ): ResponseFactoryInterface { if ( static::$slimHttpDecoratorsAutomaticDetectionEnabled && SlimHttpPsr17Factory::isResponseFactoryAvailable() ) { return SlimHttpPsr17Factory::createDecoratedResponseFactory($responseFactory, $streamFactory); } return $responseFactory; } /** * @param Psr17FactoryProviderInterface $psr17FactoryProvider */ public static function setPsr17FactoryProvider(Psr17FactoryProviderInterface $psr17FactoryProvider): void { static::$psr17FactoryProvider = $psr17FactoryProvider; } /** * @param ResponseFactoryInterface $responseFactory */ public static function setResponseFactory(ResponseFactoryInterface $responseFactory): void { static::$responseFactory = $responseFactory; } /** * @param StreamFactoryInterface $streamFactory */ public static function setStreamFactory(StreamFactoryInterface $streamFactory): void { static::$streamFactory = $streamFactory; } /** * @param ContainerInterface $container */ public static function setContainer(ContainerInterface $container): void { static::$container = $container; } /** * @param CallableResolverInterface $callableResolver */ public static function setCallableResolver(CallableResolverInterface $callableResolver): void { static::$callableResolver = $callableResolver; } /** * @param RouteCollectorInterface $routeCollector */ public static function setRouteCollector(RouteCollectorInterface $routeCollector): void { static::$routeCollector = $routeCollector; } /** * @param RouteResolverInterface $routeResolver */ public static function setRouteResolver(RouteResolverInterface $routeResolver): void { static::$routeResolver = $routeResolver; } /** * @param MiddlewareDispatcherInterface $middlewareDispatcher */ public static function setMiddlewareDispatcher(MiddlewareDispatcherInterface $middlewareDispatcher): void { static::$middlewareDispatcher = $middlewareDispatcher; } /** * @param bool $enabled */ public static function setSlimHttpDecoratorsAutomaticDetection(bool $enabled): void { static::$slimHttpDecoratorsAutomaticDetectionEnabled = $enabled; } }