postConfigure

@see SessionBuilder
557975
protected function postConfigure(Session $session)
    {
        $session
            ->registerClientPooler(new PreparedQueryPooler)
            ->registerClientPooler(new QueryManagerPooler)
            ->registerClientPooler(new ConverterPooler(clone $this->converter_holder))
            ->registerClientPooler(new ObserverPooler)
            ->registerClientPooler(new InspectorPooler)
            ->registerClientPooler(new ListenerPooler)
            ;

        return $this;
    }
266254
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->config;

		if ($config->mailer === null) {
			throw new InvalidStateException(sprintf('"%s" must be configured.', $this->prefix('mailer')));
		}

		$builder->addFactoryDefinition($this->prefix('messageFactory'))
			->setImplement(IMessageFactory::class);

		// Wrap original mailer by TraceableMailer
		if ($config->debug === true) {
			$mailer = $builder->addDefinition($this->prefix('mailer.original'))
				->setAutowired(false);

			$this->loadDefinitionsFromConfig(['mailer.original' => $config->mailer]);

			$traceableMailer = $builder->addDefinition($this->prefix('mailer'))
				->setType(TraceableMailer::class)
				->setArguments([$mailer]);

			// Mail panel for tracy
			$builder->addDefinition($this->prefix('panel'))
				->setFactory(MailPanel::class)
				->addSetup('setTraceableMailer', [$traceableMailer]);
		} else {
			// Load mailer
			$this->loadDefinitionsFromConfig(['mailer' => $config->mailer]);
		}
	}
1153282
protected function sendConfiguration()
    {
        $sql=[];

        foreach ($this->configurator->getConfiguration() as $setting => $value) {
            $sql[] = sprintf("set %s = %s", pg_escape_identifier($this->handler, $setting), pg_escape_literal($this->handler, $value));
        }

        if (count($sql) > 0) {
            $this->testQuery(
                pg_query($this->getHandler(), join('; ', $sql)),
                sprintf("Error while applying settings '%s'.", join('; ', $sql))
            );
        }

        return $this;
    }
276230
public function postCreate()
	{
		$response = array(
			"method" => "create",
			"success" => false,
			"user" => "",
			"error_code" => 0,
			"error_message" => ""
		);

		try {
		    AuthorizerHelper::can(UserValidator::USER_CAN_SAVE);

            $data = json_decode(file_get_contents("php://input"));
            if (empty($data)) {
                $data = (object) $_POST;
            }

            $userModel = new User();

            // Check required fields
            $requiredParams = array('email', 'name', 'role', 'password');
            $params = (array) $data;
            foreach ($requiredParams as $param){
                if (empty($params[$param])) {
                    throw new \Exception(ucfirst($param) .' is required.');
                }
            }

            // Check Dupe email [ER-155]
            if(!empty($data->email)) {
                if (false === $userModel->isEmailUnique($data->email)) {
                    throw new \Exception("The email you entered already exists.");
                }
            }

            $userId = $userModel->save($data);

            if (empty($userId)) {
                throw  new \Exception('Could not create new user.');
            }
            $user = $userModel->getById($userId);
            $output = array('id'       => $user->getId(),
                            'email'    => $user->getEmail(),
                            'role'     => $this->getRoleInfo($user),
                            'name'     => $user->getName(),
                            'last_login' => $user->getLastLogin(),
                            'gateway_customer_id'=> $user->getGatewayCustomerId()
            );

			$response['user'] = $output;
			$response['success'] = true;
			$this->setStatusCode(200);
		} catch (\Exception $e) {
			$response['error_message'] = $e->getMessage();
			$response['error_code'] = $e->getCode();
		}

		$this->setContent($response);
	}
