@@ -26,7 +26,7 @@ |
||
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 |
@@ -7,5 +7,5 @@ |
||
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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public static function flatArray(array $input = [], $separator_elements = ', ', $separator = ': ') |
13 | 13 | { |
14 | 14 | return implode($separator_elements, array_map( |
15 | - function ($v, $k, $s) { |
|
15 | + function($v, $k, $s) { |
|
16 | 16 | return sprintf("%s{$s}\"%s\"", $k, $v); |
17 | 17 | }, |
18 | 18 | $input, |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | preg_match('|<xliff.*?\sversion\s?=\s?["\'](.*?)["\']|si', substr($xliffContent, 0, 1000), $versionMatches); |
30 | 30 | |
31 | - if (empty($versionMatches) ) { |
|
31 | + if (empty($versionMatches)) { |
|
32 | 32 | throw new NotValidFileException('This is not a valid xliff file'); |
33 | 33 | } |
34 | 34 |
@@ -13,12 +13,12 @@ |
||
13 | 13 | { |
14 | 14 | $fileType = []; |
15 | 15 | |
16 | - if (isset($tmp[ 0 ])) { |
|
17 | - if (stripos($tmp[ 0 ], 'globalsight') !== false) { |
|
18 | - $fileType[ 'proprietary' ] = true; |
|
19 | - $fileType[ 'proprietary_name' ] = 'GlobalSight Download File'; |
|
20 | - $fileType[ 'proprietary_short_name' ] = 'globalsight'; |
|
21 | - $fileType[ 'converter_version' ] = 'legacy'; |
|
16 | + if (isset($tmp[0])) { |
|
17 | + if (stripos($tmp[0], 'globalsight') !== false) { |
|
18 | + $fileType['proprietary'] = true; |
|
19 | + $fileType['proprietary_name'] = 'GlobalSight Download File'; |
|
20 | + $fileType['proprietary_short_name'] = 'globalsight'; |
|
21 | + $fileType['converter_version'] = 'legacy'; |
|
22 | 22 | |
23 | 23 | return $fileType; |
24 | 24 | } |
@@ -13,17 +13,17 @@ |
||
13 | 13 | { |
14 | 14 | $fileType = []; |
15 | 15 | |
16 | - if (isset($tmp[ 0 ])) { |
|
17 | - preg_match('#tool-id\s*=\s*"matecat-converter(\s+([^"]+))?"#i', $tmp[ 0 ], $matches); |
|
16 | + if (isset($tmp[0])) { |
|
17 | + preg_match('#tool-id\s*=\s*"matecat-converter(\s+([^"]+))?"#i', $tmp[0], $matches); |
|
18 | 18 | if (!empty($matches)) { |
19 | - $fileType[ 'proprietary' ] = false; |
|
20 | - $fileType[ 'proprietary_name' ] = 'MateCAT Converter'; |
|
21 | - $fileType[ 'proprietary_short_name' ] = 'matecat_converter'; |
|
22 | - if (isset($matches[ 2 ])) { |
|
23 | - $fileType[ 'converter_version' ] = $matches[ 2 ]; |
|
19 | + $fileType['proprietary'] = false; |
|
20 | + $fileType['proprietary_name'] = 'MateCAT Converter'; |
|
21 | + $fileType['proprietary_short_name'] = 'matecat_converter'; |
|
22 | + if (isset($matches[2])) { |
|
23 | + $fileType['converter_version'] = $matches[2]; |
|
24 | 24 | } else { |
25 | 25 | // First converter release didn't specify version |
26 | - $fileType[ 'converter_version' ] = '1.0'; |
|
26 | + $fileType['converter_version'] = '1.0'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return $fileType; |
@@ -8,13 +8,13 @@ |
||
8 | 8 | { |
9 | 9 | $fileType = []; |
10 | 10 | |
11 | - if (isset($tmp[ 0 ])) { |
|
12 | - if (stripos($tmp[ 0 ], 'sdl:version') !== false) { |
|
11 | + if (isset($tmp[0])) { |
|
12 | + if (stripos($tmp[0], 'sdl:version') !== false) { |
|
13 | 13 | //little trick, we consider not proprietary Sdlxliff files because we can handle them |
14 | - $fileType[ 'proprietary' ] = false; |
|
15 | - $fileType[ 'proprietary_name' ] = 'SDL Studio '; |
|
16 | - $fileType[ 'proprietary_short_name' ] = 'trados'; |
|
17 | - $fileType[ 'converter_version' ] = 'legacy'; |
|
14 | + $fileType['proprietary'] = false; |
|
15 | + $fileType['proprietary_name'] = 'SDL Studio '; |
|
16 | + $fileType['proprietary_short_name'] = 'trados'; |
|
17 | + $fileType['converter_version'] = 'legacy'; |
|
18 | 18 | |
19 | 19 | return $fileType; |
20 | 20 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | self::STATUS_REBUTTED |
54 | 54 | ]; |
55 | 55 | |
56 | - public static function isReviewedStatus( $status ) { |
|
57 | - return in_array( $status, TranslationStatus::$REVISION_STATUSES ); |
|
56 | + public static function isReviewedStatus($status) { |
|
57 | + return in_array($status, TranslationStatus::$REVISION_STATUSES); |
|
58 | 58 | } |
59 | 59 | } |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array |
52 | 52 | */ |
53 | - private static function getInfoFromTmp( $tmp) |
|
53 | + private static function getInfoFromTmp($tmp) |
|
54 | 54 | { |
55 | 55 | try { |
56 | 56 | self::checkVersion($tmp); |
57 | - } catch ( Exception $ignore) { |
|
57 | + } catch (Exception $ignore) { |
|
58 | 58 | // do nothing |
59 | 59 | // self::$fileType[ 'version' ] is left empty |
60 | 60 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // run CheckXliffProprietaryPipeline |
63 | 63 | $pipeline = self::runPipeline($tmp); |
64 | 64 | |
65 | - self::$fileType['proprietary' ] = $pipeline['proprietary' ]; |
|
66 | - self::$fileType[ 'proprietary_name' ] = $pipeline['proprietary_name' ]; |
|
67 | - self::$fileType[ 'proprietary_short_name' ] = $pipeline['proprietary_short_name' ]; |
|
68 | - self::$fileType[ 'converter_version' ] = $pipeline['converter_version' ]; |
|
65 | + self::$fileType['proprietary'] = $pipeline['proprietary']; |
|
66 | + self::$fileType['proprietary_name'] = $pipeline['proprietary_name']; |
|
67 | + self::$fileType['proprietary_short_name'] = $pipeline['proprietary_short_name']; |
|
68 | + self::$fileType['converter_version'] = $pipeline['converter_version']; |
|
69 | 69 | |
70 | 70 | return self::$fileType; |
71 | 71 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | if (!empty($stringData)) { |
131 | - return array( $stringData ); |
|
131 | + return array($stringData); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return false; |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected static function checkVersion($tmp) |
144 | 144 | { |
145 | - if (isset($tmp[ 0 ])) { |
|
146 | - self::$fileType[ 'version' ] = XliffVersionDetector::detect($tmp[ 0 ]); |
|
145 | + if (isset($tmp[0])) { |
|
146 | + self::$fileType['version'] = XliffVersionDetector::detect($tmp[0]); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | // run CheckXliffProprietaryPipeline |
166 | 166 | $pipeline = self::runPipeline($tmp); |
167 | 167 | |
168 | - self::$fileType['proprietary' ] = $pipeline['proprietary' ]; |
|
169 | - self::$fileType[ 'proprietary_name' ] = $pipeline['proprietary_name' ]; |
|
170 | - self::$fileType[ 'proprietary_short_name' ] = $pipeline['proprietary_short_name' ]; |
|
171 | - self::$fileType[ 'converter_version' ] = $pipeline['converter_version' ]; |
|
168 | + self::$fileType['proprietary'] = $pipeline['proprietary']; |
|
169 | + self::$fileType['proprietary_name'] = $pipeline['proprietary_name']; |
|
170 | + self::$fileType['proprietary_short_name'] = $pipeline['proprietary_short_name']; |
|
171 | + self::$fileType['converter_version'] = $pipeline['converter_version']; |
|
172 | 172 | |
173 | 173 | return self::$fileType; |
174 | 174 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | //if file is not proprietary AND Enforce is disabled |
199 | 199 | //we take it as is |
200 | - if (!$fileType[ 'proprietary' ] || $memoryFileType) { |
|
200 | + if (!$fileType['proprietary'] || $memoryFileType) { |
|
201 | 201 | $convert = false; |
202 | 202 | //ok don't convert a standard sdlxliff |
203 | 203 | } |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | //if conversion enforce is active |
206 | 206 | //we force all xliff files but not files produced by SDL Studio because we can handle them |
207 | 207 | if ( |
208 | - $fileType[ 'proprietary_short_name' ] == 'matecat_converter' |
|
209 | - || $fileType[ 'proprietary_short_name' ] == 'trados' |
|
210 | - || $fileType[ 'proprietary_short_name' ] == 'xliff_v2' |
|
208 | + $fileType['proprietary_short_name'] == 'matecat_converter' |
|
209 | + || $fileType['proprietary_short_name'] == 'trados' |
|
210 | + || $fileType['proprietary_short_name'] == 'xliff_v2' |
|
211 | 211 | || $memoryFileType |
212 | 212 | ) { |
213 | 213 | $convert = false; |
214 | 214 | //ok don't convert a standard sdlxliff |
215 | 215 | } |
216 | 216 | } |
217 | - } elseif ($fileType[ 'proprietary' ]) { |
|
217 | + } elseif ($fileType['proprietary']) { |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * Application misconfiguration. |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $convert = -1; |
226 | 226 | //stop execution |
227 | - } elseif (!$fileType[ 'proprietary' ]) { |
|
227 | + } elseif (!$fileType['proprietary']) { |
|
228 | 228 | $convert = false; |
229 | 229 | //ok don't convert a standard sdlxliff |
230 | 230 | } |