src/User/src/Handler/UserHandler.php
/**
     * Create user
     *
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
Create user
@param ServerRequestInterface $request
@return ResponseInterface
Create user @param ServerRequestInterface $request @return ResponseInterface
public function post(ServerRequestInterface $request): ResponseInterface
    {
        $inputFilter = (new CreateUserInputFilter())->getInputFilter();
        $inputFilter->setData($request->getParsedBody());
        if (!$inputFilter->isValid()) {
            return $this->errorResponse($inputFilter->getMessages());
        }
        try {
            $user = $this->userService->createUser($inputFilter->getValues());
            if ($user->getStatus() === User::STATUS_PENDING) {
                $this->userService->sendActivationMail($user);
            } else {
                $this->userService->sendWelcomeMail($user);
            }
            return $this->createResponse($request, $user);
        } catch (Throwable $exception) {
            return $this->errorResponse($exception->getMessage());
        }
    }
public function post ( ServerRequestInterface $ request ) : ResponseInterface { $ inputFilter = ( new CreateUserInputFilter ( ) ) -> getInputFilter ( ) ; $ inputFilter -> setData ( $ request -> getParsedBody ( ) ) ; if ( ! $ inputFilter -> isValid ( ) ) { return $ this -> errorResponse ( $ inputFilter -> getMessages ( ) ) ; } try { $ user = $ this -> userService -> createUser ( $ inputFilter -> getValues ( ) ) ; if ( $ user -> getStatus ( ) === User :: STATUS_PENDING ) { $ this -> userService -> sendActivationMail ( $ user ) ; } else { $ this -> userService -> sendWelcomeMail ( $ user ) ; } return $ this -> createResponse ( $ request , $ user ) ; } catch ( Throwable $ exception ) { return $ this -> errorResponse ( $ exception -> getMessage ( ) ) ; } }
Create user
 @param ServerRequestInterface $request
 @return ResponseInterface
Create user @param ServerRequestInterface $request @return ResponseInterface