1 | <?php |
||
9 | class Parser { |
||
10 | /** |
||
11 | * @var mixed |
||
12 | */ |
||
13 | protected $body; |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $rules; |
||
18 | |||
19 | /** |
||
20 | * Parser constructor. |
||
21 | */ |
||
22 | public function __construct($rules = []) |
||
23 | { |
||
24 | $this->body = json_decode(file_get_contents('php://input'), true); |
||
25 | $this->rules = count($rules) > 0 ? $rules : []; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * return all html from email. Just in case. |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | public function html() |
||
37 | |||
38 | /** |
||
39 | * return all text from email. You could do anything with this text. |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function text() |
||
47 | |||
48 | /** |
||
49 | * return basic order information from mikecrm email. |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | public function order() |
||
65 | |||
66 | /** |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function verify() |
||
73 | |||
74 | /** |
||
75 | * @param $rule |
||
76 | * @return string|string[]|null |
||
77 | */ |
||
78 | protected function getMatchText($rule) |
||
87 | } |
||
88 |