Build configuration

@return result configuration
171932
@NotNull
    @ObjectiveCName("build")
    public Configuration build() {
        if (endpoints.size() == 0) {
            throw new RuntimeException("Endpoints not set");
        }
        if (phoneBookProvider == null) {
            throw new RuntimeException("Phonebook Provider not set");
        }
        if (apiConfiguration == null) {
            throw new RuntimeException("Api Configuration not set");
        }
        if (deviceCategory == null) {
            throw new RuntimeException("Device Category not set");
        }
        if (platformType == null) {
            throw new RuntimeException("App Category not set");
        }
        if (trustedKeys.size() == 0) {
            Log.w("ConfigurationBuilder", "No Trusted keys set. Using anonymous server authentication.");
        }
        return new Configuration(endpoints.toArray(new ConnectionEndpoint[endpoints.size()]),
                phoneBookProvider, notificationProvider,
                apiConfiguration, enableContactsLogging, enableNetworkLogging,
                enableFilesLogging, deviceCategory, platformType,
                minDelay, maxDelay, maxFailureCount,
                timeZone, preferredLanguages.toArray(new String[preferredLanguages.size()]),
                customAppName,
                trustedKeys.toArray(new TrustedKey[trustedKeys.size()]),
                isPhoneBookImportEnabled,
                isOnClientPrivacyEnabled,
                callsProvider,
                rawUpdatesHandler,
                voiceCallsEnabled,
                videoCallsEnabled,
                isEnabledGroupedChatList,
                autoJoinGroups.toArray(new String[autoJoinGroups.size()]),
                autoJoinType);
    }
324312
public function build()
    {
        $this->setAutoLoading();
        $this->setCacheDirectory();
        $this->setServerConfiguration();

        $restlerObj = $this->createRestlerObject();
        $this->configureRestler($restlerObj);
        $this->addApiClassesByGlobalArray($restlerObj);
        return $restlerObj;
    }
642615
protected function buildManager()
    {
        $config = new Configuration;

        $this->setUpGeneralConfigurations($config);
        $this->setUpSpecificConfigurations($config);

        $documentManager = DocumentManager::create($this->getOption('connection'), $config, $this->getEventManager());

        if ($this->getRepositoryFactory() !== null) {
            $documentManager->setRepositoryFactory($this->getRepositoryFactory());
        }

        if ($this->getDefaultRepositoryClass() !== null) {
            $documentManager->setDefaultRepositoryClassName($this->getDefaultRepositoryClass());
        }

        return $documentManager;
    }
380981
private function buildConfig()
    {
        $env = getenv('CRM_ENV');

        $configData = [
            'paths' => [
                'migrations' => [
                    '%%PHINX_CONFIG_DIR%%/../../../../migrations'
                ]
            ],
            'environments' => [
                'default_migration_table' => 'phinxlog',
                'default_database' => $env,
            ],
        ];

        foreach ($this->moduleManager->getModules() as $module) {
            $reflector = new \ReflectionClass($module);
            $configData['paths']['migrations'][] = dirname($reflector->getFileName()) . '/migrations';
        }

        $configData['environments'][$env] = [
            'adapter' => $this->envConfig->get('CRM_DB_ADAPTER'),
            'host' => $this->envConfig->get('CRM_DB_HOST'),
            'name' => $this->envConfig->get('CRM_DB_NAME'),
            'user' => $this->envConfig->get('CRM_DB_USER'),
            'pass' => $this->envConfig->get('CRM_DB_PASS'),
            'port' => $this->envConfig->get('CRM_DB_PORT'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
        ];

        return $configData;
    }
759754
public Config build() {
    if (this.language == null) {
      this.language = "java";
    }
    if (this.endpoint == null) {
      this.endpoint = SyncSender.DEFAULT_API_ENDPOINT;
    }
    if (this.notifier == null) {
      this.notifier = new NotifierProvider();
    }
    if (this.sender == null) {
      SyncSender.Builder innerSender =
          new SyncSender.Builder(this.endpoint)
          .accessToken(accessToken)
          .proxy(proxy);
      if (this.jsonSerializer != null) {
        innerSender.jsonSerializer(this.jsonSerializer);
      }
      this.sender =
        new BufferedSender.Builder().sender(innerSender.build()).build();
    }
    if (this.timestamp == null) {
      this.timestamp = new TimestampProvider();
    }

    return new ConfigImpl(this);
  }
567950
protected function build()
    {
        $factory = $this->getFactory();

        foreach ($this->filterConfig as $field => $config) {
            $this->add(
                $factory->createInput(
                    $config
                )
            );
        }
    }
1310740
public function build()
    {
        $config = parent::build();
        if (array_key_exists('collapsed', $config)) {
            $fieldKey = $this->fieldsBuilder->getField($config['collapsed'])->getKey();
            $fieldKey = preg_replace('/^field_/', '', $fieldKey);
            $config['collapsed'] = $this->getName() . '_' . $fieldKey;
        }
        return $config;
    }
283828
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $root = $treeBuilder->root('chameleon_system_sanity_check');

        $root
            ->canBeDisabled()
            ->children()
                ->append($this->getOutputConfiguration())
            ->end();

        return $treeBuilder;
    }
