matcher

@param Container $container

@return  MatcherInterface
@throws \ReflectionException
@throws \Windwalker\DI\Exception\DependencyResolutionException
330746
public function matcher(Container $container)
    {
        $matcher = $container->get('config')->get('routing.matcher', 'default');

        $matcher = strtolower($matcher) === 'default' ? 'sequential' : $matcher;

        $class = sprintf('Windwalker\Router\Matcher\%sMatcher', ucfirst($matcher));

        if (!class_exists($class)) {
            throw new \DomainException(sprintf('Router Matcher: %s not supported.', ucfirst($matcher)));
        }

        return $container->newInstance($class);
    }
512395
public function load(ServiceContainer $container, array $params)
    {
        $container->define(
            'ecomdev.matcher.file',
            function () {
                return $this->createFileMatcher();
            },
            ['matchers']
        );

        $container->define(
            'ecomdev.matcher.file_content',
            function () {
                return $this->createFileContentMatcher();
            },
            ['matchers']
        );

        $container->define(
            'ecomdev.matcher.directory',
            function () {
                return $this->createDirectoryMatcher();
            },
            ['matchers']
        );
    }
416587
public function register(Container $container)
    {
        $container = $container->getParent();

        // System profiler
        $closure = function (Container $container) {
            $config = $container->get('config');

            if ($config->get('system.debug')) {
                $profiler = new Profiler('windwalker');

                $profiler->setPoint(new Point(
                    'start',
                    $config['execution.start'] ?: microtime(true),
                    $config['execution.memory'] ?: memory_get_usage(true),
                    ['tag' => 'system.process']
                ));

                return $profiler;
            }

            return new NullProfiler();
        };

        $container->share('profiler', $closure);

        // System collector
        $closure = function (Container $container) {
            $config = $container->get('config');

            if ($config->get('system.debug')) {
                return new Structure();
            } else {
                return new NullObject();
            }
        };

        $container->share('debugger.collector', $closure);

        if ($container->get('config')->get('system.debug')) {
            $this->registerProfilerListener($container, $container->get('config'));
            $this->registerDatabaseProfiler($container, $container->get('config'));
            $this->registerEmailProfiler($container, $container->get('config'));
            $this->registerLogsProfiler($container, $container->get('config'));
        }
    }
685560
public function registerMatcher($matcher)
    {
        if (! in_array($matcher, $this->matchers) && is_a($matcher, MatcherInterface::class, true)) {
            $this->matchers[] = $matcher;
        }

        return $this;
    }
1027219
protected function setDependencies(Container $container)
    {
        $this->setTranslator($container['translator']);
        $this->setView($container['view']);
        $this->setTemplateFactory($container['template/factory']);
        if (isset($container['config']['handlers.defaults'])) {
            $this->setConfig($container['config']['handlers.defaults']);
        }
        return $this;
    }
630129
public function setContainer(Container $container)
    {
        $pipeline = $this->pipeline;

        $closure = function () use ($container) {
            $this->container = $container;
        };

        $resetPipeline = $closure->bindTo($pipeline, $pipeline);
        $resetPipeline();

        return $this;
    }
1138830
public function setContainer(Symfony\Component\DependencyInjection\Container $container) {
        $this->container = $container;

        return $this;
    }
429688
public function getDispatcherFactory(ContainerInterface $container): DispatcherFactoryInterface
    {
        $autowired = $container->get('ellipse.dispatcher.autowiring.status');

        if ($autowired) {

            $interfaces = $container->get('ellipse.dispatcher.autowiring.interfaces');

            $container = new ReflectionContainer($container, $interfaces);

        }

        return new DefaultResolver($container);
    }
314314
public function withContainer(ContainerInterface $container): ContainerizedInterface
    {
        $route = clone $this;
        $route->container = $container;
        if ($route->target instanceof TargetInterface) {
            $route->target = clone $route->target;
        }

        $route->pipeline = $route->makePipeline();

        return $route;
    }
824423
public function provideServiceLayerDependencies(Container $container): Container
    {
        $container = parent::provideServiceLayerDependencies($container);

        $container = $this->addConditionalAvailabilitySkuSearchQueryPlugin($container);
        $container = $this->addConditionalAvailabilitySkuSearchQueryExpanderPlugins($container);
        $container = $this->addConditionalAvailabilitySkuSearchQueryFormatterPlugins($container);
        $container = $this->addConditionalAvailabilityPingSearchQueryPlugin($container);
        $container = $this->addConditionalAvailabilityPingSearchQueryExpanderPlugins($container);
        $container = $this->addConditionalAvailabilityPingSearchQueryFormatterPlugins($container);

        return $container;
    }
893486
public static function get($abstract)
    {
        if (!isset(self::getInstance()->containers[$abstract])) {
            try {
                $reflect = new ReflectionClass(self::getInstance()->bind[$abstract]);
            } catch (ReflectionException $e) {
                throw new ContainerException('Cannot find "' . $abstract . '" in container');
            }

            self::set($abstract, $reflect->newInstanceArgs([]));
        }

        return self::getInstance()->containers[$abstract];
    }
797197
public function setContainer(ContainerInterface $container)
    {
        $application = $this;
        $container->share(ApplicationInterface::class, $application);
        $container->share(\Interop\Container\ContainerInterface::class, $container);

        $this->container = $container;

        return $this;
    }
1329585
public function assert(MatcherInterface $matcher)
    {
        if ($this->flag('not')) {
            $matcher->invert();
        }

        $match = $matcher
            ->setAssertion($this)
            ->match($this->getActual());

        $message = $this->flag('message');

        $this->clearFlags();

        $this->responder->respond($match, $matcher->getTemplate(), $message);

        return $this;
    }
355778
protected function addSessionHandler(
        DependencyContainerInterface $container
    ): DependencyContainerInterface {
        $container[self::SESSION_HANDLER] = function (DependencyContainerInterface $container) {
            return $this->getSessionHandler($container);
        };
        return $container;
    }
465879
public function cachedContainer(): ContainerInterface
    {
        /**
         * @noinspection   PhpIncludeInspection Include generated file
         * @psalm-suppress UnresolvableInclude Include generated file
         */
        include_once $this->getContainerClassPath();

        /** @psalm-var class-string<\Symfony\Component\DependencyInjection\Container> $containerClassName */
        $containerClassName = $this->getContainerClassName();

        /** @var ContainerInterface $container */
        $container = new $containerClassName();

        return $container;
    }
1339444
public function providePersistenceLayerDependencies(Container $container): Container
    {
        $container = parent::providePersistenceLayerDependencies($container);
        $container = $this->addBrandPropelQuery($container);
        $container = $this->addBrandProductPropelQuery($container);

        return $container;
    }
401227
public static function fromContainer(ContainerInterface $container)
	{
		$obj = $container->get(__CLASS__);

		if ($obj && $obj instanceof static)
			return $obj;

		throw new NotFoundException();
	}