358384
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		Validators::assertField($config, 'enabled', 'bool');
		Validators::assertField($config, 'users', 'array');

		// Skip if its disabled
		if ($config['enabled'] !== true) return;

		// Throws if there's no user
		if ($config['users'] === []) throw new LogicException('You have to define any user or disable extension');

		$def = $builder->addDefinition($this->prefix('authenticator'))
			->setType(BasicAuthenticator::class)
			->setArguments([$config['title']]);

		foreach ($config['users'] as $user => $values) {
			if (is_string($values)) {
				trigger_error('Usage of `$username => $password` is deprecated, use `$username => ["password" => $password]` instead', E_USER_DEPRECATED);
				$password = $values;
				$unsecured = true;
			} else {
				$password = $values['password'];
				$unsecured = $values['unsecured'] ?? false;
			}
			$def->addSetup('addUser', [$user, $password, $unsecured]);
		}
	}
1223688
protected function configureUser()
    {
        if (!$this->confirm('Do you want to create an admin user?')) {
            return;
        }

        // We need to refresh the config to get access to the newly connected database.
        $this->getFreshConfiguration();

        // Now we need to install the application.
        // $this->call('cachet:install');

        $user = [
            'username' => $this->ask('Please enter your username'),
            'email'    => $this->ask('Please enter your email'),
            'password' => $this->secret('Please enter your password'),
            'level'    => User::LEVEL_ADMIN,
        ];

        User::create($user);
    }
1073911
@PostConstruct
	@SuppressWarnings("unchecked")
	protected void configure() {

		// scan all fields
		for (Field field : getClass().getDeclaredFields()) {

			// if it's a preprocessor, register it
			if (IModifier.class.isAssignableFrom(field.getType())) {

				try {
					field.setAccessible(true);
					final IModifier processor = (IModifier) field.get(this);
					processorsCache.put(processor.getAnnotationType(), processor);
				} catch (IllegalArgumentException | IllegalAccessException ex) {
					LoggerFactory.getLogger(ModifiersPreprocessor.class) .error("Could not register pre-processor for field " + field.getName());
				}
			}
		}
	}
783649
protected function bootConfiguration(): void
    {
        $config = $this->app->make('config');
        $namespace = $this->hasPackageRepository() ? 'orchestra/html::' : 'orchestra.';

        $this->app->make('orchestra.form')->setConfig($config->get("{$namespace}form"));
        $this->app->make('orchestra.table')->setConfig($config->get("{$namespace}table"));
    }
888955
public function updateSessionConfiguration()
    {
        $configuration = clone $this->getUserConfiguration();
        $userSession = $this->manager->getRepository('QcmPublicBundle:UserSession')->findOneBy(array(
            'id' => $this->userSession->getId()
        ));

        $userSession->setConfiguration($configuration);
        $this->manager->persist($userSession);
        $this->manager->flush();

        $this->session->set('user_session', $userSession);

        return $this;
    }
832613
@PostConstruct
	protected synchronized void setUpPostConstruct() {
		if (myInitialized) {
			return;
		}

		for (Entry<Class<? extends IResourceProvider>, IResourceProvider> provider : getProviders().entrySet()) {
			addProvider(provider.getValue(), provider.getKey());
		}
		List<BaseMethodBinding<?>> serverBindings = new ArrayList<BaseMethodBinding<?>>();
		for (ResourceBinding baseMethodBinding : myResourceNameToBinding.values()) {
			serverBindings.addAll(baseMethodBinding.getMethodBindings());
		}
		serverConfiguration.setServerBindings(serverBindings);
		serverConfiguration.setResourceBindings(new LinkedList<ResourceBinding>(myResourceNameToBinding.values()));
		HardcodedServerAddressStrategy hardcodedServerAddressStrategy = new HardcodedServerAddressStrategy();
		hardcodedServerAddressStrategy.setValue(getBaseForServer());
		serverConfiguration.setServerAddressStrategy(hardcodedServerAddressStrategy);
		FhirVersionEnum fhirContextVersion = super.getFhirContext().getVersion().getVersion();
		switch (fhirContextVersion) {
			case R4:
				org.hl7.fhir.r4.hapi.rest.server.ServerCapabilityStatementProvider r4ServerCapabilityStatementProvider = new org.hl7.fhir.r4.hapi.rest.server.ServerCapabilityStatementProvider(serverConfiguration);
				r4ServerCapabilityStatementProvider.initializeOperations();
				myR4CapabilityStatement = r4ServerCapabilityStatementProvider.getServerConformance(null);
				break;
			case DSTU3:
				org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider dstu3ServerCapabilityStatementProvider = new org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider(serverConfiguration);
				dstu3ServerCapabilityStatementProvider.initializeOperations();
				myDstu3CapabilityStatement = dstu3ServerCapabilityStatementProvider.getServerConformance(null);
				break;
			case DSTU2_1:
				org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider dstu2_1ServerConformanceProvider = new org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider(serverConfiguration);
				dstu2_1ServerConformanceProvider.initializeOperations();
				myDstu2_1Conformance = dstu2_1ServerConformanceProvider.getServerConformance(null);
				break;
			case DSTU2_HL7ORG:
				org.hl7.fhir.instance.conf.ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new org.hl7.fhir.instance.conf.ServerConformanceProvider(serverConfiguration);
				dstu2Hl7OrgServerConformanceProvider.initializeOperations();
				myDstu2Hl7OrgConformance = dstu2Hl7OrgServerConformanceProvider.getServerConformance(null);
				break;
			case DSTU2:
				ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider dstu2ServerConformanceProvider = new ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider(serverConfiguration);
				dstu2ServerConformanceProvider.initializeOperations();
				myDstu2Conformance = dstu2ServerConformanceProvider.getServerConformance(null);
				break;
			default:
				throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
		}

		myInitialized = true;
	}
