| 1 | <?php |
||
| 21 | class XOrderValidator |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | public $errors = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | public $schema = '/Schema/XOrderSchema.xsd'; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var \XOrder\XOrder |
||
| 36 | */ |
||
| 37 | public $xorder; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Constructor |
||
| 41 | * |
||
| 42 | * @param XOrder\XOrder $xorder |
||
| 43 | */ |
||
| 44 | 12 | public function __construct(XOrder $xorder) |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Get the schema file. |
||
| 51 | * |
||
| 52 | * @param string|null $schema |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | 10 | public function getSchema($schema = null) |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Validate the xml document against the xOrder Schema. Or |
||
| 70 | * you can pass in the path to your preferred schema. |
||
| 71 | * |
||
| 72 | * @param string|null $schema |
||
| 73 | * @throws \XOrder\Exceptions\XOrderValidationException |
||
| 74 | * @return boolean |
||
| 75 | */ |
||
| 76 | 4 | public function validate($schema = null) |
|
| 92 | } |
||
| 93 |