1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the skidata-library package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
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 WBW\Library\SkiData\Parser; |
13
|
|
|
|
14
|
|
|
use WBW\Library\Core\Helper\Argument\BooleanHelper; |
15
|
|
|
use WBW\Library\SkiData\Entity\SkiDataUser; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* SkiData user parser. |
19
|
|
|
* |
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
21
|
|
|
* @package WBW\Library\SkiData\Parser |
22
|
|
|
*/ |
23
|
|
|
class SkiDataUserParser extends AbstractSkiDataParser { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Constructor. |
27
|
|
|
*/ |
28
|
|
|
public function __construct() { |
29
|
|
|
parent::__construct(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Parse a SkiData user entity. |
34
|
|
|
* |
35
|
|
|
* @param SkiDataUser $entity The SkiData user entity. |
36
|
|
|
* @return string Returns the parsed SkiData user entity. |
37
|
|
|
*/ |
38
|
|
|
public function parseEntity(SkiDataUser $entity) { |
39
|
|
|
|
40
|
|
|
// Initialise the output. |
41
|
|
|
$output = []; |
42
|
|
|
|
43
|
|
|
$output[] = $this->encodeInteger($entity->getUserNumber(), 9); |
44
|
|
|
$output[] = $this->encodeInteger($entity->getCustomerNumber(), 9); |
45
|
|
|
$output[] = $this->encodeString($entity->getTitle(), 10); |
46
|
|
|
$output[] = $this->encodeString($entity->getSurname(), 25); |
47
|
|
|
$output[] = $this->encodeString($entity->getFirstname(), 25); |
48
|
|
|
$output[] = $this->encodeDate($entity->getDateBirth()); |
49
|
|
|
$output[] = $this->encodeString($entity->getParkingSpace(), 5); |
50
|
|
|
$output[] = $this->encodeString($entity->getRemarks(), 50); |
51
|
|
|
$output[] = $this->encodeDateTime($entity->getDatetimeLastModification()); |
52
|
|
|
$output[] = $this->encodeBoolean($entity->getDeletedRecord()); |
53
|
|
|
$output[] = $this->encodeString($entity->getIdentificationNumber(), 20); |
54
|
|
|
$output[] = $this->encodeBoolean($entity->getCheckLicensePlate()); |
55
|
|
|
$output[] = $this->encodeBoolean($entity->getPassageLicensePlatePermitted()); |
56
|
|
|
$output[] = $this->encodeBoolean($entity->getExcessTimesCreditCard()); |
57
|
|
|
$output[] = $this->encodeString($entity->getCreditCardNumber(), 20); |
58
|
|
|
$output[] = $this->encodeDate($entity->getExpiryDate()); |
59
|
|
|
$output[] = $this->encodeString($entity->getRemarks2(), 50); |
60
|
|
|
$output[] = $this->encodeString($entity->getRemarks3(), 50); |
61
|
|
|
$output[] = $this->encodeString($entity->getDivision(), 50); |
62
|
|
|
$output[] = $this->encodeString($entity->getEmail(), 120); |
63
|
|
|
$output[] = $this->encodeBoolean($entity->getGroupCounting()); |
64
|
|
|
$output[] = $this->encodeInteger($entity->getETicketTypeP(), 1); |
65
|
|
|
$output[] = $this->encodeString($entity->getETicketEmailTelephone(), 120); |
66
|
|
|
$output[] = $this->encodeInteger($entity->getETicketAuthentication(), 1); |
67
|
|
|
$output[] = $this->encodeInteger($entity->getETicketServiceTyp(), 1); |
68
|
|
|
$output[] = $this->encodeInteger($entity->getETicketServiceArt(), 1); |
69
|
|
|
|
70
|
|
|
// Return the output. |
71
|
|
|
return implode(";", $output); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Parse a line. |
76
|
|
|
* |
77
|
|
|
* @param string $line The line. |
78
|
|
|
* @return SkiDataUser Returns a SkiData user entity. |
79
|
|
|
*/ |
80
|
|
|
public function parseLine($line) { |
81
|
|
|
|
82
|
|
|
// Split the line. |
83
|
|
|
$data = explode(";", $line); |
84
|
|
|
$i = 0; |
85
|
|
|
|
86
|
|
|
// Initialize the entity. |
87
|
|
|
$entity = new SkiDataUser(); |
88
|
|
|
|
89
|
|
|
$entity->setUserNumber($this->decodeInteger($data[$i++])); |
90
|
|
|
$entity->setCustomerNumber($this->decodeInteger($data[$i++])); |
91
|
|
|
$entity->setTitle($this->decodeString($data[$i++])); |
92
|
|
|
$entity->setSurname($this->decodeString($data[$i++])); |
93
|
|
|
$entity->setFirstname($this->decodeString($data[$i++])); |
94
|
|
|
$entity->setDateBirth($this->decodeDate($data[$i++])); |
95
|
|
|
$entity->setParkingSpace($this->decodeString($data[$i++])); |
96
|
|
|
$entity->setRemarks($this->decodeString($data[$i++])); |
97
|
|
|
$entity->setDatetimeLastModification($this->decodeDateTime($data[$i++])); |
98
|
|
|
$entity->setDeletedRecord(BooleanHelper::parseString($data[$i++])); |
99
|
|
|
$entity->setIdentificationNumber($this->decodeString($data[$i++])); |
100
|
|
|
$entity->setCheckLicensePlate(BooleanHelper::parseString($data[$i++])); |
101
|
|
|
$entity->setPassageLicensePlatePermitted(BooleanHelper::parseString($data[$i++])); |
102
|
|
|
$entity->setExcessTimesCreditCard(BooleanHelper::parseString($data[$i++])); |
103
|
|
|
$entity->setCreditCardNumber($this->decodeString($data[$i++])); |
104
|
|
|
$entity->setExpiryDate($this->decodeDate($data[$i++])); |
105
|
|
|
$entity->setRemarks2($this->decodeString($data[$i++])); |
106
|
|
|
$entity->setRemarks3($this->decodeString($data[$i++])); |
107
|
|
|
$entity->setDivision($this->decodeString($data[$i++])); |
108
|
|
|
$entity->setEmail($this->decodeString($data[$i++])); |
109
|
|
|
$entity->setGroupCounting(BooleanHelper::parseString($data[$i++])); |
110
|
|
|
$entity->setETicketTypeP($this->decodeInteger($data[$i++])); |
111
|
|
|
$entity->setETicketEmailTelephone($this->decodeString($data[$i++])); |
112
|
|
|
$entity->setETicketAuthentication($this->decodeInteger($data[$i++])); |
113
|
|
|
$entity->setETicketServiceTyp($this->decodeInteger($data[$i++])); |
114
|
|
|
$entity->setETicketServiceArt($this->decodeInteger($data[$i++])); |
115
|
|
|
|
116
|
|
|
// Return the entity. |
117
|
|
|
return $entity; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
} |
121
|
|
|
|