| 1 | <?php |
||
| 8 | class Parser |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Data type |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | private $type; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Object constructor |
||
| 19 | * |
||
| 20 | * @param string $type data type for parsing a proper parsing method will be used |
||
| 21 | * according this value. |
||
| 22 | * |
||
| 23 | */ |
||
| 24 | 7 | public function __construct($type) |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Parse data according their type. |
||
| 31 | * |
||
| 32 | * @param mixed $data data for parsing |
||
| 33 | * |
||
| 34 | * @return mixed Type of returned valus is based on type of data if the type is XML |
||
| 35 | * an instance of SimpleXMLElement is returned, else an array is returned |
||
| 36 | * If the data type is not support a null is returned. |
||
| 37 | */ |
||
| 38 | 7 | public function parse($data) |
|
| 62 | } |
||
| 63 |