Return the setup handler to ask the user questions

@return \CaptainHook\App\Runner\Config\Setup
481988
private function getHookSetup() : Setup
    {
        return $this->advanced
            ? new Setup\Advanced($this->io)
            : new Setup\Express($this->io);
    }
581085
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // Read the configuration settings.
        if (file_exists(Webtrees::CONFIG_FILE)) {
            $config = parse_ini_file(Webtrees::CONFIG_FILE);

            // Store the configuration settings as request attributes.
            foreach ($config as $key => $value) {
                $request = $request->withAttribute($key, $value);
            }

            return $handler->handle($request);
        }

        // No configuration file? Run the setup wizard to create one.
        return $this->setup_controller->setup($request);
    }
165605
public function getHandlerStack(): HandlerStack
    {
        if ($this->handlerStack) {
            return $this->handlerStack;
        }

        $this->handlerStack = HandlerStack::create($this->getGuzzleHandler());

        foreach ($this->middlewares as $name => $middleware) {
            $this->handlerStack->push($middleware, $name);
        }

        return $this->handlerStack;
    }
860256
public function getDevHandler()
    {
        static $handle = false;

        if ($handle === false) {
            $handle = $this->cookieConfig->getConfigFromCookies('deep', static::SETTING_DEV_HANDLE);
        }

        return $handle;
    }
121153
public function getClient() {
		if (!$this->client) {
			// Create custom handler stack with middlewares
			$stack = HandlerStack::create();

			$context = $this;
			$stack->push(Middleware::mapResponse(function (ResponseInterface $response) use ($context) {
   				// If a new version of this accessor is available, store its COID
				if ($response->hasHeader('C-Accessor-Latest-Version'))
      				$context->setLatestAccessorVersionCOID(
						new IRI($response->getHeaderLine('C-Accessor-Latest-Version')));
    			return $response;
			}));

			// Prepare client options
			$options = [
				'base_uri' => str_replace('{aauid}', AAUIDParser::getAAUID($this->getAAUID()), $this->agwBaseUrl),
				'headers' => [
					'Authorization' => 'Bearer '.$this->getAccessToken()
				],
				'handler' => $stack
			];
			if (isset($this->request) && $this->request->hasHeader('X-Forwarded-For')) {
				$options['headers']['X-Forwarded-For'] = $this->request->getHeaderLine('X-Forwarded-For');				
			}

			// Create client
			$this->client = new Client($options);
		}
		return $this->client;
	}
741484
private function _setupCurl()
    {
        $requestParams = http_build_query($this->requestParams);

        $this->uri = $this->action;
        if ($this->method == 'GET') {
            $this->uri .= '?'.$requestParams;
        }

        $this->curl = curl_init($this->uri);

        if ($this->method == 'POST') {
            // POST requests
            curl_setopt($this->curl, CURLOPT_POST, true);
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $requestParams);
        }

        // We want to receive the returned data
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
        // Setup custom user agent
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->formatUserAgentInfo());
    }
1253926
public function handleRequest()
    {
        try {
            $this->response = parent::handleRequest();
        } catch (HttpException $ex) {
            $this->config->set('page_title', 'Error');

            $view = new View('exception');
            $view->exception = $ex;

            $this->response->setResponseCode($ex->getErrorCode());
            $this->response->setContent($view->render());
        } catch (\Exception $ex) {
            $this->config->set('page_title', 'Error');

            $view = new View('exception');
            $view->exception = $ex;

            $this->response->setResponseCode(500);
            $this->response->setContent($view->render());
        }

        if ($this->response->hasLayout() && $this->controller->layout) {
            $this->setLayoutVariables($this->controller->layout);

            $this->controller->layout->content  = $this->response->getContent();
            $this->response->setContent($this->controller->layout->render());
        }

        return $this->response;
    }
