1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Amplexor\XConnect library |
4
|
|
|
* |
5
|
|
|
* @license http://opensource.org/licenses/MIT |
6
|
|
|
* @link https://github.com/amplexor-drupal/xconnect/ |
7
|
|
|
* @version 1.0.0 |
8
|
|
|
* @package Amplexor.XConnect |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Amplexor\XConnect\Response; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class representing the delivery details. |
18
|
|
|
*/ |
19
|
|
|
class Info |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* The XML. |
23
|
|
|
* |
24
|
|
|
* @var \SimpleXMLElement |
25
|
|
|
*/ |
26
|
|
|
private $xml; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Constructor. |
30
|
|
|
* |
31
|
|
|
* @param string $rawXml |
32
|
|
|
* The raw XML as received from the translation service. |
33
|
|
|
*/ |
34
|
21 |
|
public function __construct($rawXml) |
35
|
|
|
{ |
36
|
21 |
|
$this->xml = new \SimpleXMLElement($rawXml); |
37
|
21 |
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Get the ID. |
41
|
|
|
* |
42
|
|
|
* @return string |
43
|
|
|
* The DeliveryId property. |
44
|
|
|
*/ |
45
|
6 |
|
public function getId() |
46
|
|
|
{ |
47
|
6 |
|
return (string) $this->xml->DeliveryId; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Get the Date. |
52
|
|
|
* |
53
|
|
|
* @return DateTime |
54
|
|
|
* The DeliveryDate property. |
55
|
|
|
*/ |
56
|
3 |
|
public function getDate() |
57
|
|
|
{ |
58
|
3 |
|
return new \DateTime((string) $this->xml->DeliveryDate); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the status. |
63
|
|
|
* |
64
|
|
|
* @return string |
65
|
|
|
* The DeliveryStatus property. |
66
|
|
|
*/ |
67
|
3 |
|
public function getStatus() |
68
|
|
|
{ |
69
|
3 |
|
return (string) $this->xml->DeliveryStatus; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Get the reference. |
74
|
|
|
* |
75
|
|
|
* @return string |
76
|
|
|
* The Client reference related to this translation. |
77
|
|
|
*/ |
78
|
3 |
|
public function getReference() |
79
|
|
|
{ |
80
|
3 |
|
return (string) $this->xml->WOClientReference; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Get the person who issued the translation. |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
* The IssuedBy property. |
88
|
|
|
*/ |
89
|
3 |
|
public function getIssuedBy() |
90
|
|
|
{ |
91
|
3 |
|
return (string) $this->xml->IssuedBy; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Get an array with info about the files within the translation delivery. |
96
|
|
|
* |
97
|
|
|
* @return InfoFiles |
98
|
|
|
* Array with info for each file. |
99
|
|
|
*/ |
100
|
3 |
|
public function getFiles() |
101
|
|
|
{ |
102
|
3 |
|
return new InfoFiles($this->xml->DeliveryFiles); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|