| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 5 | public function getParser() |
|
| 31 | { |
||
| 32 | 5 | $elementType = $this->getElementType(); |
|
| 33 | |||
| 34 | switch($elementType) |
||
| 35 | { |
||
| 36 | 5 | case "electricity" : |
|
| 37 | 2 | $parser = new \Dalen\OWLPacketInterceptor\Parser\SpecificParser\ElectricityXMLParser(); |
|
| 38 | 2 | $parser->setXMLElement($this->xmlElement); |
|
| 39 | 2 | return $parser; |
|
| 40 | 3 | case "solar" : |
|
| 41 | 2 | $parser = new \Dalen\OWLPacketInterceptor\Parser\SpecificParser\SolarXMLParser(); |
|
| 42 | 2 | $parser->setXMLElement($this->xmlElement); |
|
| 43 | 2 | return $parser; |
|
| 44 | 1 | default : |
|
| 45 | 1 | throw new PacketFormatNotSupportedException("packet type $elementType not supported"); |
|
| 46 | 1 | } |
|
| 47 | } |
||
| 48 | } |
||
| 49 |