1 | <?php |
||
7 | class PeopleMatter |
||
8 | { |
||
9 | const V3 = 'v3'; |
||
10 | |||
11 | protected $host; |
||
12 | protected $version; |
||
13 | protected $client; |
||
14 | protected $token; |
||
15 | |||
16 | /** |
||
17 | * Creates a PeopleMatter instance that can register and unregister webhooks with the API |
||
18 | * @param string $username The Username |
||
19 | * @param string $password The Password |
||
20 | * @param string $alias The business alias |
||
21 | * @param string $host The host to connect to |
||
22 | * @param Client|null $client The Guzzle client (used for testing) |
||
23 | */ |
||
24 | 3 | public function __construct($username, $password, $alias, $host = "api.peoplematter.com", Client $client = null) |
|
32 | |||
33 | public function hire() |
||
37 | |||
38 | protected function login() |
||
46 | |||
47 | /** |
||
48 | * Returns the Client instance |
||
49 | * @return Client |
||
50 | */ |
||
51 | protected function getClient() |
||
59 | |||
60 | /** |
||
61 | * Executes a request to the PeopleMatter API |
||
62 | * @param string $url The URL to send to |
||
63 | * @return mixed The response data |
||
64 | */ |
||
65 | protected function request($method, $url, $data) |
||
71 | } |
||
72 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: