jeancsil /
flight-spy
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @author Jean Silva <[email protected]> |
||
| 4 | * @license MIT |
||
| 5 | */ |
||
| 6 | namespace Jeancsil\FlightSpy\Api\DataTransfer; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @see http://business.skyscanner.net/portal/en-GB/Documentation/FlightsLivePricingList#createsession |
||
| 10 | * |
||
| 11 | * [name] [mandatory?] [description] |
||
| 12 | * apiKey Yes The API Key to identify the customer String Must be a valid API Key |
||
| 13 | * country Yes The user’s market country String ISO country code, or specified location schema |
||
| 14 | * currency Yes The user’s currency String ISO currency code |
||
| 15 | * locale Yes The user’s localization preference String ISO locale code (language and country) |
||
| 16 | * originplace Yes The origin city or airport String Specified location schema, or Skyscanner Rnid |
||
| 17 | * destinationplace Yes The destination city or airport String Specified location schema, or Skyscanner Rnid |
||
| 18 | * outbounddate Yes The departure date Date Formatted as YYYY-mm-dd |
||
| 19 | * inbounddate No The return date Date Formatted as YYYY-mm-dd |
||
| 20 | * locationschema No The code schema used for locations String The supported codes are below |
||
| 21 | * cabinclass No The Cabin Class String The supported codes are below |
||
| 22 | * adults Yes The number of adults Int Defaults to 1 if not specified. Maximum 8 |
||
| 23 | * children No The number of children Int Defaults to 0, maximum 8 |
||
| 24 | * infants No The number of infants Int Defaults to 0, cannot exceed adults |
||
| 25 | */ |
||
| 26 | class SessionParameters |
||
| 27 | { |
||
| 28 | /** |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | public $apiKey; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string |
||
| 35 | */ |
||
| 36 | public $country; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | public $currency; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | public $locale; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var string |
||
| 50 | */ |
||
| 51 | public $originPlace; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string |
||
| 55 | */ |
||
| 56 | public $destinationPlace; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string |
||
| 60 | */ |
||
| 61 | public $outboundDate; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var integer |
||
| 65 | */ |
||
| 66 | public $adults; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | public $inboundDate; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var string |
||
| 75 | */ |
||
| 76 | public $locationSchema; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string |
||
| 80 | */ |
||
| 81 | public $cabinClass; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var integer |
||
| 85 | */ |
||
| 86 | public $children; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var integer |
||
| 90 | */ |
||
| 91 | public $infants; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var float |
||
| 95 | */ |
||
| 96 | private $maxPrice; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 100 | */ |
||
| 101 | public function toArray() |
||
| 102 | { |
||
| 103 | $params = [ |
||
| 104 | 'apiKey' => $this->apiKey, |
||
| 105 | 'country' => $this->country, |
||
| 106 | 'currency' => $this->currency, |
||
| 107 | 'locale' => $this->locale, |
||
| 108 | 'originplace' => $this->originPlace, |
||
| 109 | 'destinationplace' => $this->destinationPlace, |
||
| 110 | 'outbounddate' => $this->outboundDate, |
||
| 111 | 'adults' => $this->adults |
||
| 112 | ]; |
||
| 113 | |||
| 114 | if ($this->inboundDate) { |
||
| 115 | $params['inbounddate'] = $this->inboundDate; |
||
| 116 | } |
||
| 117 | |||
| 118 | if ($this->locationSchema) { |
||
| 119 | $params['locationschema'] = $this->locationSchema; |
||
| 120 | } |
||
| 121 | |||
| 122 | if ($this->cabinClass) { |
||
| 123 | $params['cabinclass'] = $this->cabinClass; |
||
| 124 | } |
||
| 125 | |||
| 126 | if ($this->infants) { |
||
| 127 | $params['infants'] = $this->infants; |
||
| 128 | } |
||
| 129 | |||
| 130 | if ($this->children) { |
||
| 131 | $params['children'] = $this->children; |
||
| 132 | } |
||
| 133 | |||
| 134 | return $params; |
||
| 135 | } |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @return float |
||
| 139 | */ |
||
| 140 | public function getMaxPrice() |
||
| 141 | { |
||
| 142 | return $this->maxPrice; |
||
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @param float $maxPrice |
||
| 147 | */ |
||
| 148 | public function setMaxPrice($maxPrice) |
||
| 149 | { |
||
| 150 | $this->maxPrice = (float) $maxPrice; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @return string |
||
| 155 | */ |
||
| 156 | public function __toString() |
||
| 157 | { |
||
| 158 | return sprintf( |
||
| 159 | '%s <-> %s out %s in %s %s %s. Adults/Kids/Infants: %d/%d/%d', |
||
| 160 | $this->originPlace, |
||
| 161 | $this->destinationPlace, |
||
| 162 | (new \DateTime($this->outboundDate))->format('d.m.Y'), |
||
| 163 | (new \DateTime($this->inboundDate))->format('d.m.Y'), |
||
| 164 | $this->currency, |
||
| 165 | $this->maxPrice, |
||
| 166 | $this->adults, |
||
| 167 | $this->children, |
||
| 168 | $this->infants |
||
| 169 | ); |
||
| 170 | } |
||
| 171 | } |
||
| 172 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.