| Conditions | 4 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 34 | public static function parseRepresentationToClass($inputRepresentation) |
||
| 35 | { |
||
| 36 | $version = substr($inputRepresentation, -2); |
||
| 37 | $representation = substr($inputRepresentation, 0, -3); |
||
| 38 | |||
| 39 | switch (substr($representation, 0, 7)) { |
||
| 40 | case "vnd.ccp": // EVE |
||
| 41 | $data = explode(".", $representation); |
||
| 42 | array_shift($data); |
||
| 43 | array_shift($data); |
||
| 44 | array_shift($data); |
||
| 45 | $classname = '\Perry\Representation\Eve\\'.$version.'\\'.$data[0]; |
||
| 46 | break; |
||
| 47 | case "net.3rd": // OldApi |
||
| 48 | $data = explode(".", $representation); |
||
| 49 | array_shift($data); |
||
| 50 | array_shift($data); |
||
| 51 | array_shift($data); |
||
| 52 | |||
| 53 | $classname = '\Perry\Representation\OldApi\\'.$version.'\\'.$data[0]; |
||
| 54 | if (count($data) > 1) { |
||
| 55 | $classname .= '\\'.$data[1]; |
||
| 56 | } |
||
| 57 | break; |
||
| 58 | default: |
||
| 59 | throw new \Exception("wtf, what representation is this? ".$inputRepresentation); |
||
| 60 | } |
||
| 61 | |||
| 62 | return $classname; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |