| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public static function parseFileId($fileId) { |
||
| 26 | $arr = explode('_', $fileId); |
||
| 27 | if (count($arr) === 1) { |
||
| 28 | $fileId = $arr[0]; |
||
| 29 | $instanceId = ''; |
||
| 30 | $version = '0'; |
||
| 31 | } else if (count($arr) === 2) { |
||
| 32 | list($fileId, $instanceId) = $arr; |
||
| 33 | $version = '0'; |
||
| 34 | } else if (count($arr) === 3) { |
||
| 35 | list($fileId, $instanceId, $version) = $arr; |
||
| 36 | } else { |
||
| 37 | throw new \Exception('$fileId has not the expected format'); |
||
| 38 | } |
||
| 39 | |||
| 40 | return [ |
||
| 41 | $fileId, |
||
| 42 | $instanceId, |
||
| 43 | $version, |
||
| 44 | ]; |
||
| 45 | } |
||
| 46 | |||
| 72 |