228107
protected function initConfiguration()
    {
        $tsfe = self::getTsfe();

        // Get configuration
        if (!empty($tsfe->tmpl->setup['plugin.']['metaseo.'])) {
            $this->conf = $tsfe->tmpl->setup['plugin.']['metaseo.'];
        }

        // Store blacklist configuration
        if (!empty($this->conf['sitemap.']['index.']['blacklist.'])) {
            $this->blacklistConf = $this->conf['sitemap.']['index.']['blacklist.'];
        }

        // Store blacklist configuration
        if (!empty($this->conf['sitemap.']['index.']['fileExtension.'])) {
            # File extensions can be a comma separated list
            foreach ($this->conf['sitemap.']['index.']['fileExtension.'] as $fileExtListRaw) {
                $fileExtList       = Typo3GeneralUtility::trimExplode(',', $fileExtListRaw);
                $this->fileExtList = array_merge($this->fileExtList, $fileExtList);
            };
        }

        // Get expiration
        $expirationInDays = 60;
        if (!empty($this->conf['sitemap.']['expiration'])) {
            $expirationInDays = abs($this->conf['sitemap.']['expiration']);
        }

        $this->indexExpiration = $_SERVER['REQUEST_TIME'] + ($expirationInDays * 24 * 60 * 60);

        // Init blacklist for doktype (from table pages)
        $this->doktypeBlacklist = SitemapUtility::getDoktypeBlacklist();

        // Init blacklist for PAGE typenum
        $this->pageTypeBlacklist = SitemapUtility::getPageTypeBlacklist();
    }
421669
protected function configure()
    {

        // initialize the command with the required/optional options
        $this->setName(CommandNames::IMPORT_CREATE_CONFIGURATION_FILE)
             ->setDescription('Create\'s a configuration file from the given entity\'s template')
             ->addOption(InputOptionKeys::DEST, null, InputOption::VALUE_REQUIRED, 'The relative/absolut pathname of the destination file');

        // invoke the parent method
        parent::configure();
    }
