1 | <?php |
||
21 | class Request |
||
22 | { |
||
23 | /** |
||
24 | * The order that is part of the request. |
||
25 | * |
||
26 | * @var Order |
||
27 | */ |
||
28 | private $order; |
||
29 | |||
30 | /** |
||
31 | * The files that are part of the request. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private $files = array(); |
||
36 | |||
37 | /** |
||
38 | * The content that is part of the request. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $content = array(); |
||
43 | |||
44 | |||
45 | /** |
||
46 | * Create a new request by passing the configuration to it. |
||
47 | * |
||
48 | * @param string $sourceLanguage |
||
49 | * The source language for the request. |
||
50 | * @param array $config |
||
51 | * The configuration for the request: |
||
52 | * - clientId : The client ID to order the translations for. |
||
53 | * - orderNamePrefix : The order gets by default the following name: |
||
54 | * translation_order_<date as YmdHis><microseconds as 3 digits>. |
||
55 | * You can override the "translation_order_" with your own prefix. |
||
56 | * (optional). |
||
57 | * - templateId : The translation template ID. (optional). |
||
58 | * - dueDate : What is the deadline for the file(s) to be translated. |
||
59 | * The deadline should be set in days from the moment the translation |
||
60 | * is ordered. (optional, default 0). |
||
61 | * - issuedBy : The email address of the, by the translation known, issuer |
||
62 | * of the translation. |
||
63 | * - isConfidential : Is the content for the translation confidential? |
||
64 | * (optional, default false). |
||
65 | * - needsConfirmation : Should there be a conformation send when the |
||
66 | * translation is ready? (optional, default true). |
||
67 | * - needsQuotation : Should a quotation be created and send before the |
||
68 | * translation is performed? (optional, default false). |
||
69 | */ |
||
70 | 18 | public function __construct($sourceLanguage, array $config) |
|
74 | |||
75 | /** |
||
76 | * Get the order object from the request. |
||
77 | * |
||
78 | * @return Order |
||
79 | * The order object. |
||
80 | */ |
||
81 | 18 | public function getOrder() |
|
85 | |||
86 | /** |
||
87 | * Add a translation target language for the request. |
||
88 | * |
||
89 | * @param string $language |
||
90 | * The language to translate the request to. |
||
91 | */ |
||
92 | 3 | public function addTargetLanguage($language) |
|
96 | |||
97 | /** |
||
98 | * Add a translation instruction. |
||
99 | * |
||
100 | * @param string $instruction |
||
101 | * The instruction to add to the request. |
||
102 | */ |
||
103 | 3 | public function addInstruction($instruction) |
|
107 | |||
108 | /** |
||
109 | * Set the reference for the translation. |
||
110 | * |
||
111 | * @param string $reference |
||
112 | * The client refenece to use in all communication about the request. |
||
113 | */ |
||
114 | 3 | public function setReference($reference) |
|
118 | |||
119 | /** |
||
120 | * Get the translation files that are part of the request. |
||
121 | * |
||
122 | * @return array |
||
123 | * Array of 'filename.ext' => 'full/path/to/filename.ext' |
||
124 | */ |
||
125 | 3 | public function getFiles() |
|
129 | |||
130 | /** |
||
131 | * Add a file path to a file that needs to be translated. |
||
132 | * |
||
133 | * @param string $filePath |
||
134 | * A local file path to the file that needs to be included in the request. |
||
135 | */ |
||
136 | 3 | public function addFile($filePath) |
|
142 | |||
143 | /** |
||
144 | * Get the translation files content thatt are part of the request. |
||
145 | * |
||
146 | * @return array |
||
147 | * Array of 'filename.ext' => 'content string'. |
||
148 | */ |
||
149 | 3 | public function getContent() |
|
153 | |||
154 | /** |
||
155 | * Add content strings to the request by providing a filename and string. |
||
156 | * |
||
157 | * @param string $fileName |
||
158 | * The file name to use to pass the content string. |
||
159 | * @param string $content |
||
160 | * The file content as a string. |
||
161 | */ |
||
162 | 3 | public function addContent($fileName, $content) |
|
167 | } |
||
168 |