1 | <?php |
||
11 | class FactomConnector |
||
12 | { |
||
13 | /** |
||
14 | * The JSON RPC spec that the API uses. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | const JSON_RPC = '2.0'; |
||
19 | |||
20 | /** |
||
21 | * The "ID" param provided in all requests to the API. |
||
22 | * |
||
23 | * @var integer |
||
24 | */ |
||
25 | const REQUEST_ID = 0; |
||
26 | |||
27 | /** |
||
28 | * The header content type in all requests to the API. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | const HEADER_CONTENT_TYPE = 'text/plain'; |
||
33 | |||
34 | /** |
||
35 | * The header accept in all requests to the API. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | const HEADER_ACCEPT = 'application/json'; |
||
40 | |||
41 | /** |
||
42 | * The generic error if cannot load server properly. |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | const BLANK_PAGE_ERROR = 'Page not found'; |
||
47 | |||
48 | /** |
||
49 | * The client instance. |
||
50 | * |
||
51 | * @var null|GuzzleHttp\Client |
||
52 | */ |
||
53 | protected $client = null; |
||
54 | |||
55 | /** |
||
56 | * The URL for all API requests. |
||
57 | * |
||
58 | * @var null|string |
||
59 | */ |
||
60 | protected $url = 'http://localhost:8088/v2'; |
||
61 | |||
62 | /** |
||
63 | * Make secure URL requests. |
||
64 | * |
||
65 | * @var null|bool |
||
66 | */ |
||
67 | protected $ssl = false; |
||
68 | |||
69 | /** |
||
70 | * Path to the certificate file for using factomd over TLS. |
||
71 | * |
||
72 | * @var null |
||
73 | */ |
||
74 | protected $certifcate = null; |
||
75 | |||
76 | /** |
||
77 | * The provided username for interacting with factomd |
||
78 | * Optional. |
||
79 | * |
||
80 | * @var null |
||
81 | */ |
||
82 | protected $username = null; |
||
83 | |||
84 | /** |
||
85 | * The provided password for interacting with factomd |
||
86 | * Optional. |
||
87 | * |
||
88 | * @var null |
||
89 | */ |
||
90 | protected $password = null; |
||
91 | |||
92 | public function __construct(string $url, bool $ssl = false, string $certificate = null, string $username = null, string $password = null) |
||
129 | |||
130 | /** |
||
131 | * Call the requested endpoint. |
||
132 | * |
||
133 | * @param string $actionName |
||
134 | * @param array $params |
||
135 | * @param array $extraOptions |
||
136 | * |
||
137 | * @return object|string |
||
138 | * |
||
139 | * @throws Exception When a Guzzle error occurs |
||
140 | */ |
||
141 | public function callEndpoint(string $action, string $method, array $params = [], array $extraOptions = []) |
||
219 | } |
||
220 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.