-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accidently deleted code Removing View folder and just creating another app-view for fetching API
- Loading branch information
1 parent
efbc5c2
commit 6edf380
Showing
2 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); // Declaring strict type | ||
|
||
// Autoload function | ||
|
||
spl_autoload_register(function($class){ | ||
require __DIR__ ."/src/$class.php"; | ||
}); | ||
|
||
set_error_handler("ErrorHandler::handleError"); //calling error handle to display error in JSON format | ||
set_exception_handler("ErrorHandler::handleException"); // Class will loaded automatically | ||
|
||
header("Content-type: application/json; charset=UTF-8"); // Setting Header type to JSON format | ||
|
||
$parts = explode("/", $_SERVER['REQUEST_URI']); // Getting URL | ||
|
||
$connection = new connection("localhost", "u498926327_tripbuilder","u498926327_pmtripbuilder","]/Vstmy=T6"); // Calling Connection class to connect with Database | ||
|
||
// Getting Second part of url since the first part is Application name | ||
|
||
if($parts[1] == "trips") | ||
{ | ||
$id = $parts[2] ?? null; | ||
$flightGateway = new flightGateway($connection); //Calling flightGatway with connection variable | ||
$flightcontroller = new flightsController($flightGateway); // Calling flightController class with gatway variable | ||
$flightcontroller->processRequest($_SERVER['REQUEST_METHOD'], $id); //sending Method with id in proceess Request function | ||
} | ||
if($parts[1] == "onewaytrip") | ||
{ | ||
$oneWayGateway = new oneWayGateway($connection); //Calling flightGatway with connection variable | ||
$oneWaycontroller = new oneWayController($oneWayGateway); // Calling flightController class with gatway variable | ||
$oneWaycontroller->processRequest($_SERVER['REQUEST_METHOD']); //sending Method with id in proceess Request function | ||
} | ||
if($parts[1] == "roundtrip") | ||
{ | ||
$id = $parts[2] ?? null; | ||
$roundTripGateway = new roundTripGateway($connection); //Calling flightGatway with connection variable | ||
$roundTripcontroller = new roundTripController($roundTripGateway); // Calling flightController class with gatway variable | ||
$roundTripcontroller->processRequest($_SERVER['REQUEST_METHOD'], $id); //sending Method with id in proceess Request function | ||
} | ||
if($parts[1] == "airlines") | ||
{ | ||
$id = $parts[3] ?? null; | ||
$airlineGateway = new airlineGateway($connection); //Calling Airline Gateway with connection variable | ||
$airlinescontroller = new airlinesController($airlineGateway); // Calling AirlineController class with gatway variable | ||
$airlinescontroller->processRequest($_SERVER['REQUEST_METHOD'], $id); //sending Method with id in proceess Request function | ||
|
||
} | ||
if($parts[1] == "airports") | ||
{ | ||
$id = $parts[2] ?? null; | ||
$airportGateway = new airportGateway($connection); //Calling Airport Gateway with connection variable | ||
$airportcontroller = new airportController($airportGateway); // Calling Airport class with gatway variable | ||
$airportcontroller->processRequest($_SERVER['REQUEST_METHOD'], $id); //sending Method with id in proceess Request function | ||
|
||
} | ||
|
||
|
||
|
||
?> |
This file was deleted.
Oops, something went wrong.