171926
public function make()
    {
        $guzzle = Client::makeGuzzle($this->endpoint);

        $client = new Client(new Config($this->key ?: ''), $this->resolver, $guzzle);

        if ($this->callbacks) {
            $client->registerDefaultCallbacks();
        }

        if ($this->tokens && $this->checker && $this->user) {
            $this->setupUserDetection($client, $this->tokens, $this->checker);
        }

        $this->setupPaths($client, $this->strip, $this->project, $this->root);

        $client->setReleaseStage($this->stage ?: ($this->env === 'prod' ? 'production' : $this->env));

        $client->setAppVersion($this->version);
        $client->setFallbackType('Console');
        $client->setAppType($this->type);

        $client->setBatchSending($this->batch);
        $client->setHostname($this->hostname);
        $client->setSendCode($this->code);

        $client->setNotifier(array_filter([
            'name' => 'Bugsnag Symfony',
            'version' => BugsnagBundle::VERSION,
            'url' => 'https://github.com/bugsnag/bugsnag-symfony',
        ]));

        if ($this->stages) {
            $client->setNotifyReleaseStages($this->stages);
        }

        if ($this->filters) {
            $client->setFilters($this->filters);
        }

        return $client;
    }
83563
private static function logger()
    {
        $settings = [
            'name' => config('app.name'),
            'level' => Logger::DEBUG,
            'path' => storage_path("logs/" . (PHP_SAPI === "cli" ? "cli.log" : "app.log"))
        ];

        $logger = new Logger($settings['name']);
        $handler = new StreamHandler($settings['path']);

        $lineFormatter = new LineFormatter;
        $lineFormatter->includeStacktraces();

        $handler->setFormatter($lineFormatter);

        return $logger->pushHandler($handler, $settings['level']);
    }
1346610
private function getHandle()
    {
        // make sure to clean up old handles
        if ($this->handle !== null && feof($this->handle)) {
            $this->resetHandle();
        }

        // provision new handle
        if ($this->handle == null) {
            $params = $this->params;
            if (!empty($this->getResourceVersion())) {
                $params['resourceVersion'] = $this->getResourceVersion();
            }
            $query = http_build_query($params);
            $base = $this->getClient()->getConfig()->getServer().$this->endpoint;
            $url = $base;

            if (!empty($query)) {
                $parsed = parse_url($base);
                if (key_exists('query', $parsed) || substr($base, -1) == "?") {
                    $url .= '&'.$query;
                } else {
                    $url .= '?'.$query;
                }
            }
            $handle = @fopen($url, 'r', false, $this->getClient()->getStreamContext());
            if ($handle === false) {
                $e = error_get_last();
                throw new \Exception($e['message'], $e['type']);
            }
            stream_set_timeout($handle, 0, $this->getStreamTimeout());
            $this->handle = $handle;
        }

        return $this->handle;
    }
142304
public function help()
    {
        $builder = new ProcessBuilder(array('--extended-help'));
        $builder->setPrefix($this->config['bin']);
        $process = $builder->getProcess();

        $process->run();

        if ($process->isSuccessful()) {
            return $process->getOutput();
        }
    }
634325
public function get_handler()
    {
        $handler = new PrettyPageHandler();
            
        $handler->addDataTableCallback('$wp_query', [$this, 'add_query']);

        $handler->addDataTableCallback('$post', [$this, 'add_post']);

        $handler->addDataTableCallback('$wp', [$this, 'add_wp']);

        return $handler;
    }
405981
public function handleRequest()
    {
        // Create the request very early so the ResourceManagement has a chance to grab it:
        $request = Request::createFromEnvironment();
        $response = new Response();
        $this->componentContext = new ComponentContext($request, $response);

        $this->boot();
        $this->resolveDependencies();
        $response = $this->addPoweredByHeader($response);
        $this->componentContext->replaceHttpResponse($response);
        $baseUriSetting = $this->bootstrap->getObjectManager()->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.http.baseUri');
        if (!empty($baseUriSetting)) {
            $baseUri = new Uri($baseUriSetting);
            $request = $request->withAttribute(Request::ATTRIBUTE_BASE_URI, $baseUri);
            $this->componentContext->replaceHttpRequest($request);
        }

        $this->baseComponentChain->handle($this->componentContext);
        $response = $this->baseComponentChain->getResponse();

        $response->send();

        $this->bootstrap->shutdown(Bootstrap::RUNLEVEL_RUNTIME);
        $this->exit->__invoke();
    }
193387
protected function setUpTheBrowserEnvironment()
    {
        Browser::$baseUrl = $this->baseUrl();

        $this->prepareDirectories();

        Browser::$userResolver = function () {
            return $this->user();
        };
    }
