1 | <?php |
||
21 | class AuthController implements AuthInterface |
||
22 | { |
||
23 | protected $key; |
||
24 | protected $userID; |
||
25 | protected $auth_url; |
||
26 | protected $issued_by; |
||
27 | |||
28 | public function __construct () |
||
36 | |||
37 | /** |
||
38 | * getKey Get the ISSUE_KEY value |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function getKey () |
||
46 | |||
47 | /** |
||
48 | * getIssuedBy Get the ISSUED_BY value |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public function getIssuedBy () |
||
56 | |||
57 | /** |
||
58 | * getAuthUrl Get the AUTH_URL value |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getAuthUrl () |
||
66 | |||
67 | /** |
||
68 | * getAuthUrl Get the TEST_TOKEN value |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getTestToken () |
||
76 | |||
77 | /** |
||
78 | * authorizationEncode Generate token using $userID |
||
79 | * |
||
80 | * @param $userID |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function authorizationEncode ($userID) |
||
95 | |||
96 | /** |
||
97 | * authorizationDecode Decode token |
||
98 | * |
||
99 | * @param $token |
||
100 | * |
||
101 | * @return json |
||
102 | */ |
||
103 | public function authorizationDecode ($token) |
||
112 | |||
113 | /** |
||
114 | * Encrypt user password |
||
115 | * |
||
116 | * @param $password |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public function passwordEncrypt ($password) |
||
128 | |||
129 | /** |
||
130 | * Decrypt user password |
||
131 | * |
||
132 | * @param $password |
||
133 | * |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function passwordDecrypt ($password, $hashPassword) |
||
144 | |||
145 | /** |
||
146 | * Load .env data |
||
147 | */ |
||
148 | protected function loadEnv () |
||
156 | } |
||
157 |
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: