handle the request

@return Response
@throws HttpForbiddenException
774064
public function handler(): Response
    {
        $data = $this->validate([
            'username' => [
                new NotBlank()
            ],
            'email' => [
                new NotBlank(),
                new Email()
            ],
            'name' => [
                new NotBlank()
            ],
            'gender' => [
                new NotBlank()
            ],
            'role' => [
                new NotBlank()
            ]
        ]);
        $data['role'] = Role::findBy(['slug' => $data['role']]);
        if (!$data['role']) {
            throw new HttpForbiddenException();
        }
        $member = new Member($data);
        $member->save();
        if ($this->request->get('activate', false) === true) {
            app()->dispatch(new WelcomeMessageNeedsToBeSent($member));
        }
        $this->log('info', 'Create a member [' . $member->getUsername() . ']');
        return response();
    }
1201662
public function handle()
    {
        try {
            $query = $this->di->request->getRoute();
            $parts = $this->di->request->getRouteParts();

            // Match predefined routes
            foreach ($this->routes as $route) {
                if ($route->match($query)) {
                    return $route->handle();
                }
            }

            // Default handling route as :controller/:action/:params using the dispatcher
            $dispatcher = $this->di->dispatcher;
            $dispatcher->setControllerName(isset($parts[0]) ? $parts[0] : 'index');

            if ($dispatcher->isValidController()) {
                $dispatcher->setActionName(isset($parts[1]) ? $parts[1] : 'index');

                $params = [];
                if (isset($parts[2])) {
                    $params = $parts;
                    array_shift($params);
                    array_shift($params);
                }
                $dispatcher->setParams($params);

                if ($dispatcher->isCallable()) {
                    return $dispatcher->dispatch();
                }
            }

            // Use the "catch-all" route
            if ($this->defaultRoute) {
                return $this->defaultRoute->handle();
            }

            // No route was matched
            $this->handleInternal('404');
        } catch (\Exception $e) {
            // Exception codes can match a route for a http status code
            $code = $e->getCode();
            $statusCodes = [403, 404, 500];
            if (in_array($code, $statusCodes)) {
                $this->di->flash->setMessage($e->getMessage());
                $this->handleInternal($code);
            } else {
                throw $e;
            }
        }
    }
1102076
public function handle()
    {
        // get information about the REST-request
        $this->get();

        if ($this->requestMethod === 'GET' && $this->typo3Cache->hasCacheEntry($this->url, $_GET)) {
            return $this->handleRequestByTypo3Cache();
        }

        // if no cache exist: restler should handle the request
        return parent::handle();
    }
1293006
public function handle()
    {
        chdir(public_path());

        $this->line("<info>Laravel development server started:</info> <http://{$this->host()}:{$this->port()}>");

        passthru($this->serverCommand(), $status);

        if ($status && $this->canTryAnotherPort()) {
            $this->portOffset += 1;

            return $this->handle();
        }

        return $status;
    }
518996
public function handler(): Response
    {
        $memberData = $this->validate([
            'email' => [
                new NotBlank(),
                new Email()
            ]
        ]);
        $data = $this->validate([
            'password' => [
                new NotBlank()
            ],
            'passwordConfirmation' => [
                new NotBlank()
            ],
            'passwordOrigin' => [
                new NotBlank()
            ]
        ]);
        if (!preg_match('/[a-zA-Z]/', $data['passwordOrigin'])
            || !preg_match('/[0-9]/', $data['passwordOrigin'])
            || !preg_match('/[^a-zA-Z0-9]/', $data['passwordOrigin'])
            || strlen($data['passwordOrigin']) < 8) {
            throw new HttpForbiddenException('密码太弱，需至少8位并且包含字母数字以及字符');
        }
        if (sha1($data['passwordOrigin']) !== $data['password']
            || $data['password'] !== $data['passwordConfirmation']) {
            throw new HttpForbiddenException('两次输入的密码不一样');
        }
        $token = PasswordResetToken::find($this->getParameter('token'));
        $member = Member::findBy($memberData);
        if (!$token || !$token->isValid() || !$member || $token->getMember()->getId() !== $member->getId()) {
            throw new HttpForbiddenException();
        }
        $token->delete();
        $member->password($data['password'])
            ->save();
        $this->auth(null);
        $this->log('info', '[' . $memberData['email'] . '] reset password');
        return response();
    }
934929
public static function handleCurrentRequest() {
		try {
			CLIRoute::initialize();
			static::$mainRequest = static::generateFromEnvironment();
			$response = static::$mainRequest->process();
		} catch( \Exception $e ) {
			$response = CLIResponse::generateFromException($e);
		}
		$response->process();
		exit($response->getCode());
	}
