Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function check( ?array $tmp = [] ): ?array { |
||
12 | $fileType = []; |
||
13 | |||
14 | if ( isset( $tmp[ 0 ] ) ) { |
||
15 | preg_match( '#tool-id\s*=\s*"matecat-converter(\s+([^"]+))?"#i', $tmp[ 0 ], $matches ); |
||
16 | if ( !empty( $matches ) ) { |
||
17 | $fileType[ 'proprietary' ] = false; |
||
18 | $fileType[ 'proprietary_name' ] = 'MateCAT Converter'; |
||
19 | $fileType[ 'proprietary_short_name' ] = 'matecat_converter'; |
||
20 | if ( isset( $matches[ 2 ] ) ) { |
||
21 | $fileType[ 'converter_version' ] = $matches[ 2 ]; |
||
22 | } else { |
||
23 | // First converter release didn't specify version |
||
24 | $fileType[ 'converter_version' ] = '1.0'; |
||
25 | } |
||
26 | |||
27 | return $fileType; |
||
28 | } |
||
29 | } |
||
30 | |||
31 | return null; |
||
32 | |||
35 |