From 0965d62be00a7820f97284704dc71f37e661b412 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Sun, 26 Aug 2018 01:38:28 -0400 Subject: Begin migration to Rust; Add actix-web, diesel as main dependencies --- private/View/Main.php | 104 ------------------------------------------------ private/View/Output.php | 28 ------------- 2 files changed, 132 deletions(-) delete mode 100644 private/View/Main.php delete mode 100644 private/View/Output.php (limited to 'private/View') diff --git a/private/View/Main.php b/private/View/Main.php deleted file mode 100644 index c51e91f..0000000 --- a/private/View/Main.php +++ /dev/null @@ -1,104 +0,0 @@ -query = Controller\Controller::createQuery( - explode('/', trim($_SERVER['PATH_INFO'] ?? '/api', '/')), - $_SERVER['REQUEST_METHOD'], - $this->generateContent($_SERVER['REQUEST_METHOD']) - ); - - return $this; - } - - /** - * Generates the content of the query based on the request type. - * - * @param string $request The request method on which to base the content. - * - * @return array - */ - public function generateContent (string $request): array - { - $content; - switch ($request) { - case "GET": // GET should always be empty - case "POST": // POST contains moves, account info, etc. - default: - $content = $_REQUEST; - } - return $content; - } - - /** - * Communicates with the controller to generate the output. - * - * @return string - */ - public function generateResult (): string - { - $path = $this->query->getPath(); - if (count($path) >= 1 && $path[0] === "api" && count($path) >= 2) { - switch (strtolower($path[1])) { - case "callback": - $this->result = Controller\Controller::createResult( - "CALLBACK", - array( - "path" => $path, - "request" => $this->query->getRequest(), - "content" => $this->query->getContent() - ) - ); - break; - default: - $this->result = Controller\Controller::createResult("NOT_UNDERSTOOD", array($path)); - break; - } - } else { - $this->result = Controller\Controller::createResult("NOT_UNDERSTOOD", array($path)); - } - - return self::generateOutput($this->result); - } - - /** - * Creates output of the result based on the defined constant TYPE. - * - * @param Model\Result $result The result to be sent to the client. - * - * @return string - */ - public static function generateOutput (Model\Result $result): string - { - $type = self::TYPE; - return Output::$type($result); - } -} diff --git a/private/View/Output.php b/private/View/Output.php deleted file mode 100644 index af9975e..0000000 --- a/private/View/Output.php +++ /dev/null @@ -1,28 +0,0 @@ - $result->getResultType(), - "Content" => $result->getResult() - )); - } -} -- cgit