1 | <?php |
||
15 | class Authentication |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * The information about the authentication URL. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $urlInfo = array(); |
||
24 | |||
25 | /** |
||
26 | * Request headers with username, API key and User-Agent. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $headers = array(); |
||
31 | |||
32 | /** |
||
33 | * User-Agent for request. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $userAgent = null; |
||
38 | |||
39 | /** |
||
40 | * Request timeout. |
||
41 | * |
||
42 | * @var integer |
||
43 | */ |
||
44 | protected $timeout = 5; |
||
45 | |||
46 | /** |
||
47 | * The class constructor. |
||
48 | * |
||
49 | * @param string $username |
||
50 | * @param string $apiKey |
||
51 | * @param string $url |
||
52 | * @param string $userAgent |
||
53 | * @param integer $timeout |
||
54 | */ |
||
55 | public function __construct($username, $apiKey, $url, $userAgent, $timeout = 5) |
||
65 | |||
66 | /** |
||
67 | * Initiates authentication with the remote service and returns a |
||
68 | * array containing the storage system URL, CDN URL (can be empty) |
||
69 | * and session token. |
||
70 | * |
||
71 | * @return array |
||
72 | * @throws \Exception|\OpenStackStorage\Exceptions\ResponseError |
||
73 | * @throws \OpenStackStorage\Exceptions\AuthenticationError |
||
74 | * @throws \OpenStackStorage\Exceptions\AuthenticationFailed |
||
75 | * @throws \Exception |
||
76 | */ |
||
77 | public function authenticate() |
||
132 | } |
||
133 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: