1 | <?php |
||
13 | final class Security implements Common |
||
14 | { |
||
15 | const TEST_TOKEN = '7c0c2193d27108a509abd8ea84a8750c82b3a520'; |
||
16 | |||
17 | const PROD_API_HOST = 'https://openapi.e.lanbook.com'; |
||
18 | const TEST_API_HOST = 'http://openapi.landev.ru'; |
||
19 | const DEV_API_HOST = 'http://eop.local'; |
||
20 | |||
21 | const PROD_EBS_HOST = 'https://e.lanbook.com'; |
||
22 | const TEST_EBS_HOST = 'http://ebs.landev.ru'; |
||
23 | const DEV_EBS_HOST = 'http://ebs.local'; |
||
24 | |||
25 | private $client; |
||
26 | |||
27 | /** |
||
28 | * Security constructor. |
||
29 | * |
||
30 | * @param Client $client |
||
31 | * @throws Exception |
||
32 | */ |
||
33 | 2 | public function __construct(Client $client) |
|
41 | |||
42 | 2 | public function getUrl($method, array $params = []) |
|
67 | |||
68 | 1 | public function getDemoUrl($type, $id) |
|
72 | |||
73 | 1 | public function getAutologinUrl($uid, $fio = null, $email = null, $redirect = null) { |
|
85 | |||
86 | public static function getApiHost() |
||
90 | |||
91 | public static function getEbsHost() |
||
95 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: