| 1 | <?php |
||
| 21 | class XOrder implements XOrderInterface |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var \SimpleXMLElement |
||
| 26 | */ |
||
| 27 | public $xml; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Constructor |
||
| 31 | * |
||
| 32 | * To create an XOrder you can pass either a file path |
||
| 33 | * or the xml as a string. Just make sure to pass true |
||
| 34 | * as the second argument when passing a file path. |
||
| 35 | * |
||
| 36 | * @param string $xml |
||
| 37 | * @param boolean $file |
||
| 38 | */ |
||
| 39 | 10 | public function __construct($xml, $file = false) |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Get the string representation of the XML builder |
||
| 50 | * object. |
||
| 51 | * |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | 8 | public function getXML() |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Load the xml order from file. |
||
| 61 | * |
||
| 62 | * @param string $xml |
||
| 63 | * @throws \XOrder\Exceptions\FileDoesNotExistException |
||
| 64 | * @return \XOrder\XOrder |
||
| 65 | */ |
||
| 66 | 4 | public function fromFile($xml) |
|
| 76 | |||
| 77 | /** |
||
| 78 | * load the xml order from string. |
||
| 79 | * |
||
| 80 | * @param string $xml |
||
| 81 | * @return \XOrder\XOrder |
||
| 82 | */ |
||
| 83 | 6 | public function fromString($xml) |
|
| 89 | |||
| 90 | /** |
||
| 91 | * Get the string representation of the XML builder |
||
| 92 | * object. |
||
| 93 | * |
||
| 94 | * @return string |
||
| 95 | */ |
||
| 96 | 2 | public function __toString() |
|
| 100 | } |
||
| 101 |