1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
namespace Zend\Firebase\Authentication; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* PHP7 FIREBASE LIBRARY (http://samuelventimiglia.it/) |
7
|
|
|
* |
8
|
|
|
* |
9
|
|
|
* @link https://github.com/samuel20miglia/zend_Firebase |
10
|
|
|
* @copyright Copyright (c) 2016-now Ventimiglia Samuel - Biasin Davide |
11
|
|
|
* @license BSD 3-Clause License |
12
|
|
|
* |
13
|
|
|
*/ |
14
|
|
|
class FirebaseAuth |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Base uri of firebase database |
19
|
|
|
* |
20
|
|
|
* @var string $baseURI |
21
|
|
|
*/ |
22
|
|
|
private $baseURI; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Token provide from Firebase |
26
|
|
|
* |
27
|
|
|
* @var string $servertoken |
28
|
|
|
*/ |
29
|
|
|
private $serverToken; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* |
33
|
|
|
*/ |
34
|
|
|
public function __construct() |
35
|
|
|
{ |
36
|
|
|
// |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* |
41
|
|
|
* @return the $baseURI |
42
|
|
|
*/ |
43
|
|
|
public function getBaseURI(): string |
44
|
|
|
{ |
45
|
|
|
return $this->baseURI; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* |
50
|
|
|
* @return the $servertoken |
51
|
|
|
*/ |
52
|
|
|
public function getServertoken(): string |
53
|
|
|
{ |
54
|
|
|
return $this->serverToken; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Set String baseURI |
59
|
|
|
* |
60
|
|
|
* @param string $baseURI |
61
|
|
|
*/ |
62
|
|
|
public function setBaseURI($baseURI) |
63
|
|
|
{ |
64
|
|
|
if (\strlen($baseURI) == 0) { |
65
|
|
|
$str = 'You must provide a baseURI variable.'; |
66
|
|
|
trigger_error($str, E_USER_ERROR); |
67
|
|
|
} |
68
|
|
|
$baseURI .= (substr($baseURI, - 1) == '/' ? '' : '/'); |
69
|
|
|
|
70
|
|
|
$this->baseURI = \trim($baseURI); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Set string token |
75
|
|
|
* |
76
|
|
|
* @param string $servertoken |
77
|
|
|
*/ |
78
|
|
|
public function setServertoken($servertoken) |
79
|
|
|
{ |
80
|
|
|
if ($servertoken == '' || \strlen($servertoken) == 0) { |
81
|
|
|
$str = 'You must provide serverToken.'; |
82
|
|
|
trigger_error($str, E_USER_ERROR); |
83
|
|
|
} |
84
|
|
|
$this->serverToken = \trim($servertoken); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|