Test Failed
Branch master (e8c874)
by Domenico
03:40
created
src/XliffParser/AbstractXliffParser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param string|null          $xliffProprietary
33 33
      * @param LoggerInterface|null $logger
34 34
      */
35
-    public function __construct( $xliffVersion, $xliffProprietary = null, LoggerInterface $logger = null)
35
+    public function __construct($xliffVersion, $xliffProprietary = null, LoggerInterface $logger = null)
36 36
     {
37 37
         $this->xliffVersion = $xliffVersion;
38 38
         $this->logger       = $logger;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
         if ($element->hasAttributes()) {
128 128
             foreach ($element->attributes as $attr) {
129
-                $tagAttributes[ $attr->nodeName ] = $attr->nodeValue;
129
+                $tagAttributes[$attr->nodeName] = $attr->nodeValue;
130 130
             }
131 131
         }
132 132
 
@@ -175,40 +175,40 @@  discard block
 block discarded – undo
175 175
         $markers = preg_split('#<mrk\s#si', $raw, -1);
176 176
 
177 177
         $mi = 0;
178
-        while (isset($markers[ $mi + 1 ])) {
178
+        while (isset($markers[$mi + 1])) {
179 179
             unset($mid);
180 180
 
181
-            preg_match('|mid\s?=\s?["\'](.*?)["\']|si', $markers[ $mi + 1 ], $mid);
181
+            preg_match('|mid\s?=\s?["\'](.*?)["\']|si', $markers[$mi + 1], $mid);
182 182
 
183 183
             // if it's a Trados file the trailing spaces after </mrk> are meaningful
184 184
             // so we add them to
185 185
             $trailingSpaces = '';
186
-            if($this->xliffProprietary === 'trados'){
187
-                preg_match_all('/<\/mrk>[\s]+/iu', $markers[ $mi + 1 ], $trailingSpacesMatches);
186
+            if ($this->xliffProprietary === 'trados') {
187
+                preg_match_all('/<\/mrk>[\s]+/iu', $markers[$mi + 1], $trailingSpacesMatches);
188 188
 
189
-                if(isset($trailingSpacesMatches[0]) and count($trailingSpacesMatches[0]) > 0){
190
-                    foreach ($trailingSpacesMatches[0] as $match){
189
+                if (isset($trailingSpacesMatches[0]) and count($trailingSpacesMatches[0]) > 0) {
190
+                    foreach ($trailingSpacesMatches[0] as $match) {
191 191
                         $trailingSpaces = str_replace('</mrk>', '', $match);
192 192
                     }
193 193
                 }
194 194
             }
195 195
 
196 196
             //re-build the mrk tag after the split
197
-            $originalMark = trim('<mrk ' . $markers[ $mi + 1 ]);
197
+            $originalMark = trim('<mrk ' . $markers[$mi + 1]);
198 198
 
199 199
             $mark_string  = preg_replace('#^<mrk\s[^>]+>(.*)#', '$1', $originalMark); // at this point we have: ---> 'Test </mrk> </g>>'
200 200
             $mark_content = preg_split('#</mrk>#si', $mark_string);
201 201
 
202 202
             $sourceArray = [
203
-                'mid' => (isset($mid[ 1 ])) ? $mid[ 1 ] : $mi,
204
-                'ext-prec-tags' => ($mi == 0 ? $markers[ 0 ] : ""),
205
-                'raw-content' => (isset($mark_content[ 0 ])) ? $mark_content[ 0 ].$trailingSpaces : '',
206
-                'ext-succ-tags' => (isset($mark_content[ 1 ])) ? $mark_content[ 1 ] : '',
203
+                'mid' => (isset($mid[1])) ? $mid[1] : $mi,
204
+                'ext-prec-tags' => ($mi == 0 ? $markers[0] : ""),
205
+                'raw-content' => (isset($mark_content[0])) ? $mark_content[0] . $trailingSpaces : '',
206
+                'ext-succ-tags' => (isset($mark_content[1])) ? $mark_content[1] : '',
207 207
             ];
208 208
 
209 209
             if (!empty($originalData)) {
210 210
                 $dataRefMap = $this->getDataRefMap($originalData);
211
-                $sourceArray['replaced-content'] = (new DataRefReplacer($dataRefMap))->replace($mark_content[ 0 ]);
211
+                $sourceArray['replaced-content'] = (new DataRefReplacer($dataRefMap))->replace($mark_content[0]);
212 212
             }
213 213
 
214 214
             $source[] = $sourceArray;
Please login to merge, or discard this patch.
src/XliffParser/XliffParserV2.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
         foreach ($dom->getElementsByTagName('file') as $file) {
23 23
 
24 24
             // metadata
25
-            $output[ 'files' ][ $i ][ 'attr' ] = $this->extractMetadata($dom);
25
+            $output['files'][$i]['attr'] = $this->extractMetadata($dom);
26 26
 
27 27
             // notes
28
-            $output[ 'files' ][ $i ]['notes'] = $this->extractNotes($file);
28
+            $output['files'][$i]['notes'] = $this->extractNotes($file);
29 29
 
30 30
             // trans-units
31 31
             $transUnitIdArrayForUniquenessCheck = [];
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
         $fileNode = $dom->getElementsByTagName('file')->item(0);
62 62
 
63 63
         // original
64
-        $metadata[ 'original' ] = (null !== $fileNode->attributes->getNamedItem('original')) ? $fileNode->attributes->getNamedItem('original')->nodeValue : 'no-name';
64
+        $metadata['original'] = (null !== $fileNode->attributes->getNamedItem('original')) ? $fileNode->attributes->getNamedItem('original')->nodeValue : 'no-name';
65 65
 
66 66
         // source-language
67
-        $metadata[ 'source-language' ] = (null !== $xliffNode->attributes->getNamedItem('srcLang')) ? $xliffNode->attributes->getNamedItem('srcLang')->nodeValue : 'en-US';
67
+        $metadata['source-language'] = (null !== $xliffNode->attributes->getNamedItem('srcLang')) ? $xliffNode->attributes->getNamedItem('srcLang')->nodeValue : 'en-US';
68 68
 
69 69
         // datatype
70 70
         // @TODO to be implemented
71 71
 
72 72
         // target-language
73
-        $metadata[ 'target-language' ] = (null !== $xliffNode->attributes->getNamedItem('trgLang')) ? $xliffNode->attributes->getNamedItem('trgLang')->nodeValue : 'en-US';
73
+        $metadata['target-language'] = (null !== $xliffNode->attributes->getNamedItem('trgLang')) ? $xliffNode->attributes->getNamedItem('trgLang')->nodeValue : 'en-US';
74 74
 
75 75
         // custom MateCat x-attribute
76 76
         // @TODO to be implemented
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
     protected function extractTransUnit($transUnit, &$transUnitIdArrayForUniquenessCheck, $dom, &$output, &$i, &$j)
119 119
     {
120 120
         // metadata
121
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'attr' ] = $this->extractTransUnitMetadata($transUnit, $transUnitIdArrayForUniquenessCheck);
121
+        $output['files'][$i]['trans-units'][$j]['attr'] = $this->extractTransUnitMetadata($transUnit, $transUnitIdArrayForUniquenessCheck);
122 122
 
123 123
         // notes
124 124
         // merge <notes> with key and key-note contained in metadata <mda:metaGroup>
125
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'notes' ] = $this->extractTransUnitNotes($transUnit);
125
+        $output['files'][$i]['trans-units'][$j]['notes'] = $this->extractTransUnitNotes($transUnit);
126 126
 
127 127
         // uuid
128
-        foreach ($output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'notes' ] as $note){
129
-            if(isset($note['raw-content']) and Strings::isAValidUuid($note['raw-content'])){
130
-                $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'attr' ]['uuid'] = $note['raw-content'];
128
+        foreach ($output['files'][$i]['trans-units'][$j]['notes'] as $note) {
129
+            if (isset($note['raw-content']) and Strings::isAValidUuid($note['raw-content'])) {
130
+                $output['files'][$i]['trans-units'][$j]['attr']['uuid'] = $note['raw-content'];
131 131
             }
132 132
         }
133 133
 
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
         // http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html#originaldata
136 136
         $originalData = $this->extractTransUnitOriginalData($transUnit);
137 137
         if (!empty($originalData)) {
138
-            $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'original-data' ] = $originalData;
138
+            $output['files'][$i]['trans-units'][$j]['original-data'] = $originalData;
139 139
             $dataRefMap = $this->getDataRefMap($originalData);
140 140
         }
141 141
 
142 142
         // additionalTagData (exclusive for V2)
143 143
         $additionalTagData = $this->extractTransUnitAdditionalTagData($transUnit);
144 144
         if (!empty($additionalTagData)) {
145
-            $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'additional-tag-data' ] = $additionalTagData;
145
+            $output['files'][$i]['trans-units'][$j]['additional-tag-data'] = $additionalTagData;
146 146
         }
147 147
 
148 148
         // content
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             if ($segment->nodeName === 'segment') {
167 167
 
168 168
                 // check segment id consistency
169
-                $attr = $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'attr' ];
169
+                $attr = $output['files'][$i]['trans-units'][$j]['attr'];
170 170
                 $this->checkSegmentIdConsistency($segment, $attr);
171 171
 
172 172
                 // loop <segment> to get nested <source> and <target> tag
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                                 'mid'           => count($segSource) > 0 ? count($segSource) : 0,
192 192
                                 'ext-prec-tags' => '',
193 193
                                 'raw-content'   => $extractedSource['raw-content'],
194
-                                'replaced-content'   => (!empty($originalData)) ?  (new DataRefReplacer($dataRefMap))->replace($extractedSource['raw-content']) : null,
194
+                                'replaced-content'   => (!empty($originalData)) ? (new DataRefReplacer($dataRefMap))->replace($extractedSource['raw-content']) : null,
195 195
                                 'ext-succ-tags' => '',
196 196
                             ];
197 197
                         }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                                 'mid'           => count($segTarget) > 0 ? count($segTarget) : 0,
218 218
                                 'ext-prec-tags' => '',
219 219
                                 'raw-content'   => $extractedTarget['raw-content'],
220
-                                'replaced-content' => (!empty($originalData)) ?  (new DataRefReplacer($dataRefMap))->replace($extractedTarget['raw-content']) : null,
220
+                                'replaced-content' => (!empty($originalData)) ? (new DataRefReplacer($dataRefMap))->replace($extractedTarget['raw-content']) : null,
221 221
                                 'ext-succ-tags' => '',
222 222
                             ];
223 223
                         }
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
             }