1045853
public function handler(): Response
    {
        if ($this->redirect) {
            return response(null, 302, ['Location' => $this->redirect]);
        } elseif ($this->request->query->has('error')) {
            return view('error.twig', [
                'error' => $this->request->query->get('error'),
                'message' => $this->request->query->get('message')
            ]);
        } else {
            $this->addAssets();
            return view($this->template, $this->data);
        }
    }
729269
protected function handlePOST()
    {
        /** @var BaseSystemModel $modelClass */
        $modelClass = static::$model;

        if (!empty($this->resource)) {
            throw new BadRequestException('Create record by identifier not currently supported.');
        }

        $records = ResourcesWrapper::unwrapResources($this->getPayloadData());
        if (empty($records)) {
            throw new BadRequestException('No record(s) detected in request.' . ResourcesWrapper::getWrapperMsg());
        }

        $result = $modelClass::bulkCreate($records, $this->request->getParameters());

        $asList = $this->request->getParameterAsBool(ApiOptions::AS_LIST);
        $idField = $this->request->getParameter(ApiOptions::ID_FIELD, static::getResourceIdentifier());
        $result = ResourcesWrapper::cleanResources($result, $asList, $idField, ApiOptions::FIELDS_ALL);

        return ResponseFactory::create($result, null, ServiceResponseInterface::HTTP_CREATED);
    }
1290083
protected function _handle()
    {
        $ids = $this->_processIds();
        $subject = $this->_constructSubject($ids);

        $event = $this->_trigger('beforeBulk', $subject);
        if ($event->isStopped()) {
            return $this->_stopped($subject);
        }

        if ($this->_bulk($subject->query)) {
            $this->_success($subject);
        } else {
            $this->_error($subject);
        }

        return $this->_redirect($subject, ['action' => 'index']);
    }
80997
public function handle()
    {
        switch (strtolower($_SERVER['QUERY_STRING'])){
        case 'wsdl':
            $this->intoStruct();
            $this->handleWSDL();
            break;
        case 'disco':
            $this->intoStruct();
            $this->handleDISCO();
            break;
        default:
            $this->intoStruct();
            if (isset($_SERVER['HTTP_SOAPACTION'])) {
                $this->createServer();
            } elseif (isset($_REQUEST['svc'])) {
               	$this->handleHTTP(); // by JG
            } else {
                $this->handleINFO();
            }
            break;
        }
    }
373854
public function handle()
    {
        $this->bootstrap();

        $middleware = array_merge(
            $this->middleware,
            $this->router->getRouteMiddleware()
        );

        return $this->sendThroughPipeline($middleware, function () {
            return $this->router->execute($this);
        });
    }
1189226
public function handle()
    {
        $this->params = $this->getParams();

        $request = substr($this->request->getRequestUri(), strlen($this->request->getBaseUrl()) + 1);

        if (substr($request, 0, 7) == 'themes/') {
            return $this->serveTheme(substr($request, 6));
        }

        if ($request == '') {
            $request = $this->daux->tree->getIndexPage()->getUri();
        }

        return $this->getPage($request);
    }
1295084
private function handle(){
        $params = [
            "start"     => null,
            "finish"    => null,
            "response"  => null,
            "error"     => null,
        ];

        try{
            $params["start"]    = microtime(true);
            $params["response"] = $this->handler->handle($this->request);
        }catch(\Throwable $e){
            $params["error"]    = $e;
            $this->error        = $e;
        }finally{
            $params["finish"]   = microtime(true);
        }

        $this->event(new Event("response.handle.after", $params));

        return $params["response"];
    }
1209579
public function send(): HttpResponse {
        $ch = $this->createCurl();
        $response = $this->execCurl($ch);
        curl_close($ch);

        return $response;
    }
884938
public function handler(): Response
    {
        $bulletin = (new Bulletin())
            ->title(date('Ymd', time()) . '公告')
            ->content('全体 ' . Config::get('name') . ' 成员:')
            ->save();
        $this->log('info', 'Create a bulletin [' . $bulletin->getId() . ']');
        return response([
            'id' => $bulletin->getId()
        ]);
    }
766775
public function handler(): Response
    {
        $extension = Extension::findBy([
            'vendor' => $this->getParameter('vendor'),
            'package' => $this->getParameter('package')
        ]);
        if (!$extension) {
            throw new HttpForbiddenException();
        }
        if ($this->request->get('activation') === true) {
            $extension->activate();
            $this->log('info', 'Activate extension [' . $extension->getPackage() . ']');
        } else {
            $extension->deactivate();
            $this->log('info', 'Deactivate extension [' . $extension->getPackage() . ']');
        }
        return response();
    }
88516
public function send()
    {
        try {
            $response = $this->guzzleClient->request($this->method, $this->uri, $this->options);
        } catch (ClientException $e) {
            $this->handleApiException($e->getResponse()->getBody()->getContents());
        }

        return $this->getBody($response);
    }