Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public static function fileVersionOf($path) |
||
36 | { |
||
37 | $file = fopen(realpath($path), 'r'); |
||
38 | $header = fgets($file); |
||
39 | fclose($file); |
||
40 | |||
41 | $size = strlen(trim($header)); |
||
42 | |||
43 | if ( ! in_array($size, [240, 400])) { |
||
44 | throw new RangeException('Invalid CNAB file version. Size ' . $size); |
||
45 | } |
||
46 | |||
47 | return $size; |
||
48 | } |
||
49 | } |
||
50 |