229 229
         }
230 230
 
231
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'source' ] = $source;
232
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'target' ] = $target;
233
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'seg-source' ] = $segSource;
234
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'seg-target' ] = $segTarget;
231
+        $output['files'][$i]['trans-units'][$j]['source'] = $source;
232
+        $output['files'][$i]['trans-units'][$j]['target'] = $target;
233
+        $output['files'][$i]['trans-units'][$j]['seg-source'] = $segSource;
234
+        $output['files'][$i]['trans-units'][$j]['seg-target'] = $segTarget;
235 235
 
236 236
         $j++;
237 237
     }
@@ -253,31 +253,31 @@  discard block
 block discarded – undo
253 253
 
254 254
         $id = $transUnit->attributes->getNamedItem('id')->nodeValue;
255 255
 
256
-        if(strlen($id) > 100){
256
+        if (strlen($id) > 100) {
257 257
             throw new SegmentIdTooLongException('Segment-id too long. Max 100 characters allowed', 400);
258 258
         }
259 259
 
260 260
         $transUnitIdArrayForUniquenessCheck[] = $id;
261
-        $metadata[ 'id' ] = $id;
261
+        $metadata['id'] = $id;
262 262
 
263 263
         // translate
264 264
         if (null !== $transUnit->attributes->getNamedItem('translate')) {
265
-            $metadata[ 'translate' ] = $transUnit->attributes->getNamedItem('translate')->nodeValue;
265
+            $metadata['translate'] = $transUnit->attributes->getNamedItem('translate')->nodeValue;
266 266
         }
267 267
 
268 268
         // tGroupBegin
269 269
         if (null !== $transUnit->attributes->getNamedItem('tGroupBegin')) {
270
-            $metadata[ 'tGroupBegin' ] = $transUnit->attributes->getNamedItem('tGroupBegin')->nodeValue;
270
+            $metadata['tGroupBegin'] = $transUnit->attributes->getNamedItem('tGroupBegin')->nodeValue;
271 271
         }
272 272
 
273 273
         // tGroupEnd
274 274
         if (null !== $transUnit->attributes->getNamedItem('tGroupEnd')) {
275
-            $metadata[ 'tGroupEnd' ] = $transUnit->attributes->getNamedItem('tGroupEnd')->nodeValue;
275
+            $metadata['tGroupEnd'] = $transUnit->attributes->getNamedItem('tGroupEnd')->nodeValue;
276 276
         }
277 277
 
278 278
         // sizeRestriction
279
-        if (null !== $transUnit->attributes->getNamedItem('sizeRestriction') and  '' !== $transUnit->attributes->getNamedItem('sizeRestriction')->nodeValue ) {
280
-            $metadata[ 'sizeRestriction' ] = (int)$transUnit->attributes->getNamedItem('sizeRestriction')->nodeValue;
279
+        if (null !== $transUnit->attributes->getNamedItem('sizeRestriction') and '' !== $transUnit->attributes->getNamedItem('sizeRestriction')->nodeValue) {
280
+            $metadata['sizeRestriction'] = (int)$transUnit->attributes->getNamedItem('sizeRestriction')->nodeValue;
281 281
         }
282 282
 
283 283
         return $metadata;
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
         foreach ($transUnit->childNodes as $childNode) {
298 298
             if ($childNode->nodeName === 'originalData') {
299 299
                 foreach ($childNode->childNodes as $data) {
300
-                    if (null!== $data->attributes and null !== $data->attributes->getNamedItem('id')) {
300
+                    if (null !== $data->attributes and null !== $data->attributes->getNamedItem('id')) {
301 301
                         $dataId = $data->attributes->getNamedItem('id')->nodeValue;
302 302
 
303 303
                         $dataValue = str_replace(Placeholder::WHITE_SPACE_PLACEHOLDER, ' ', $data->nodeValue);
304
-                        $dataValue = str_replace(Placeholder::NEW_LINE_PLACEHOLDER,'\n', $dataValue);
304
+                        $dataValue = str_replace(Placeholder::NEW_LINE_PLACEHOLDER, '\n', $dataValue);
305 305
                         $dataValue = str_replace(Placeholder::TAB_PLACEHOLDER, '\t', $dataValue);
306 306
 
307 307
                         if ('' !== $dataValue) {
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
                             $jsonOrRawContentArray = $this->JSONOrRawContentArray($dataValue, false);
310 310
 
311 311
                             // restore xliff tags
312
-                            if (isset($jsonOrRawContentArray['json'])){
313
-                                $jsonOrRawContentArray['json'] = str_replace([Placeholder::LT_PLACEHOLDER, Placeholder::GT_PLACEHOLDER], ['&lt;','&gt;'], $jsonOrRawContentArray['json']);
312
+                            if (isset($jsonOrRawContentArray['json'])) {
313
+                                $jsonOrRawContentArray['json'] = str_replace([Placeholder::LT_PLACEHOLDER, Placeholder::GT_PLACEHOLDER], ['&lt;', '&gt;'], $jsonOrRawContentArray['json']);
314 314
                             }
315 315
 
316
-                            if (isset($jsonOrRawContentArray['raw-content'])){
317
-                                $jsonOrRawContentArray['raw-content'] = str_replace([Placeholder::LT_PLACEHOLDER, Placeholder::GT_PLACEHOLDER], ['&lt;','&gt;'], $jsonOrRawContentArray['raw-content']);
316
+                            if (isset($jsonOrRawContentArray['raw-content'])) {
317
+                                $jsonOrRawContentArray['raw-content'] = str_replace([Placeholder::LT_PLACEHOLDER, Placeholder::GT_PLACEHOLDER], ['&lt;', '&gt;'], $jsonOrRawContentArray['raw-content']);
318 318
                             }
319 319
 
320 320
                             $originalData[] = array_merge(
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
                     // id
353 353
                     if ($data->nodeName === 'memsource:tag') {
354
-                        if (null!== $data->attributes and null !== $data->attributes->getNamedItem('id')) {
354
+                        if (null !== $data->attributes and null !== $data->attributes->getNamedItem('id')) {
355 355
                             $dataId = $data->attributes->getNamedItem('id')->nodeValue;
356 356
                             $dataArray['attr']['id'] = $dataId;
357 357
                         }
@@ -386,10 +386,10 @@  discard block
 block discarded – undo
386 386
      */
387 387
     private function checkSegmentIdConsistency(\DOMElement $segment, array $attr)
388 388
     {
389
-        if (isset($attr[ 'tGroupBegin' ]) and isset($attr[ 'tGroupEnd' ]) and $segment->attributes->getNamedItem('id')) {
389
+        if (isset($attr['tGroupBegin']) and isset($attr['tGroupEnd']) and $segment->attributes->getNamedItem('id')) {
390 390
             $id = $segment->attributes->getNamedItem('id')->nodeValue;
391
-            $min = (int)$attr[ 'tGroupBegin' ];
392
-            $max = (int)$attr[ 'tGroupEnd' ];
391
+            $min = (int)$attr['tGroupBegin'];
392
+            $max = (int)$attr['tGroupEnd'];
393 393
 
394 394
             if (false === (($min <= $id) and ($id <= $max))) {
395 395
                 if ($this->logger) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                 foreach ($childNode->childNodes as $metadata) {
425 425
                     if ($metadata->nodeName === 'mda:metaGroup') {
426 426
                         foreach ($metadata->childNodes as $meta) {
427
-                            if (null!== $meta->attributes and null !== $meta->attributes->getNamedItem('type')) {
427
+                            if (null !== $meta->attributes and null !== $meta->attributes->getNamedItem('type')) {
428 428
                                 $type = $meta->attributes->getNamedItem('type')->nodeValue;
429 429
                                 $metaValue = trim($meta->nodeValue);
430 430
 
Please login to merge, or discard this patch.
src/XliffParser/XliffParserV1.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
         foreach ($dom->getElementsByTagName('file') as $file) {
20 20
 
21 21
             // metadata
22
-            $output[ 'files' ][ $i ][ 'attr' ] = $this->extractMetadata($file);
22
+            $output['files'][$i]['attr'] = $this->extractMetadata($file);
23 23
 
24 24
             // reference
25 25
             if (!empty($this->extractReference($file))) {
26
-                $output[ 'files' ][ $i ][ 'reference' ] = $this->extractReference($file);
26
+                $output['files'][$i]['reference'] = $this->extractReference($file);
27 27
             }
28 28
 
29 29
             // trans-units
@@ -65,36 +65,36 @@  discard block
 block discarded – undo
65 65
             switch ($attribute->localName) {
66 66
                 // original
67 67
                 case 'original':
68
-                    $metadata[ 'original' ] = $attribute->value;
68
+                    $metadata['original'] = $attribute->value;
69 69
                     break;
70 70
 
71 71
                 // source-language
72 72
                 case 'source-language':
73
-                    $metadata[ 'source-language' ] = $attribute->value;
73
+                    $metadata['source-language'] = $attribute->value;
74 74
                     break;
75 75
 
76 76
                 // data-type
77 77
                 case 'datatype':
78
-                    $metadata[ 'data-type' ] = $attribute->value;
78
+                    $metadata['data-type'] = $attribute->value;
79 79
                     break;
80 80
 
81 81
                 // target-language
82 82
                 case 'target-language':
83
-                    $metadata[ 'target-language' ] = $attribute->value;
83
+                    $metadata['target-language'] = $attribute->value;
84 84
                     break;
85 85
             }
86 86
 
87 87
             // Custom MateCat x-Attribute
88 88
             preg_match('|x-(.*?)|si', $attribute->localName, $temp);
89
-            if (isset($temp[ 1 ])) {
90
-                $customAttr[ $attribute->localName ] = $attribute->value;
89
+            if (isset($temp[1])) {
90
+                $customAttr[$attribute->localName] = $attribute->value;
91 91
             }
92 92
             unset($temp);
93 93
 
94 94
             // Custom MateCat namespace Attribute mtc:
95 95
             preg_match('|mtc:(.*?)|si', $attribute->nodeName, $temp);
96
-            if (isset($temp[ 1 ])) {
97
-                $customAttr[ $attribute->nodeName ] = $attribute->value;
96
+            if (isset($temp[1])) {
97
+                $customAttr[$attribute->nodeName] = $attribute->value;
98 98
             }
99 99
             unset($temp);
100 100
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
             /** @var \DOMNode $childNode */
121 121
             foreach ($ref->childNodes as $childNode) {
122 122
                 if ($childNode->nodeName === 'internal-file') {
123
-                    $reference[ $order ][ 'form-type' ] = $childNode->attributes->getNamedItem('form')->nodeValue;
124
-                    $reference[ $order ][ 'base64' ]    = trim($childNode->nodeValue);
123
+                    $reference[$order]['form-type'] = $childNode->attributes->getNamedItem('form')->nodeValue;
124
+                    $reference[$order]['base64']    = trim($childNode->nodeValue);
125 125
                     $order++;
126 126
                 }
127 127
             }
@@ -145,51 +145,51 @@  discard block
 block discarded – undo
145 145
     protected function extractTransUnit($transUnit, &$transUnitIdArrayForUniquenessCheck, $dom, &$output, &$i, &$j)
146 146
     {
147 147
         // metadata
148
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'attr' ] = $this->extractTransUnitMetadata($transUnit, $transUnitIdArrayForUniquenessCheck);
148
+        $output['files'][$i]['trans-units'][$j]['attr'] = $this->extractTransUnitMetadata($transUnit, $transUnitIdArrayForUniquenessCheck);
149 149
 
150 150
         // notes
151
-        $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'notes' ] = $this->extractTransUnitNotes($dom, $transUnit);
151
+        $output['files'][$i]['trans-units'][$j]['notes'] = $this->extractTransUnitNotes($dom, $transUnit);
152 152
 
153 153
         // content
154 154
         /** @var \DOMElement $childNode */
155 155
         foreach ($transUnit->childNodes as $childNode) {
156 156
             // source
157 157
             if ($childNode->nodeName === 'source') {
158
-                $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'source' ] = $this->extractContent($dom, $childNode);
158
+                $output['files'][$i]['trans-units'][$j]['source'] = $this->extractContent($dom, $childNode);
159 159
             }
160 160
 
161 161
             // seg-source
162 162
             if ($childNode->nodeName === 'seg-source') {
163
-                $rawSegment = $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'source' ]['raw-content'];
164
-                $output[ 'files' ][ $i ][ 'trans-units' ][ $j ]['seg-source'] = $this->extractContentWithMarksAndExtTags($dom, $childNode, $rawSegment);
163
+                $rawSegment = $output['files'][$i]['trans-units'][$j]['source']['raw-content'];
164
+                $output['files'][$i]['trans-units'][$j]['seg-source'] = $this->extractContentWithMarksAndExtTags($dom, $childNode, $rawSegment);
165 165
             }
166 166
 
167 167
             // target
168 168
             if ($childNode->nodeName === 'target') {
169
-                $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'target' ] = $this->extractContent($dom, $childNode);
169
+                $output['files'][$i]['trans-units'][$j]['target'] = $this->extractContent($dom, $childNode);
170 170
 
171 171
                 // seg-target
172
-                $targetRawContent = @$output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'target' ][ 'raw-content' ];
173
-                $segSource = @$output[ 'files' ][ $i ][ 'trans-units' ][ $j ]['seg-source'];
172
+                $targetRawContent = @$output['files'][$i]['trans-units'][$j]['target']['raw-content'];
173
+                $segSource = @$output['files'][$i]['trans-units'][$j]['seg-source'];
174 174
                 if (isset($targetRawContent) and !empty($targetRawContent) and isset($segSource) and count($segSource) > 0) {
175
-                    $output[ 'files' ][ $i ][ 'trans-units' ][ $j ]['seg-target'] = $this->extractContentWithMarksAndExtTags($dom, $childNode, $targetRawContent);
175
+                    $output['files'][$i]['trans-units'][$j]['seg-target'] = $this->extractContentWithMarksAndExtTags($dom, $childNode, $targetRawContent);
176 176
                 }
177 177
             }
178 178
 
179 179
             // locked
180 180
             if ($childNode->nodeName === 'sdl:seg') {
181
-                $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'locked' ] = $this->extractLocked($childNode);
181
+                $output['files'][$i]['trans-units'][$j]['locked'] = $this->extractLocked($childNode);
182 182
             }
183 183
         }
184 184
 
185 185
         // context-group
186 186
         foreach ($transUnit->getElementsByTagName('context-group') as $contextGroup) {
187
-            $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'context-group' ][] = $this->extractTransUnitContextGroup($dom, $contextGroup);
187
+            $output['files'][$i]['trans-units'][$j]['context-group'][] = $this->extractTransUnitContextGroup($dom, $contextGroup);
188 188
         }
189 189
 
190 190
         // alt-trans
191 191
         foreach ($transUnit->getElementsByTagName('alt-trans') as $altTrans) {
192
-            $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'alt-trans' ][] = $this->extractTransUnitAltTrans($altTrans);
192
+            $output['files'][$i]['trans-units'][$j]['alt-trans'][] = $this->extractTransUnitAltTrans($altTrans);
193 193
         }
194 194
 
195 195
         $j++;
@@ -213,22 +213,22 @@  discard block
 block discarded – undo
213 213
 
214 214
         $id = $transUnit->attributes->getNamedItem('id')->nodeValue;
215 215
 
216
-        if(strlen($id) > 100){
216
+        if (strlen($id) > 100) {
217 217
             throw new SegmentIdTooLongException('Segment-id too long. Max 100 characters allowed', 400);
218 218
         }
219 219
 
220 220
         $transUnitIdArrayForUniquenessCheck[] = $id;
221
-        $metadata[ 'id' ] = $id;
221
+        $metadata['id'] = $id;
222 222
 
223 223
         // translate
224 224
         if (null !== $transUnit->attributes->getNamedItem('translate')) {
225
-            $metadata[ 'translate' ] = $transUnit->attributes->getNamedItem('translate')->nodeValue;
225
+            $metadata['translate'] = $transUnit->attributes->getNamedItem('translate')->nodeValue;
226 226
         }
227 227
 
228 228
         // approved
229 229
         // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#approved
230 230
         if (null !== $transUnit->attributes->getNamedItem('approved')) {
231
-            $metadata[ 'approved' ] = filter_var($transUnit->attributes->getNamedItem('approved')->nodeValue, FILTER_VALIDATE_BOOLEAN);
231
+            $metadata['approved'] = filter_var($transUnit->attributes->getNamedItem('approved')->nodeValue, FILTER_VALIDATE_BOOLEAN);
232 232
         }
233 233
 
234 234
         return $metadata;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                 $extractedNote = $this->JSONOrRawContentArray($noteValue);
253 253
 
254 254
                 // extract all the attributes
255
-                foreach ($note->attributes as $attribute){
255
+                foreach ($note->attributes as $attribute) {
256 256
                     $extractedNote[$attribute->name] = $attribute->value;
257 257
                 }
258 258
 
Please login to merge, or discard this patch.
src/XliffReplacer/XliffSAXTranslationReplacer.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
      */
18 18
     private $nodesToCopy = [
19 19
         'source',
20
-        'mda:metadata' ,
21
-        'memsource:additionalTagData' ,
22
-        'originalData' ,
23
-        'seg-source' ,
24
-        'value' ,
25
-        'bpt' ,
26
-        'ept' ,
27
-        'ph' ,
28
-        'st' ,
29
-        'note' ,
20
+        'mda:metadata',
21
+        'memsource:additionalTagData',
22
+        'originalData',
23
+        'seg-source',
24
+        'value',
25
+        'bpt',
26
+        'ept',
27
+        'ph',
28
+        'st',
29
+        'note',
30 30
         'context',
31 31
     ];
32 32
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             // obfuscate entities because sax automatically does html_entity_decode
45 45
             $temporary_check_buffer = preg_replace("/&(.*?);/", self::$INTERNAL_TAG_PLACEHOLDER . '$1' . self::$INTERNAL_TAG_PLACEHOLDER, $this->currentBuffer);
46 46
 
47
-            $lastByte = $temporary_check_buffer[ strlen($temporary_check_buffer) - 1 ];
47
+            $lastByte = $temporary_check_buffer[strlen($temporary_check_buffer) - 1];
48 48
 
49 49
             //avoid cutting entities in half:
50 50
             //the last fread could have truncated an entity (say, '&lt;' in '&l'), thus invalidating the escaping
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 }
67 67
 
68 68
                 //if an entity is still present, fetch some more and repeat the escaping
69
-                $this->currentBuffer    .= fread($this->originalFP, 9);
69
+                $this->currentBuffer .= fread($this->originalFP, 9);
70 70
                 $temporary_check_buffer = preg_replace("/&(.*?);/", self::$INTERNAL_TAG_PLACEHOLDER . '$1' . self::$INTERNAL_TAG_PLACEHOLDER, $this->currentBuffer);
71 71
             }
72 72
 
@@ -110,31 +110,31 @@  discard block
 block discarded – undo
110 110
 
111 111
             // get id
112 112
             // trim to first 100 characters because this is the limit on Matecat's DB
113
-            $this->currentTransUnitId = substr($attr[ 'id' ], 0, 100);
113
+            $this->currentTransUnitId = substr($attr['id'], 0, 100);
114 114
 
115 115
             // `translate` attribute can be only yes or no
116
-            if(isset($attr[ 'translate' ]) and $attr[ 'translate' ] === 'no'){
117
-                $attr[ 'translate' ] = 'no';
116
+            if (isset($attr['translate']) and $attr['translate'] === 'no') {
117
+                $attr['translate'] = 'no';
118 118
             } else {
119
-                $attr[ 'translate' ] = 'yes';
119
+                $attr['translate'] = 'yes';
120 120
             }
121 121
 
122 122
             // current 'translate' attribute of the current trans-unit
123
-            $this->currentTransUnitTranslate = isset($attr[ 'translate' ]) ? $attr[ 'translate' ] : 'yes';
123
+            $this->currentTransUnitTranslate = isset($attr['translate']) ? $attr['translate'] : 'yes';
124 124
         }
125 125
 
126
-        if('source' === $name){
126
+        if ('source' === $name) {
127 127
             $this->sourceAttributes = $attr;
128 128
         }
129 129
 
130
-        if('mda:metadata' === $name){
130
+        if ('mda:metadata' === $name) {
131 131
             $this->unitContainsMda = true;
132 132
         }
133 133
 
134 134
         // check if we are entering into a <target>
135 135
         if ('target' === $name) {
136 136
 
137
-            if($this->currentTransUnitTranslate === 'no'){
137
+            if ($this->currentTransUnitTranslate === 'no') {
138 138
                 $this->inTarget = false;
139 139
             } else {
140 140
                 $this->inTarget = true;
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
             //
166 166
             // http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html#unit
167 167
             //
168
-            if($this->xliffVersion === 2 and ( $name === 'notes' or $name === 'originalData' or $name === 'segment' or $name === 'ignorable') and $this->unitContainsMda === false ){
169
-                if (isset($this->transUnits[ $this->currentTransUnitId ]) and !empty($this->transUnits[ $this->currentTransUnitId ]) and !$this->unitContainsMda and !$this->hasWrittenCounts) {
168
+            if ($this->xliffVersion === 2 and ($name === 'notes' or $name === 'originalData' or $name === 'segment' or $name === 'ignorable') and $this->unitContainsMda === false) {
169
+                if (isset($this->transUnits[$this->currentTransUnitId]) and !empty($this->transUnits[$this->currentTransUnitId]) and !$this->unitContainsMda and !$this->hasWrittenCounts) {
170 170
 
171 171
                     // we need to update counts here
172 172
                     $this->updateCounts();
173 173
                     $this->hasWrittenCounts = true;
174 174
 
175
-                    $tag .= $this->getWordCountGroupForXliffV2($this->counts[ 'raw_word_count' ], $this->counts[ 'eq_word_count' ]);
175
+                    $tag .= $this->getWordCountGroupForXliffV2($this->counts['raw_word_count'], $this->counts['eq_word_count']);
176 176
                     $this->unitContainsMda = true;
177 177
                 }
178 178
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             $tag .= "<$name ";
182 182
 
183 183
             $lastMrkState = null;
184
-            $stateProp   = '';
184
+            $stateProp = '';
185 185
 
186 186
             foreach ($attr as $k => $v) {
187 187
 
@@ -192,27 +192,27 @@  discard block
 block discarded – undo
192 192
                 } else {
193 193
                     $pos = 0;
194 194
                     if ($this->currentTransUnitId) {
195
-                        $pos = current($this->transUnits[ $this->currentTransUnitId ]);
195
+                        $pos = current($this->transUnits[$this->currentTransUnitId]);
196 196
                     }
197 197
 
198 198
                     if ($name === $this->tuTagName) {
199 199
 
200
-                        $sid = $this->segments[ $pos ][ 'sid' ];
200
+                        $sid = $this->segments[$pos]['sid'];
201 201
 
202 202
                         // add `help-id` to xliff v.1*
203 203
                         // add `mtc:segment-id` to xliff v.2*
204
-                        if($this->xliffVersion === 1 and strpos($tag, 'help-id') === false){
204
+                        if ($this->xliffVersion === 1 and strpos($tag, 'help-id') === false) {
205 205
                             if (!empty($sid)) {
206 206
                                 $tag .= "help-id=\"$sid\" ";
207 207
                             }
208
-                        } elseif($this->xliffVersion === 2 and strpos($tag, 'mtc:segment-id') === false) {
208
+                        } elseif ($this->xliffVersion === 2 and strpos($tag, 'mtc:segment-id') === false) {
209 209
                             if (!empty($sid)) {
210 210
                                 $tag .= "mtc:segment-id=\"$sid\" ";
211 211
                             }
212 212
                         }
213 213
 
214 214
                     } elseif ('segment' === $name and $this->xliffVersion === 2) { // add state to segment in Xliff v2
215
-                        list($stateProp, $lastMrkState) = $this->setTransUnitState($this->segments[ $pos ], $stateProp, $lastMrkState);
215
+                        list($stateProp, $lastMrkState) = $this->setTransUnitState($this->segments[$pos], $stateProp, $lastMrkState);
216 216
                     }
217 217
 
218 218
                     //normal tag flux, put attributes in it
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
             // trgLang
240 240
             if ($name === 'xliff') {
241
-                $tag = preg_replace('/trgLang="(.*?)"/', 'trgLang="'.$this->targetLang.'"', $tag);
241
+                $tag = preg_replace('/trgLang="(.*?)"/', 'trgLang="' . $this->targetLang . '"', $tag);
242 242
             }
243 243
 
244 244
             //this logic helps detecting empty tags
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
             //is outside current buffer (in the latter case, it's in next buffer to be read by the while loop);
251 251
             //this check is necessary because we may have truncated a tag in half with current read,
252 252
             //and the other half may be encountered in the next buffer it will be passed
253
-            if (isset($this->currentBuffer[ $idx - $this->offset ])) {
253
+            if (isset($this->currentBuffer[$idx - $this->offset])) {
254 254
                 //if this tag entire lenght fitted in the buffer, the last char must be the last
255 255
                 //symbol before the '>'; if it's an empty tag, it is assumed that it's a '/'
256 256
                 $tmp_offset = $idx - $this->offset;
257
-                $lastChar   = $this->currentBuffer[ $idx - $this->offset ];
257
+                $lastChar   = $this->currentBuffer[$idx - $this->offset];
258 258
             } else {
259 259
                 //if it's out, simple use the last character of the chunk
260 260
                 $tmp_offset = $this->len - 1;
261
-                $lastChar   = $this->currentBuffer[ $this->len - 1 ];
261
+                $lastChar   = $this->currentBuffer[$this->len - 1];
262 262
             }
263 263
 
264 264
             //trim last space
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 } else {
284 284
                     //these are NOT source/seg-source/value empty tags, THERE IS A CONTENT, write it in buffer
285 285
                     $this->bufferIsActive = true;
286
-                    $this->CDATABuffer    .= $tag;
286
+                    $this->CDATABuffer .= $tag;
287 287
                 }
288 288
             } else {
289 289
                 $this->postProcAndFlush($this->outputFP, $tag);
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 
293 293
         // update segmentPositionInTu
294 294
 
295
-        if($this->xliffVersion === 1 and $this->inTU and $name === 'source'){
295
+        if ($this->xliffVersion === 1 and $this->inTU and $name === 'source') {
296 296
             $this->segmentPositionInTu++;
297 297
         }
298 298
 
299
-        if($this->xliffVersion === 2 and $this->inTU and $name === 'segment'){
299
+        if ($this->xliffVersion === 2 and $this->inTU and $name === 'segment') {
300 300
             $this->segmentPositionInTu++;
301 301
         }
302 302
     }
@@ -322,17 +322,17 @@  discard block
 block discarded – undo
322 322
 
323 323
             if ('target' == $name) {
324 324
 
325
-                if($this->currentTransUnitTranslate === 'no') {
325
+                if ($this->currentTransUnitTranslate === 'no') {
326 326
                     // do nothing
327
-                } elseif (isset($this->transUnits[ $this->currentTransUnitId ])) {
327
+                } elseif (isset($this->transUnits[$this->currentTransUnitId])) {
328 328
 
329 329
                     // get translation of current segment, by indirect indexing: id -> positional index -> segment
330 330
                     // actually there may be more that one segment to that ID if there are two mrk of the same source segment
331 331
 
332
-                    $listOfSegmentsIds = $this->transUnits[ $this->currentTransUnitId ];
332
+                    $listOfSegmentsIds = $this->transUnits[$this->currentTransUnitId];
333 333
 
334 334
                     // $currentSegmentId
335
-                    if(!empty($listOfSegmentsIds)){
335
+                    if (!empty($listOfSegmentsIds)) {
336 336
                         $this->setCurrentSegmentArray($listOfSegmentsIds);
337 337
                     }
338 338
 
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
                     $warning    = false;
353 353
                     $last_value = null;
354 354
                     for ($i = 0; $i < count($listOfSegmentsIds); $i++) {
355
-                        if (isset($listOfSegmentsIds[ $i ])) {
356
-                            $id = $listOfSegmentsIds[ $i ];
357
-                            if (isset($this->segments[ $id ]) and ($i == 0 or $last_value + 1 == $listOfSegmentsIds[ $i ])) {
358
-                                $last_value            = $listOfSegmentsIds[ $i ];
359
-                                $this->lastTransUnit[] = $this->segments[ $id ];
355
+                        if (isset($listOfSegmentsIds[$i])) {
356
+                            $id = $listOfSegmentsIds[$i];
357
+                            if (isset($this->segments[$id]) and ($i == 0 or $last_value + 1 == $listOfSegmentsIds[$i])) {
358
+                                $last_value            = $listOfSegmentsIds[$i];
359
+                                $this->lastTransUnit[] = $this->segments[$id];
360 360
                             }
361 361
                         } else {
362 362
                             $warning = true;
@@ -365,31 +365,31 @@  discard block
 block discarded – undo
365 365
 
366 366
                     if ($warning) {
367 367
                         if (null !== $this->logger) {
368
-                            $this->logger->warning("WARNING: PHP Notice polling. CurrentId: '" . $this->currentTransUnitId . "' - Filename: '" . $this->segments[ 0 ][ 'filename' ] . "' - First Segment: '" . $this->segments[
369
-                                    0 ][ 'sid' ] . "'");
368
+                            $this->logger->warning("WARNING: PHP Notice polling. CurrentId: '" . $this->currentTransUnitId . "' - Filename: '" . $this->segments[0]['filename'] . "' - First Segment: '" . $this->segments[
369
+                                    0]['sid'] . "'");
370 370
                         }
371 371
                     }
372 372
 
373 373
                     // init translation and state
374 374
                     $translation  = '';
375 375
                     $lastMrkState = null;
376
-                    $stateProp   = '';
376
+                    $stateProp = '';
377 377
 
378 378
                     // we must reset the lastMrkId found because this is a new segment.
379
-                    $lastMrkId      = -1;
379
+                    $lastMrkId = -1;
380 380
 
381 381
                     if ($this->xliffVersion === 2) {
382
-                        $seg = $this->segments[ $this->currentSegmentArray['sid'] ];
382
+                        $seg = $this->segments[$this->currentSegmentArray['sid']];
383 383
 
384 384
                         // update counts
385
-                        if(!$this->hasWrittenCounts and !empty($seg)){
385
+                        if (!$this->hasWrittenCounts and !empty($seg)) {
386 386
                             $this->updateSegmentCounts($seg);
387 387
                         }
388 388
 
389 389
                         // delete translations so the prepareSegment
390 390
                         // will put source content in target tag
391 391
                         if ($this->sourceInTarget) {
392
-                            $seg[ 'translation' ] = '';
392
+                            $seg['translation'] = '';
393 393
                             $this->resetCounts();
394 394
                         }
395 395
 
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
                              * pre-assign zero to the new mrk if this is the first one ( in this segment )
412 412
                              * If it is null leave it NULL
413 413
                              */
414
-                            if ((int)$this->segments[ $id ][ "mrk_id" ] < 0 and $this->segments[ $id ][ "mrk_id" ] !== null) {
415
-                                $this->segments[ $id ][ "mrk_id" ] = 0;
414
+                            if ((int)$this->segments[$id]["mrk_id"] < 0 and $this->segments[$id]["mrk_id"] !== null) {
415
+                                $this->segments[$id]["mrk_id"] = 0;
416 416
                             }
417 417
 
418 418
                             /*
@@ -421,22 +421,22 @@  discard block
 block discarded – undo
421 421
                              * ( null <= -1 ) === true
422 422
                              * so, cast to int
423 423
                              */
424
-                            if ((int)$this->segments[ $id ][ "mrk_id" ] <= $lastMrkId) {
424
+                            if ((int)$this->segments[$id]["mrk_id"] <= $lastMrkId) {
425 425
                                 break;
426 426
                             }
427 427
 
428 428
                             // set $this->currentSegment
429
-                            $seg = $this->segments[ $id ];
429
+                            $seg = $this->segments[$id];
430 430
 
431 431
                             // update counts
432
-                            if(!empty($seg)){
432
+                            if (!empty($seg)) {
433 433
                                 $this->updateSegmentCounts($seg);
434 434
                             }
435 435
 
436 436
                             // delete translations so the prepareSegment
437 437
                             // will put source content in target tag
438 438
                             if ($this->sourceInTarget) {
439
-                                $seg[ 'translation' ] = '';
439
+                                $seg['translation'] = '';
440 440
                                 $this->resetCounts();
441 441
                             }
442 442
 
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 
446 446
                             // for xliff 2 we need $this->transUnits[ $this->currentId ] [ $pos ] for populating metadata
447 447
 
448
-                            unset($this->transUnits[ $this->currentTransUnitId ] [ $pos ]);
448
+                            unset($this->transUnits[$this->currentTransUnitId] [$pos]);
449 449
 
450
-                            $lastMrkId = $this->segments[ $id ][ "mrk_id" ];
450
+                            $lastMrkId = $this->segments[$id]["mrk_id"];
451 451
 
452 452
                             list($stateProp, $lastMrkState) = $this->setTransUnitState($seg, $stateProp, $lastMrkState);
453 453
                         }
@@ -456,10 +456,10 @@  discard block
 block discarded – undo
456 456
                     //append translation
457 457
                     $targetLang = '';
458 458
                     if ($this->xliffVersion === 1) {
459
-                        $targetLang = ' xml:lang="'.$this->targetLang.'"';
459
+                        $targetLang = ' xml:lang="' . $this->targetLang . '"';
460 460
                     }
461 461
 
462
-                    $tag = $this->buildTranslateTag($targetLang, $stateProp, $translation, $this->counts[ 'raw_word_count' ], $this->counts[ 'eq_word_count' ]);
462
+                    $tag = $this->buildTranslateTag($targetLang, $stateProp, $translation, $this->counts['raw_word_count'], $this->counts['eq_word_count']);
463 463
                 }
464 464
 
465 465
                 // signal we are leaving a target
@@ -472,21 +472,21 @@  discard block
 block discarded – undo
472 472
 
473 473
                 // only for Xliff 2.*
474 474
                 // write here <mda:metaGroup> and <mda:meta> if already present in the <unit>
475
-                if('mda:metadata' === $name and $this->unitContainsMda and $this->xliffVersion === 2 and !$this->hasWrittenCounts){
475
+                if ('mda:metadata' === $name and $this->unitContainsMda and $this->xliffVersion === 2 and !$this->hasWrittenCounts) {
476 476
 
477 477
                     // we need to update counts here
478 478
                     $this->updateCounts();
479 479
                     $this->hasWrittenCounts = true;
480 480
 
481 481
                     $tag = $this->CDATABuffer;
482
-                    $tag .= $this->getWordCountGroupForXliffV2($this->counts[ 'raw_word_count' ], $this->counts[ 'eq_word_count' ], false);
482
+                    $tag .= $this->getWordCountGroupForXliffV2($this->counts['raw_word_count'], $this->counts['eq_word_count'], false);
483 483
                     $tag .= "    </mda:metadata>";
484 484
 
485 485
                 } else {
486
-                    $tag = $this->CDATABuffer."</$name>";
486
+                    $tag = $this->CDATABuffer . "</$name>";
487 487
                 }
488 488
 
489
-                $this->CDATABuffer    = "";
489
+                $this->CDATABuffer = "";
490 490
 
491 491
                 //flush to pointer
492 492
                 $this->postProcAndFlush($this->outputFP, $tag);
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
                 // only for Xliff 2.*
496 496
                 // if segment has no <target> add it BEFORE </segment>
497
-                if($this->xliffVersion === 2 and !$this->targetWasWritten){
497
+                if ($this->xliffVersion === 2 and !$this->targetWasWritten) {
498 498
 
499 499
                     $seg = $this->getCurrentSegment();
500 500
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                         $tag .= " $k=\"$v\"";
505 505
                     }
506 506
 
507
-                    $tag .= '>'.$seg['translation'].'</target></segment>';
507
+                    $tag .= '>' . $seg['translation'] . '</target></segment>';
508 508
                 }
509 509
 
510 510
                 $this->postProcAndFlush($this->outputFP, $tag);
@@ -512,18 +512,18 @@  discard block
 block discarded – undo
512 512
                 // we are leaving <segment>, reset $segmentHasTarget
513 513
                 $this->targetWasWritten = false;
514 514
 
515
-            } elseif($name === 'trans-unit') {
515
+            } elseif ($name === 'trans-unit') {
516 516
 
517 517
                 // only for Xliff 1.*
518 518
                 // handling </trans-unit> closure
519
-                if(!$this->targetWasWritten){
519
+                if (!$this->targetWasWritten) {
520 520
                     $seg = $this->getCurrentSegment();
521 521
                     $lastMrkState = null;
522
-                    $stateProp   = '';
522
+                    $stateProp = '';
523 523
                     $tag = '';
524 524
 
525 525
                     // if there is translation available insert <target> BEFORE </trans-unit>
526
-                    if(isset($seg['translation'])){
526
+                    if (isset($seg['translation'])) {
527 527
                         list($stateProp, $lastMrkState) = $this->setTransUnitState($seg, $stateProp, $lastMrkState);
528 528
                         $tag .= $this->createTargetTag($seg['translation'], $stateProp);
529 529
                     }
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         } else {
578 578
             if ($this->currentSegmentArray['tid'] === $this->currentTransUnitId) {
579 579
                 $key = array_search($this->currentSegmentArray['sid'], $listOfSegmentsIds);
580
-                $this->currentSegmentArray['sid'] = $listOfSegmentsIds[$key+1];
580
+                $this->currentSegmentArray['sid'] = $listOfSegmentsIds[$key + 1];
581 581
                 $this->currentSegmentArray['tid'] = $this->currentTransUnitId;
582 582
             } else {
583 583
                 $this->currentSegmentArray = [
@@ -594,23 +594,23 @@  discard block
 block discarded – undo
594 594
     private function updateCounts()
595 595
     {
596 596
         // populate counts
597
-        $listOfSegmentsIds = $this->transUnits[ $this->currentTransUnitId ];
597
+        $listOfSegmentsIds = $this->transUnits[$this->currentTransUnitId];
598 598
 
599 599
         // $currentSegmentId
600
-        if(!empty($listOfSegmentsIds)){
600
+        if (!empty($listOfSegmentsIds)) {
601 601
             $this->setCurrentSegmentArray($listOfSegmentsIds);
602 602
         }
603 603
 
604 604
         if ($this->xliffVersion === 2) {
605
-            $seg = $this->segments[ $this->currentSegmentArray[ 'sid' ] ];
606
-            if(!empty($seg)){
605
+            $seg = $this->segments[$this->currentSegmentArray['sid']];
606
+            if (!empty($seg)) {
607 607
                 $this->updateSegmentCounts($seg);
608 608
             }
609 609
         } else {
610 610
             foreach ($listOfSegmentsIds as $pos => $id) {
611
-                $seg = $this->segments[ $id ];
612
-                if(!empty($seg)){
613
-                    $this->updateSegmentCounts( $seg );
611
+                $seg = $this->segments[$id];
612
+                if (!empty($seg)) {
613
+                    $this->updateSegmentCounts($seg);
614 614
                 }
615 615
             }
616 616
         }
@@ -623,14 +623,14 @@  discard block
 block discarded – undo
623 623
      */
624 624
     private function updateSegmentCounts(array $seg = [])
625 625
     {
626
-        $this->counts[ 'raw_word_count' ] += $seg['raw_word_count'];
627
-        $this->counts[ 'eq_word_count' ] += (floor($seg[ 'eq_word_count' ] * 100) / 100);
626
+        $this->counts['raw_word_count'] += $seg['raw_word_count'];
627
+        $this->counts['eq_word_count'] += (floor($seg['eq_word_count'] * 100) / 100);
628 628
     }
629 629
 
630 630
     private function resetCounts()
631 631
     {
632
-        $this->counts[ 'raw_word_count' ] = 0;
633
-        $this->counts[ 'eq_word_count' ] = 0;
632
+        $this->counts['raw_word_count'] = 0;
633
+        $this->counts['eq_word_count'] = 0;
634 634
     }
635 635
 
636 636
     /**
@@ -645,11 +645,11 @@  discard block
 block discarded – undo
645 645
     {
646 646
         $endTags = "";
647 647
 
648
-        $segment     = Strings::removeDangerousChars($seg [ 'segment' ]);
649
-        $translation = Strings::removeDangerousChars($seg [ 'translation' ]);
648
+        $segment     = Strings::removeDangerousChars($seg ['segment']);
649
+        $translation = Strings::removeDangerousChars($seg ['translation']);
650 650
         $dataRefMap  = (isset($seg['data_ref_map']) and $seg['data_ref_map'] !== null) ? Strings::jsonToArray($seg['data_ref_map']) : [];
651 651
 
652
-        if (is_null($seg [ 'translation' ]) or $seg [ 'translation' ] == '') {
652
+        if (is_null($seg ['translation']) or $seg ['translation'] == '') {
653 653
             $translation = $segment;
654 654
         } else {
655 655
             if ($this->callback) {
@@ -664,15 +664,15 @@  discard block
 block discarded – undo
664 664
             return $translation;
665 665
         }
666 666
 
667
-        if ($seg[ 'mrk_id' ] !== null and $seg[ 'mrk_id' ] != '') {
667
+        if ($seg['mrk_id'] !== null and $seg['mrk_id'] != '') {
668 668
             if ($this->targetLang === 'ja-JP') {
669
-                $seg[ 'mrk_succ_tags' ] = ltrim($seg[ 'mrk_succ_tags' ]);
669
+                $seg['mrk_succ_tags'] = ltrim($seg['mrk_succ_tags']);
670 670
             }
671 671
 
672
-            $translation = "<mrk mid=\"" . $seg[ 'mrk_id' ] . "\" mtype=\"seg\">" . $seg[ 'mrk_prev_tags' ] . $translation . $seg[ 'mrk_succ_tags' ] . "</mrk>";
672
+            $translation = "<mrk mid=\"" . $seg['mrk_id'] . "\" mtype=\"seg\">" . $seg['mrk_prev_tags'] . $translation . $seg['mrk_succ_tags'] . "</mrk>";
673 673
         }
674 674
 
675
-        $transUnitTranslation .= $seg[ 'prev_tags' ] . $translation . $endTags . $seg[ 'succ_tags' ];
675
+        $transUnitTranslation .= $seg['prev_tags'] . $translation . $endTags . $seg['succ_tags'];
676 676
 
677 677
         return $transUnitTranslation;
678 678
     }
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
                 $tag = "<target $targetLang $stateProp>$translation</target>";
695 695
 
696 696
                 // if it's a Trados file don't append count group
697
-                if(get_class($this) !== SdlXliffSAXTranslationReplacer::class){
697
+                if (get_class($this) !== SdlXliffSAXTranslationReplacer::class) {
698 698
                     $tag .= $this->getWordCountGroup($rawWordCount, $eqWordCount);
699 699
                 }
700 700
 
@@ -721,10 +721,10 @@  discard block
 block discarded – undo
721 721
      */
722 722
     private function getCurrentSegment()
723 723
     {
724
-        if($this->currentTransUnitTranslate === 'yes' and isset($this->transUnits[$this->currentTransUnitId])){
724
+        if ($this->currentTransUnitTranslate === 'yes' and isset($this->transUnits[$this->currentTransUnitId])) {
725 725
             $index = $this->transUnits[$this->currentTransUnitId][$this->segmentPositionInTu];
726 726
 
727
-            if(isset($this->segments[$index])){
727
+            if (isset($this->segments[$index])) {
728 728
                 return $this->segments[$index];
729 729
             }
730 730
         }
@@ -742,9 +742,9 @@  discard block
 block discarded – undo
742 742
      */
743 743
     private function createTargetTag($translation, $stateProp)
744 744
     {
745
-        $targetLang = 'xml:lang="'.$this->targetLang.'"';
745
+        $targetLang = 'xml:lang="' . $this->targetLang . '"';
746 746
 
747
-        return $this->buildTranslateTag($targetLang, $stateProp, $translation, $this->counts[ 'raw_word_count' ], $this->counts[ 'eq_word_count' ]);
747
+        return $this->buildTranslateTag($targetLang, $stateProp, $translation, $this->counts['raw_word_count'], $this->counts['eq_word_count']);
748 748
     }
749 749
 
750 750
     /**
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
     private function getWordCountGroupForXliffV2($raw_word_count, $eq_word_count, $withMetadataTag = true)
758 758
     {
759 759
         $this->mdaGroupCounter++;
760
-        $id = 'word_count_tu_'. $this->mdaGroupCounter;
760
+        $id = 'word_count_tu_' . $this->mdaGroupCounter;
761 761
 
762
-        if($withMetadataTag === false){
763
-            return "    <mda:metaGroup id=\"".$id."\" category=\"row_xml_attribute\">
762
+        if ($withMetadataTag === false) {
763
+            return "    <mda:metaGroup id=\"" . $id . "\" category=\"row_xml_attribute\">
764 764
                                 <mda:meta type=\"x-matecat-raw\">$raw_word_count</mda:meta>
765 765
                                 <mda:meta type=\"x-matecat-weighted\">$eq_word_count</mda:meta>
766 766
                             </mda:metaGroup>
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
         }
769 769
 
770 770
         return "<mda:metadata>
771
-                <mda:metaGroup id=\"".$id."\" category=\"row_xml_attribute\">
771
+                <mda:metaGroup id=\"".$id . "\" category=\"row_xml_attribute\">
772 772
                     <mda:meta type=\"x-matecat-raw\">$raw_word_count</mda:meta>
773 773
                     <mda:meta type=\"x-matecat-weighted\">$eq_word_count</mda:meta>
774 774
                 </mda:metaGroup>
@@ -784,12 +784,12 @@  discard block
 block discarded – undo
784 784
      */
785 785
     private function setTransUnitState($seg, $state_prop, $lastMrkState)
786 786
     {
787
-        switch ($seg[ 'status' ]) {
787
+        switch ($seg['status']) {
788 788
 
789 789
             case TranslationStatus::STATUS_FIXED:
790 790
             case TranslationStatus::STATUS_APPROVED:
791 791
                 if ($lastMrkState == null or $lastMrkState == TranslationStatus::STATUS_APPROVED) {
792
-                    $state_prop   = ($this->xliffVersion === 2) ? "state=\"reviewed\"": "state=\"signed-off\"";
792
+                    $state_prop   = ($this->xliffVersion === 2) ? "state=\"reviewed\"" : "state=\"signed-off\"";
793 793
                     $lastMrkState = TranslationStatus::STATUS_APPROVED;
794 794
                 }
795 795
                 break;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
                 break;
833 833
         }
834 834
 
835
-        return [ $state_prop, $lastMrkState ];
835
+        return [$state_prop, $lastMrkState];
836 836
     }
837 837
 
838 838
     /**
Please login to merge, or discard this patch.
src/XliffReplacer/SdlXliffSAXTranslationReplacer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 
20 20
             // get id
21 21
             // trim to first 100 characters because this is the limit on Matecat's DB
22
-            $this->currentTransUnitId = substr($attr[ 'id' ], 0, 100);
22
+            $this->currentTransUnitId = substr($attr['id'], 0, 100);
23 23
 
24 24
             // current 'translate' attribute of the current trans-unit
25
-            $this->currentTransUnitTranslate = isset($attr[ 'translate' ]) ? $attr[ 'translate' ] : 'yes';
25
+            $this->currentTransUnitTranslate = isset($attr['translate']) ? $attr['translate'] : 'yes';
26 26
         }
27 27
 
28 28
         // check if we are entering into a <target>
29 29
         if ('target' == $name) {
30
-            if($this->currentTransUnitTranslate === 'no'){
30
+            if ($this->currentTransUnitTranslate === 'no') {
31 31
                 $this->inTarget = false;
32 32
             } else {
33 33
                 $this->inTarget = true;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
                 } elseif ('sdl:seg' == $name) {
65 65
 
66 66
                     // write the confidence level for this segment ( Translated, Draft, etc. )
67
-                    if (isset($this->segments[ 'matecat|' . $this->currentTransUnitId ]) and $_sdlStatus_confWritten == false) {
67
+                    if (isset($this->segments['matecat|' . $this->currentTransUnitId]) and $_sdlStatus_confWritten == false) {
68 68
 
69 69
                         // append definition attribute
70
-                        $tag .= $this->prepareTargetStatuses($this->lastTransUnit[ $this->markerPos ]);
70
+                        $tag .= $this->prepareTargetStatuses($this->lastTransUnit[$this->markerPos]);
71 71
 
72 72
                         //prepare for an eventual next cycle
73 73
                         $this->markerPos++;
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
             // is outside current buffer (in the latter case, it's in next buffer to be read by the while loop);
95 95
             // this check is necessary because we may have truncated a tag in half with current read,
96 96
             // and the other half may be encountered in the next buffer it will be passed
97
-            if (isset($this->currentBuffer[ $idx - $this->offset ])) {
97
+            if (isset($this->currentBuffer[$idx - $this->offset])) {
98 98
                 // if this tag entire lenght fitted in the buffer, the last char must be the last
99 99
                 // symbol before the '>'; if it's an empty tag, it is assumed that it's a '/'
100 100
                 $tmp_offset = $idx - $this->offset;
101
-                $lastChar   = $this->currentBuffer[ $idx - $this->offset ];
101
+                $lastChar   = $this->currentBuffer[$idx - $this->offset];
102 102
             } else {
103 103
                 //if it's out, simple use the last character of the chunk
104 104
                 $tmp_offset = $this->len - 1;
105
-                $lastChar   = $this->currentBuffer[ $this->len - 1 ];
105
+                $lastChar   = $this->currentBuffer[$this->len - 1];
106 106
             }
107 107
 
108 108
             // trim last space
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 } else {
137 137
                     //these are NOT source/seg-source/value empty tags, THERE IS A CONTENT, write it in buffer
138 138
                     $this->bufferIsActive = true;
139
-                    $this->CDATABuffer    .= $tag;
139
+                    $this->CDATABuffer .= $tag;
140 140
                 }
141 141
             } else {
142 142
                 $this->postProcAndFlush($this->outputFP, $tag);
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $endTags = "";
158 158
 
159
-        $segment     = Strings::removeDangerousChars($seg [ 'segment' ]);
160
-        $translation = Strings::removeDangerousChars($seg [ 'translation' ]);
159
+        $segment     = Strings::removeDangerousChars($seg ['segment']);
160
+        $translation = Strings::removeDangerousChars($seg ['translation']);
161 161
         $dataRefMap  = (isset($seg['data_ref_map']) and $seg['data_ref_map'] !== null) ? Strings::jsonToArray($seg['data_ref_map']) : [];
162 162
 
163
-        if (is_null($seg [ 'translation' ]) or $seg [ 'translation' ] == '') {
163
+        if (is_null($seg ['translation']) or $seg ['translation'] == '') {
164 164
             $translation = $segment;
165 165
         } else {
166 166
             if ($this->callback) {
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
         // for Trados the trailing spaces after </mrk> are meaningful
174 174
         // so we trim the translation from Matecat DB and add them after </mrk>
175 175
         $trailingSpaces = '';
176
-        for ($s=0; $s < Strings::getTheNumberOfTrailingSpaces($translation); $s++){
176
+        for ($s = 0; $s < Strings::getTheNumberOfTrailingSpaces($translation); $s++) {
177 177
             $trailingSpaces .= ' ';
178 178
         }
179 179
 
180
-        if ($seg[ 'mrk_id' ] !== null and $seg[ 'mrk_id' ] != '') {
180
+        if ($seg['mrk_id'] !== null and $seg['mrk_id'] != '') {
181 181
             if ($this->targetLang === 'ja-JP') {
182
-                $seg[ 'mrk_succ_tags' ] = ltrim($seg[ 'mrk_succ_tags' ]);
182
+                $seg['mrk_succ_tags'] = ltrim($seg['mrk_succ_tags']);
183 183
             }
184 184
 
185
-            $translation = "<mrk mid=\"" . $seg[ 'mrk_id' ] . "\" mtype=\"seg\">" . $seg[ 'mrk_prev_tags' ] . rtrim($translation) . $seg[ 'mrk_succ_tags' ] . "</mrk>" . $trailingSpaces;
185
+            $translation = "<mrk mid=\"" . $seg['mrk_id'] . "\" mtype=\"seg\">" . $seg['mrk_prev_tags'] . rtrim($translation) . $seg['mrk_succ_tags'] . "</mrk>" . $trailingSpaces;
186 186
         }
187 187
 
188 188
         // we need to trim succ_tags here because we already added the trailing spaces after </mrk>
189
-        $transUnitTranslation .= $seg[ 'prev_tags' ] . $translation . $endTags . ltrim($seg[ 'succ_tags' ]);
189
+        $transUnitTranslation .= $seg['prev_tags'] . $translation . $endTags . ltrim($seg['succ_tags']);
190 190
 
191 191
         return $transUnitTranslation;
192 192
     }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             'REJECTED'   => 'RejectedTranslation',
207 207
         ];
208 208
 
209
-        return "conf=\"{$statusMap[ $segment[ 'status' ] ]}\" ";
209
+        return "conf=\"{$statusMap[$segment['status']]}\" ";
210 210
     }
211 211
 
212 212
     /**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function setTransUnitState($seg, $state_prop, $lastMrkState)
220 220
     {
221
-        return [ null, null ];
221
+        return [null, null];
222 222
     }
223 223
 
224 224
     /**
Please login to merge, or discard this patch.
src/XliffReplacer/XliffReplacerFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     {
27 27
         $info = XliffProprietaryDetect::getInfo($originalXliffPath);
28 28
 
29
-        if ($info[ 'proprietary_short_name' ] !== 'trados') {
29
+        if ($info['proprietary_short_name'] !== 'trados') {
30 30
             return new XliffSAXTranslationReplacer($originalXliffPath, $info['version'], $data, $transUnits, $targetLang, $outputFilePath, $setSourceInTarget, $logger, $callback);
31 31
         }
32 32
 
Please login to merge, or discard this patch.
src/XliffReplacer/AbstractXliffReplacer.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 {
9 9
     protected $originalFP;
10 10
 
11
-    protected $tuTagName;                 // <trans-unit> (forXliff v 1.*) or <unit> (forXliff v 2.*)
12
-    protected $inTU                = false;  // flag to check whether we are in a <trans-unit>
13
-    protected $inTarget            = false;  // flag to check whether we are in a <target>, to ignore everything
14
-    protected $isEmpty             = false;  // flag to check whether we are in an empty tag (<tag/>)
15
-    protected $targetWasWritten    = false;  // flag to check is <target> was written in the current unit
16
-    protected $segmentPositionInTu = -1;  // the current position of segment in the current <unit> (forXliff v 2.*)
17
-
18
-    protected $CDATABuffer    = "";       // buffer for special tag
19
-    protected $bufferIsActive = false;    // buffer for special tag
20
-
21
-    protected $offset        = 0;         // offset for SAX pointer
22
-    protected $outputFP;                  // output stream pointer
23
-    protected $currentBuffer;             // the current piece of text it's been parsed
24
-    protected $len;                       // length of the currentBuffer
25
-    protected $segments;                  // array of translations
11
+    protected $tuTagName; // <trans-unit> (forXliff v 1.*) or <unit> (forXliff v 2.*)
12
+    protected $inTU                = false; // flag to check whether we are in a <trans-unit>
13
+    protected $inTarget            = false; // flag to check whether we are in a <target>, to ignore everything
14
+    protected $isEmpty             = false; // flag to check whether we are in an empty tag (<tag/>)
15
+    protected $targetWasWritten    = false; // flag to check is <target> was written in the current unit
16
+    protected $segmentPositionInTu = -1; // the current position of segment in the current <unit> (forXliff v 2.*)
17
+
18
+    protected $CDATABuffer    = ""; // buffer for special tag
19
+    protected $bufferIsActive = false; // buffer for special tag
20
+
21
+    protected $offset = 0; // offset for SAX pointer
22
+    protected $outputFP; // output stream pointer
23
+    protected $currentBuffer; // the current piece of text it's been parsed
24
+    protected $len; // length of the currentBuffer
25
+    protected $segments; // array of translations
26 26
     protected $lastTransUnit = [];
27
-    protected $currentTransUnitId;        // id of current <trans-unit>
27
+    protected $currentTransUnitId; // id of current <trans-unit>
28 28
     protected $currentTransUnitTranslate; // 'translate' attribute of current <trans-unit>
29
-    protected $currentSegmentArray = [];  // id of current <segment> (forXliff v 2.*)
30
-    protected $unitContainsMda = false;   // check if <unit> already contains a <mda:metadata> (forXliff v 2.*)
31
-    protected $hasWrittenCounts = false;  // check if <unit> already wrote segment counts (forXliff v 2.*)
32
-    protected $sourceAttributes = [];     // current <source> attributes (needed when handling xliff files without <target>)
29
+    protected $currentSegmentArray = []; // id of current <segment> (forXliff v 2.*)
30
+    protected $unitContainsMda = false; // check if <unit> already contains a <mda:metadata> (forXliff v 2.*)
31
+    protected $hasWrittenCounts = false; // check if <unit> already wrote segment counts (forXliff v 2.*)
32
+    protected $sourceAttributes = []; // current <source> attributes (needed when handling xliff files without <target>)
33 33
 
34 34
     protected $targetLang;
35 35
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         return "§" .
96 96
                 substr(
97 97
                     str_replace(
98
-                        [ '+', '/' ],
98
+                        ['+', '/'],
99 99
                         '',
100 100
                         base64_encode(openssl_random_pseudo_bytes(10, $_crypto_strong))
101 101
                     ),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     private function setTuTagName()
136 136
     {
137
-        $this->tuTagName = ($this->xliffVersion === 2) ? 'unit': 'trans-unit';
137
+        $this->tuTagName = ($this->xliffVersion === 2) ? 'unit' : 'trans-unit';
138 138
     }
139 139
 
140 140
     /**
Please login to merge, or discard this patch.
src/Constants/TranslationStatus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
             self::STATUS_REJECTED   => 5,
25 25
             self::STATUS_FIXED      => 6,
26 26
             self::STATUS_REBUTTED   => 7
27
-    ] ;
27
+    ];
28 28
 
29 29
     public static $STATUSES = array(
30 30
             self::STATUS_NEW,
Please login to merge, or discard this patch.
src/Constants/XliffTags.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
     /**
8 8
      * List of allowed Xliff tags
9 9
      */
10
-    public static $tags = [ 'g', 'x', 'bx', 'ex', 'bpt', 'ept', 'ph', 'pc', 'ec', 'sc', 'it', 'mrk' ];
10
+    public static $tags = ['g', 'x', 'bx', 'ex', 'bpt', 'ept', 'ph', 'pc', 'ec', 'sc', 'it', 'mrk'];
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.