289621
public function build()
    {
        $this->createPathDirectories();

        if (!is_file($this->createSupervisorConfigurationFilePath())) {
            $this->generateSupervisorConfiguration();
        }

        // remove old worker configuration files
        /** @var \SplFileInfo $item */
        foreach (new \DirectoryIterator($this->paths['worker_configuration_directory']) as $item) {
            if ($item->isDir()) {
                continue;
            }

            if ('conf' !== $item->getExtension()) {
                continue;
            }

            unlink($item->getRealPath());
        }

        // generate program configuration files for all consumers
        $this->generateWorkerConfigurations(array_keys($this->consumers), $this->commands['rabbitmq_consumer']);

        // generate program configuration files for all multiple consumers
        $this->generateWorkerConfigurations(array_keys($this->multipleConsumers), $this->commands['rabbitmq_multiple_consumer']);

        // generate program configuration files for all batch consumers
        $this->generateWorkerConfigurations(array_keys($this->batchConsumers), $this->commands['rabbitmq_batch_consumer']);

        //generate program configuration files for all rpc_server consumers
        $this->generateWorkerConfigurations(array_keys($this->rpcServers), $this->commands['rabbitmq_rpc_server']);

        // start supervisord and reload configuration
        $this->supervisor->runAndReload();
    }
646209
public function build()
    {
        $config = new Config();

        $event = new GetConfigEvent($config);
        $this->eventDispatcher->dispatch(GuiEvents::GET_CONFIG, $event);

        return $config;
    }
1009151
public function getConfiguration()
    {
        if (is_null($this->_configuration)) {
            $this->_configuration = Configuration::get('config');
        }
        return $this->_configuration;
    }
580363
public function configure()
    {
        $docs = []; //$this->configuration->getTransformer()->getExternalClassDocumentation();
        foreach ($docs as $external) {
            $prefix = (string) $external->getPrefix();
            $uri = (string) $external->getUri();

            $this[] = new Rule(
                function ($node) use ($prefix) {
                    return is_string($node) && (strpos(ltrim($node, '\\'), $prefix) === 0);
                },
                function ($node) use ($uri) {
                    return str_replace('{CLASS}', ltrim($node, '\\'), $uri);
                }
            );
        }
    }
48047
public function build()
    {
        $stream = new Stream('php://temp', 'wb+');


        $stream->write(json_encode(new MessageDecorator($this->getMessage())));

        return $this->getHttpMessage()
            ->withAddedHeader('Content-Type', 'application/json')
            ->withBody($stream);
    }
719692
public function build()
	{
		$formMapper = $this->getMapper();
		$model      = $this->getModel();
		$primaryKey = (new $model)->getKeyName();

		/**
		 * Empty form
		 */
		$result = new FormResult();
		if ($this->getIdentifier() === null) {
			foreach ($formMapper->getFields() as $field) {
				$clone = clone $field;
				$name  = $clone->getName();

				// Is this a multiple field?
				if ($clone->isMultiple()) {
					$clone->setValue(['']);
				}

				$clone->setContext(BaseField::CONTEXT_FORM);
				$result->addField($name, $clone);
			}

			$this->setResult($result);
			return;
		}

		$items = $model::with([]);

		$items->where($primaryKey, $this->getIdentifier());
		$item = $items->first();

		// modifyModelItem hook
		if (method_exists($this->getMapper()->getAdmin(), 'modifyModelItem')) {
			$item = $this->getMapper()->getAdmin()->modifyModelItem($item);
		}

		$result = new FormResult;
		$result->setIdentifier($item->{$primaryKey});

		foreach ($formMapper->getFields() as $field) {
			$clone = clone $field;
			$name  = $clone->getName();
			$value = $item->{$name};

			if ($clone->hasBefore()) {
				$before = $clone->getBefore();

				if ($before instanceof Closure) {
					$value = $before($value);
				} else {
					$value = $before;
				}
			}

			// Is this a multiple field?
			if ($clone->isMultiple()) {
				$value = Value::decode(Config::get('bauhaus::admin.multiple-serializer'), $value);
			}

			$clone
				->setContext(BaseField::CONTEXT_FORM)
				->setValue($value);

			$result->addField($name, $clone);
		}

		$this->setResult($result);
	}
684231
private function initConfiguration()
    {
        $this->configuration = Builder::create()
            ->enableTags()
            ->enableCategories()
            ->enableLimit()
            ->enablePagination()
            ->enablePresentAs()
            ->enableAudienceTargeting()
            ->enableDatasource('pages', 'pages', 'column_list')
            ->enableSorting(
                [
                    ['column' => 'title', 'title' => 'sulu_admin.title'],
                    ['column' => 'published', 'title' => 'sulu_admin.published'],
                    ['column' => 'created', 'title' => 'sulu_admin.created'],
                    ['column' => 'changed', 'title' => 'sulu_admin.changed'],
                    ['column' => 'authored', 'title' => 'sulu_admin.authored'],
                ]
            )
            ->getConfiguration();

        return $this->configuration;
    }
917680
public function configure()
    {
        $this->config = new Configuration();

        $this->config->setNamingStrategy(new Mapping\DefaultNamingStrategy());

        $cache = new ApcCache();
        if ($cache->isSupported()) {
            $cache->setPrefix('samurai.onikiri.table.schema');
        } else {
            $cache = new ArrayCache();
        }
        $this->config->setSchemaCacher($cache);

        return $this->config;
    }
641397
public function build()
    {
        return array_merge($this->config, [
            'fields' => $this->buildFields(),
            'location' => $this->buildLocation(),
            'key' => $this->namespaceGroupKey($this->config['key']),
        ]);
    }