1 | <?php |
||
14 | class Facade |
||
15 | { |
||
16 | /** |
||
17 | * @var CredentialsInterface |
||
18 | */ |
||
19 | private static $credentials; |
||
20 | /** |
||
21 | * @var TransportInterface |
||
22 | */ |
||
23 | private static $transport; |
||
24 | /** |
||
25 | * @var PublicAPIClient |
||
26 | */ |
||
27 | private static $client; |
||
28 | /** |
||
29 | * @var LoggerInterface|null |
||
30 | */ |
||
31 | private static $logger; |
||
32 | |||
33 | /** |
||
34 | * Set logger |
||
35 | * |
||
36 | * @param LoggerInterface $logger |
||
37 | */ |
||
38 | public static function setLogger(LoggerInterface $logger) |
||
42 | |||
43 | /** |
||
44 | * Sets (or replaces) credentials |
||
45 | * |
||
46 | * @param CredentialsInterface $credentials |
||
47 | */ |
||
48 | public static function setCredentials(CredentialsInterface $credentials) |
||
52 | |||
53 | /** |
||
54 | * Sets (or replaces) transport |
||
55 | * |
||
56 | * @param TransportInterface $transport |
||
57 | */ |
||
58 | public static function setTransport(TransportInterface $transport) |
||
62 | |||
63 | /** |
||
64 | * Utility method to take client |
||
65 | * |
||
66 | * @return PublicAPIClient |
||
67 | * @throws Exception |
||
68 | */ |
||
69 | private static function getClient() |
||
81 | |||
82 | /** |
||
83 | * Sends request to Covery and returns access level, associated with |
||
84 | * used credentials |
||
85 | * |
||
86 | * This method can be used for Covery health check and availability |
||
87 | * On any problem (network, credentials, server side) this method |
||
88 | * will throw an exception |
||
89 | * |
||
90 | * @return mixed |
||
91 | * @throws Exception |
||
92 | */ |
||
93 | public static function ping() |
||
97 | |||
98 | /** |
||
99 | * Sends envelope to Covery and returns it's ID on Covery side |
||
100 | * Before sending, validation is performed |
||
101 | * |
||
102 | * @param EnvelopeInterface $envelope |
||
103 | * @return int |
||
104 | * @throws Exception |
||
105 | */ |
||
106 | public static function sendEvent(EnvelopeInterface $envelope) |
||
110 | |||
111 | /** |
||
112 | * Sends envelope to Covery for analysis |
||
113 | * |
||
114 | * @param EnvelopeInterface $envelope |
||
115 | * @return Result |
||
116 | * @throws Exception |
||
117 | */ |
||
118 | public static function makeDecision(EnvelopeInterface $envelope) |
||
122 | } |
||
123 |