initialize and configure restler-framework and return restler-object

@return RestlerExtended
324312
public function build()
    {
        $this->setAutoLoading();
        $this->setCacheDirectory();
        $this->setServerConfiguration();

        $restlerObj = $this->createRestlerObject();
        $this->configureRestler($restlerObj);
        $this->addApiClassesByGlobalArray($restlerObj);
        return $restlerObj;
    }
847594
public function init()
    {

        // reset the servlet request
        $httpRequest = $this->getHttpRequest();

        // initialize the parts
        foreach ($httpRequest->getParts() as $part) {
            $this->addPart(Part::fromHttpRequest($part));
        }

        // set the body content if we can find one
        if ($httpRequest->getHeader(HttpProtocol::HEADER_CONTENT_LENGTH) > 0) {
            $this->setBodyStream($httpRequest->getBodyContent());
        }

        // copy server variables to members
        $this->setServerName($this->getServerVar(ServerVars::SERVER_NAME));
        $this->setQueryString($this->getServerVar(ServerVars::QUERY_STRING));
        $this->setRequestUri($this->getServerVar(ServerVars::X_REQUEST_URI));
        $this->setDocumentRoot($this->getServerVar(ServerVars::DOCUMENT_ROOT));
        $this->setRequestUrl($this->getServerVar(ServerVars::HTTP_HOST) . $this->getServerVar(ServerVars::X_REQUEST_URI));
    }
1318565
protected function initContainer()
    {
        $initNode = $this->getResolver()->getSectionId('', 'init');

        if ($this->getResolver()->has($initNode)) {
            $this->getFactory()->executeMethodBatch(
                $this->getResolver()->get($initNode)
            );
        }
        return $this;
    }
182224
public function build(): SetDocumentContentRequest
	{
		$instance = new SetDocumentContentRequest();
		if ($this->frameId === null) {
			throw new BuilderException('Property [frameId] is required.');
		}
		$instance->frameId = $this->frameId;
		if ($this->html === null) {
			throw new BuilderException('Property [html] is required.');
		}
		$instance->html = $this->html;
		return $instance;
	}
373770
public function initialize() {
        if ($data = $this->getLocaleBundle()->loadResource(null, 'locale')) {
            $data = \Locale::parseLocale($data['code']) + $data;

            $config = $this->allConfig();
            unset($config['code'], $config['initialize']);

            $this->addConfig($config + $data);
        }

        // Force parent config to merge
        $this->getParentLocale();

        return $this;
    }
1255311
private function init()
    {
        $this->curl = curl_init();
        $this->setUserAgent(self::USER_AGENT);
        $this->setOpt(CURLINFO_HEADER_OUT, true);
        $this->setOpt(CURLOPT_HEADER, false);
        $this->setOpt(CURLOPT_RETURNTRANSFER, true);
        $this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'addResponseHeaderLine'));
        return $this;
    }
110100
private function addApiClassesByGlobalArray(RestlerExtended $restler)
    {
        $addApiController = $GLOBALS['TYPO3_Restler']['addApiClass'];
        if (is_array($addApiController)) {
            foreach ($addApiController as $apiEndpoint => $apiControllers) {
                $uniqueApiControllers = array_unique($apiControllers);
                foreach ($uniqueApiControllers as $apiController) {
                    $restler->addAPIClass($apiController, $apiEndpoint);
                }
            }
        }
    }
1068474
public function init()
    {
        $this->requestUri = $this->getServer('REQUEST_URI');
        $scriptName = $this->getServer('SCRIPT_NAME');
        $this->path = rtrim(dirname($scriptName), '/');
        $this->scriptName = basename($scriptName);

        // The route and its parts
        $this->extractRoute();

        // Prepare to create siteUrl and baseUrl by using currentUrl
        $this->currentUrl = $this->getCurrentUrl();
        $parts = parse_url($this->currentUrl);
        $this->siteUrl = "{$parts['scheme']}://{$parts['host']}"
            . (isset($parts['port'])
                ? ":{$parts['port']}"
                : '');
        $this->baseUrl = $this->siteUrl . $this->path;

        return $this;
    }
527140
protected function _initLoader()
    {
        $loader = $this->createProjectClass('Loader', $this->getContainer(), $this->_loaderDirs);

        \MUtil_Model::setSource($loader, true);

        return $loader;
    }
539707
public function initialize()
    {
        if (! $this->app instanceof Container) {
            throw new SandboxException('A base app has not been set.');
        }

        $this->setInitialConfig();
        $this->setInitialProviders();
        $this->setInitialResetters();

        return $this;
    }