229371
public function handleRequest()
    {
        try {
            $rtn = parent::handleRequest();

            if (extension_loaded('newrelic')) {
                $site = $this->toPhpName($this->config->get('site.name'));
                $controller = $this->toPhpName($this->route['controller']);
                $action = $this->toPhpName($this->route['action']);

                newrelic_name_transaction($site . '.' . $controller . '.' . $action);
            }
        } catch (HttpException\NotFoundException $ex) {
            $rtn = $this->handleHttpError($ex->getErrorCode());
        } catch (HttpException $ex) {
            if ((defined('CMS_ENV') && CMS_ENV == 'development') || array_key_exists('ex', $_GET)) {
                throw $ex;
            }

            $rtn = $this->handleHttpError($ex->getErrorCode());
        } catch (Exception $ex) {
            if ((defined('CMS_ENV') && CMS_ENV == 'development') || array_key_exists('ex', $_GET)) {
                throw $ex;
            }

            $rtn = $this->handleHttpError(500);
        }

        return $rtn;
    }
905741
public function admin_setup() {

		$pods = pods_api()->load_pods( array( 'fields' => false ) );

		$view = pods_v( 'view', 'get', 'all', true );

		// @codingStandardsIgnoreLine
		if ( empty( $pods ) && ! isset( $_GET['action'] ) ) {
			// @codingStandardsIgnoreLine
			$_GET['action'] = 'add';
		}

		// @codingStandardsIgnoreLine
		if ( 'pods-add-new' === $_GET['page'] ) {
			// @codingStandardsIgnoreLine
			if ( isset( $_GET['action'] ) && 'add' !== $_GET['action'] ) {
				pods_redirect(
					pods_query_arg(
						array(
							'page'   => 'pods',
							// @codingStandardsIgnoreLine
							'action' => $_GET['action'],
						)
					)
				);
			} else {
				// @codingStandardsIgnoreLine
				$_GET['action'] = 'add';
			}
			// @codingStandardsIgnoreLine
		} elseif ( isset( $_GET['action'] ) && 'add' === $_GET['action'] ) {
			pods_redirect(
				pods_query_arg(
					array(
						'page'   => 'pods-add-new',
						'action' => '',
					)
				)
			);
		}//end if

		$types = array(
			'post_type' => __( 'Post Type (extended)', 'pods' ),
			'taxonomy'  => __( 'Taxonomy (extended)', 'pods' ),
			'cpt'       => __( 'Custom Post Type', 'pods' ),
			'ct'        => __( 'Custom Taxonomy', 'pods' ),
			'user'      => __( 'User (extended)', 'pods' ),
			'media'     => __( 'Media (extended)', 'pods' ),
			'comment'   => __( 'Comments (extended)', 'pods' ),
			'pod'       => __( 'Advanced Content Type', 'pods' ),
			'settings'  => __( 'Custom Settings Page', 'pods' ),
		);

		$row = false;

		$pod_types_found = array();

		$fields = array(
			'label'       => array( 'label' => __( 'Label', 'pods' ) ),
			'name'        => array( 'label' => __( 'Name', 'pods' ) ),
			'type'        => array( 'label' => __( 'Type', 'pods' ) ),
			'storage'     => array(
				'label' => __( 'Storage Type', 'pods' ),
				'width' => '10%',
			),
			'field_count' => array(
				'label' => __( 'Number of Fields', 'pods' ),
				'width' => '8%',
			),
		);

		$total_fields = 0;

		foreach ( $pods as $k => $pod ) {
			if ( isset( $types[ $pod['type'] ] ) ) {
				if ( in_array(
					$pod['type'], array(
						'post_type',
						'taxonomy',
					), true
				) ) {
					if ( empty( $pod['object'] ) ) {
						if ( 'post_type' === $pod['type'] ) {
							$pod['type'] = 'cpt';
						} else {
							$pod['type'] = 'ct';
						}
					}
				}

				if ( ! isset( $pod_types_found[ $pod['type'] ] ) ) {
					$pod_types_found[ $pod['type'] ] = 1;
				} else {
					$pod_types_found[ $pod['type'] ] ++;
				}

				if ( 'all' !== $view && $view !== $pod['type'] ) {
					unset( $pods[ $k ] );

					continue;
				}

				$pod['real_type'] = $pod['type'];
				$pod['type']      = $types[ $pod['type'] ];
			} elseif ( 'all' !== $view ) {
				continue;
			}//end if

			$pod['storage'] = ucwords( $pod['storage'] );

			// @codingStandardsIgnoreLine
			if ( $pod['id'] == pods_v( 'id' ) && 'delete' !== pods_v( 'action' ) ) {
				$row = $pod;
			}

			$pod = array(
				'id'          => $pod['id'],
				'label'       => pods_v( 'label', $pod ),
				'name'        => pods_v( 'name', $pod ),
				'object'      => pods_v( 'object', $pod ),
				'type'        => pods_v( 'type', $pod ),
				'real_type'   => pods_v( 'real_type', $pod ),
				'storage'     => pods_v( 'storage', $pod ),
				'field_count' => count( $pod['fields'] ),
			);

			$total_fields += $pod['field_count'];

			$pods[ $k ] = $pod;
		}//end foreach

		if ( false === $row && 0 < pods_v( 'id' ) && 'delete' !== pods_v( 'action' ) ) {
			pods_message( 'Pod not found', 'error' );

			// @codingStandardsIgnoreLine
			unset( $_GET['id'], $_GET['action'] );
		}

		$ui = array(
			'data'             => $pods,
			'row'              => $row,
			'total'            => count( $pods ),
			'total_found'      => count( $pods ),
			'items'            => 'Pods',
			'item'             => 'Pod',
			'fields'           => array(
				'manage' => $fields,
			),
			'actions_disabled' => array( 'view', 'export' ),
			'actions_custom'   => array(
				'add'       => array( $this, 'admin_setup_add' ),
				'edit'      => array( $this, 'admin_setup_edit' ),
				'duplicate' => array(
					'callback'          => array( $this, 'admin_setup_duplicate' ),
					'restrict_callback' => array( $this, 'admin_setup_duplicate_restrict' ),
				),
				'reset'     => array(
					'label'             => __( 'Delete All Items', 'pods' ),
					'confirm'           => __( 'Are you sure you want to delete all items from this Pod? If this is an extended Pod, it will remove the original items extended too.', 'pods' ),
					'callback'          => array( $this, 'admin_setup_reset' ),
					'restrict_callback' => array( $this, 'admin_setup_reset_restrict' ),
					'nonce'             => true,
				),
				'delete'    => array( $this, 'admin_setup_delete' ),
			),
			'action_links'     => array(
				'add' => pods_query_arg(
					array(
						'page'   => 'pods-add-new',
						'action' => '',
						'id'     => '',
						'do'     => '',
					)
				),
			),
			'search'           => false,
			'searchable'       => false,
			'sortable'         => true,
			'pagination'       => false,
			'extra'            => array(
				'total' => ', ' . number_format_i18n( $total_fields ) . ' ' . _n( 'field', 'fields', $total_fields, 'pods' ),
			),
		);

		if ( 1 < count( $pod_types_found ) ) {
			$ui['views']            = array( 'all' => __( 'All', 'pods' ) );
			$ui['view']             = $view;
			$ui['heading']          = array( 'views' => __( 'Type', 'pods' ) );
			$ui['filters_enhanced'] = true;

			foreach ( $pod_types_found as $pod_type => $number_found ) {
				$ui['views'][ $pod_type ] = $types[ $pod_type ];
			}
		}

		pods_ui( $ui );
	}
702454
protected function setupConsoleCommands()
    {
        // Share dashboard:install command with the application.
        $this->app['dashboard::install'] = $this->app->share(function () {
            return new InstallerCommand();
        });

        // Share dashboard:setup command with the application.
        $this->app['dashboard::setup'] = $this->app->share(function () {
            return new SetupCommand();
        });

        // Share dashboard:fresh command with the application.
        $this->app['dashboard::fresh'] = $this->app->share(function () {
            return new FreshCommand();
        });

        // Share dashboard:uninstall command with the application.
        $this->app['dashboard::uninstall'] = $this->app->share(function () {
            return new UninstallCommand();
        });

        // Adds dashboard:install to the console kernel.
        $this->commands('dashboard::install');

        // Adds dashboard:setup to the console kernel.
        $this->commands('dashboard::setup');

        // Adds dashboard:fresh to the console kernel.
        $this->commands('dashboard::fresh');

        // Adds dashboard:uninstall to the console kernel.
        $this->commands('dashboard::uninstall');
    }