/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/CS_IA_Mattew/Inquiry.class.php
 1 <?php
 2 spl_autoload_register(function ($class_name) { //taken from https://www.php.net/manual/en/language.oop5.autoload.php
 3     include $class_name . '.class.php';
 4 });
 5 class Inquiry {
 6     private $customer;
 7     private $destination;
 8     private $dayPlans = array();
 9     private $dateAndTimeOfInquiry;
10     private $IPAddress;
11     private $arrivalDate;
12     private $departureDate;
13     private $numberOfDays;
14     private $numberOfNights;
15     private $hotelRating;
16     public function __construct($dateAndTimeOfInquiry, $IPAddress, $arrivalDate, $departureDate, $hotelRating){
17         $this->dateAndTimeOfInquiry =  $dateAndTimeOfInquiry;
18         $this->IPAddress = $IPAddress;
19         $this->arrivalDate = $arrivalDate;
20         $this->departureDate = $departureDate;
21         $this->numberOfDays = $this->setNumberOfDays();
22         $this->numberOfNights = $this->setNumberOfNights();
23         $this->hotelRating = $hotelRating;
24     }
25     public function setNumberOfDays(){ // https://stackoverflow.com/questions/2040560/finding-the-number-of-days-between-two-dates#:~:text=If%20your%20dates%20are%20in,to%20the%20next%20full%20day.
26         $arrive = strtotime($this->arrivalDate);
27         $depart = strtotime($this->departureDate);
28         $days_between = round(abs($depart - $arrive) / (60 * 60  * 24));
29         return $days_between + 1;
30     }
31     public function setNumberOfNights(){
32         return $this->numberOfDays - 1;
33     }
34     //check this one
35     public function getIPaddress(){
36         if(isset($this->IPAddress)){
37             return $this->IPAddress;
38         }
39     }
40     public function getDateAndTimeOfInquiry(){
41         if(isset($this->dateAndTimeOfInquiry)){
42             return $this->dateAndTimeOfInquiry;
43         }
44     }
45     public function getArrivalDate(){
46         if(isset($this->arrivalDate)){
47             return $this->arrivalDate;
48         }
49     }
50     public function getDepartureDate(){
51         if(isset($this->departureDate)){
52             return $this->departureDate;
53         }
54     }
55 
56     public function getNumberOfDays(){
57         if(isset($this->numberOfDays)){
58             return $this->numberOfDays;
59         }
60     }
61     public function getNumberOfNights(){
62         if(isset($this->numberOfNights)){
63             return $this->numberOfNights;
64         }
65     }
66 
67     public function getHotelRating(){
68         if(isset($this->hotelRating)){
69             return $this->hotelRating;
70         }
71     }
72 
73     public function setCustomer($customer){
74         if(isset($customer)){
75             $this->customer = $customer;
76         }
77     }
78 
79     public function setDestination($destination){
80         if(isset($destination)){
81             $this->destination = $destination;
82         }
83     }
84 
85     public function setDayplans($dayPlans){
86         if(isset($dayPlans)){
87             $this->dayPlans = $dayPlans;
88         }
89     }
90 }
91 
92 
93