1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Passbook package. |
5
|
|
|
* |
6
|
|
|
* (c) Eymen Gunay <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Passbook\Type; |
13
|
|
|
|
14
|
|
|
use Passbook\Pass; |
15
|
|
|
use Passbook\Pass\Structure; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* BoardingPass |
19
|
|
|
* |
20
|
|
|
* @author Eymen Gunay <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
class BoardingPass extends Pass |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Pass type |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected $type = 'boardingPass'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Pass structure |
32
|
|
|
* @var Structure |
33
|
|
|
*/ |
34
|
|
|
protected $structure; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Type of transit. Must be one of the following values: |
38
|
|
|
* PKTransitTypeAir, PKTransitTypeBoat, PKTransitTypeBus, PKTransitTypeGeneric, PKTransitTypeTrain |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $transitType; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
public const TYPE_AIR = 'PKTransitTypeAir'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
public const TYPE_BOAT = 'PKTransitTypeBoat'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
public const TYPE_BUS = 'PKTransitTypeBus'; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
public const TYPE_GENERIC = 'PKTransitTypeGeneric'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
public const TYPE_TRAIN = 'PKTransitTypeTrain'; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Class constructor |
70
|
|
|
* |
71
|
|
|
* @param string $serialNumber |
72
|
|
|
* @param string $description |
73
|
|
|
* @param string $transitType |
74
|
|
|
*/ |
75
|
1 |
|
public function __construct($serialNumber, $description, $transitType = self::TYPE_GENERIC) |
76
|
|
|
{ |
77
|
|
|
// Required for boarding passes; otherwise not allowed |
78
|
1 |
|
$this->transitType = $transitType; |
79
|
|
|
// Call parent |
80
|
1 |
|
parent::__construct($serialNumber, $description); |
81
|
|
|
} |
82
|
|
|
|
83
|
1 |
|
public function toArray() |
84
|
|
|
{ |
85
|
1 |
|
$array = parent::toArray(); |
86
|
1 |
|
$array[$this->getType()]['transitType'] = $this->transitType; |
87
|
|
|
|
88
|
1 |
|
return $array; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|