343081
private function initializeRequest()
	{
		$this->isComplete = false;
		$this->responseBody = "";
		$this->responseHeaders = array();
		$this->options[CURLOPT_HTTPHEADER] = $this->headers;

		$ch = curl_init();
		curl_setopt_array($ch, $this->options);
		return $ch;
	}
1127971
protected function init() {
        $this->container->set('logger', function($c) {
            $configuration = $c->get('configuration');

            $logger = new Logger($configuration['logger']);

            return $logger;
        });

        $this->container->set(MiddlewareFactory::class, function($c) {
            return new MiddlewareFactory();
        });

        $this->container->set('request', function($c) {
            $psr17Factory = new Psr17Factory();

            $creator = new ServerRequestCreator(
                $psr17Factory, // ServerRequestFactory
                $psr17Factory, // UriFactory
                $psr17Factory, // UploadedFileFactory
                $psr17Factory  // StreamFactory
            );

            return $creator->fromGlobals();
        });

        $this->container->set('router', function($c) {
            return new Router();
        });

        $this->container->set('response', function($c) {
            return new Response();
        });

        $this->container->set('view', function($c) {
            $configuration = $c->get('configuration')['view'];
            $viewFunctions = isset($configuration['viewFunctions']) ? $configuration['viewFunctions'] : [];
            return new Plates($configuration['viewPath'], $viewFunctions);
        });

        $this->registerErrorHandler();
    }
117552
public static function init()
    {
        $files = File::getFolder(CONF_PATH)['file'];
        foreach ($files as $item => $file) {
            if (is_file(CONF_PATH . $file)) {
                $conf = self::load(CONF_PATH . $file);
                if (0 === $item) {
                    self::$config = $conf;
                } else {
                    self::$config[basename($file, EXT)] = $conf;
                }
            }
        }
        return self::$config;
    }
239743
function initialize()
    {
        if ($this->isInitialize())
            return $this;

        // ) Load Modules ------------------------------------------------------\
        $serviceManager = $this->getServiceManager();
        /** @var ModuleManager $moduleManager */
        $moduleManager  = $serviceManager->get('ModuleManager');
        $moduleManager->loadModules();

        // ) Attach Listeners To Events ----------------------------------------\
        $events = $this->getEventManager();
        foreach ($this->listeners as $listener) {
            if (!is_object($listener)) {
                if (class_exists($listener))
                    $listener = new $listener();
                else
                    $listener = $this->getServiceManager()->get($listener);
            }

            if (!$listener instanceof ListenerAggregateInterface)
                throw new \Exception(sprintf(
                    'Listener must instance of "ListenerAggregateInterface" but "%s" given.'
                    , is_object($listener) ? get_class($listener) : gettype($listener)
                ));

            // Attach Aggregate Listener
            $events->attach($listener);
        }

        // Ci) Bootstrap Application --------------------------------------------\
        $this->bootstrap();

        $this->__isInitialize = true;

        return $this;
    }
1274413
public function rest_api_init() {
		$register = [];
		foreach ( [ 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTION' ] as $method ) {
			$method_name = strtolower( "handle_{$method}" );
			if ( ! method_exists( $this, $method_name ) ) {
				continue;
			}
			$register[] = [
				'methods' => $method,
			    'callback' => [ $this, 'invoke' ],
			    'args'     => $this->get_arguments( $method ),
			    'permission_callback' => [ $this, 'permission_callback' ],
			];
		}
		if ( ! $register ) {
			throw new \Exception( sprintf( 'Class %s has no handler.', get_called_class() ), 500 );
		} else {
			register_rest_route( $this->namespace, $this->get_route(), $register );
		}
	}
427907
private function setRestDriver($restDriver)
    {
        $namespace = '\\' . __NAMESPACE__ . '\\RestClient\\';
        $driver = $namespace . $restDriver;
        $parent = $namespace . 'DriverInterface';

        if (
            empty($restDriver)
            || !class_exists($driver)
            || !is_subclass_of($driver, $parent)
        ) {
            throw new InvalidArgumentException('rest driver', $driver);
        }

        // create a new REST Driver
        $this->restDriver = new $driver();
        if (isset($this->url)) {
            $this->restDriver->setHost($this->url);
        }
    }
468789
protected function loadInits()
    {
        $this->hook->trigger(self::HOOK_LOAD_INITS_BEFORE);

        if ($this->config->get('parable.inits')) {
            $initLoader = \Parable\DI\Container::create(\Parable\Framework\Loader\InitLoader::class);
            $initLoader->load($this->config->get('parable.inits'));
        }

        $this->hook->trigger(self::HOOK_LOAD_INITS_AFTER);
        return $this;
    }