174601
@Override
    protected void configure() {

        // Create HK2 service locator and bind jersey injections
        ServiceLocator locator = ServiceLocatorFactory.getInstance().create(null);
        bind(ServiceLocator.class).toInstance(locator);

        bind(VertxContainer.class).to(DefaultVertxContainer.class);
        bind(JerseyServer.class).to(GuiceJerseyServer.class);
        bind(JerseyHandler.class).to(DefaultJerseyHandler.class);
        bind(JerseyOptions.class).to(DefaultJerseyOptions.class);
        bind(JerseyServerOptions.class).to(DefaultJerseyOptions.class);
        bind(ContainerResponseWriterProvider.class).to(VertxResponseWriterProvider.class);
        bind(MessageBodyWriter.class).to(WriteStreamBodyWriter.class).in(Singleton.class);
        bind(ApplicationConfigurator.class).toProvider(Providers.of(null));

        Multibinder.newSetBinder(binder(), VertxRequestProcessor.class);
        Multibinder.newSetBinder(binder(), VertxResponseProcessor.class);
        Multibinder.newSetBinder(binder(), VertxPostResponseProcessor.class);

        Multibinder.newSetBinder(binder(), ContainerRequestFilter.class);
        Multibinder.newSetBinder(binder(), ContainerResponseFilter.class);
        Multibinder.newSetBinder(binder(), ReaderInterceptor.class);
        Multibinder.newSetBinder(binder(), WriterInterceptor.class);
        Multibinder.newSetBinder(binder(), ModelProcessor.class);
        Multibinder.newSetBinder(binder(), ContainerLifecycleListener.class);
        Multibinder.newSetBinder(binder(), ApplicationEventListener.class);
        Multibinder.newSetBinder(binder(), ExceptionMapper.class);

    }
782325
protected function prepareExecute()
    {
        $packageName = $this->getOption('package');

        /** @var AbstractPackage $package */
        $package = $this->console->getPackage($packageName);

        $class = null;

        if ($package) {
            $class = MvcHelper::getPackageNamespace(get_class($package), 1) . '\\Seed\\DatabaseSeeder';
        }

        if (!class_exists($class)) {
            $class = $this->getOption('class');
        }

        $class = StringNormalise::toClassNamespace($class);

        if (!class_exists($class)) {
            $file = $package ? $package->getDir() . '/Seed/' . $class . '.php' : null;

            if (!$file || !is_file($file)) {
                $file = $this->getOption(
                    'd',
                    Ioc::getConfig()->get('path.seeders')
                ) . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';

                if ($file[0] !== '/' && substr($file, 1, 2) !== ':\\') {
                    $file = $this->console->get('path.root') . '/' . $file;
                }
            }

            if (is_file($file)) {
                include_once $file;
            }
        }

        if (!class_exists($class)) {
            throw new \RuntimeException('Class: ' . $class . ' not exists.');
        }

        if (!is_subclass_of($class, 'Windwalker\Core\Seeder\AbstractSeeder')) {
            throw new \RuntimeException('Class: ' . $class . ' should be sub class of Windwalker\Core\Seeder\AbstractSeeder.');
        }

        // Auto include classes
        $path = dirname(ReflectionHelper::getPath($class));

        $files  = Filesystem::files($path);
        $loader = new ClassLoader();
        $loader->register();

        /** @var \SplFileInfo $file */
        foreach ($files as $file) {
            $loader->addMap($file->getBasename('.php'), $file->getPathname());
        }

        $this->console->set('seed.class', $class);
    }
1336541
public void configure() {
	  if (configurator != null && !underConfiguration.get() &&
			  underConfiguration.compareAndSet(false, true)) {
		 try {
			  configurator.configure(this);
		 } finally {
			 underConfiguration.set(false);
		 }
	  }
  }
1336948
private function prepare()
    {
        $session = new Session();
        $session->start();

        $request = Request::createFromGlobals();
        $request->setSession($session);

        $this->requestStack->push($request);
        $this->tokenStorage->setToken(
            new AnonymousToken('anonymous', 'anonymous', ['ROLE_ADMINISTRATOR'])
        );
    }
1144281
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		Validators::assertField($config, 'middlewares', 'array');

		// Register middleware chain builder
		$chain = $builder->addDefinition($this->prefix('chain'))
			->setAutowired(false);

		if ($config['debug'] !== true) {
			$chain->setFactory(ChainBuilder::class);
		} else {
			$chain->setFactory(DebugChainBuilder::class);

			$builder->addDefinition($this->prefix('middlewaresPanel'))
				->setFactory(MiddlewaresPanel::class, [$chain]);
		}
	}