assets
2 years ago
src
2 years ago
templates
2 years ago
autoload.php
2 years ago
index.php
2 years ago
main.php
2 years ago
sdk_resolver.php
2 years ago
version.php
2 years ago
main.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | require_once 'sdk_resolver.php'; |
| 4 | |
| 5 | |
| 6 | if (!function_exists('analyst_init')) { |
| 7 | /** |
| 8 | * Initialize analyst |
| 9 | * |
| 10 | * @param array $options |
| 11 | */ |
| 12 | function analyst_init ($options) { |
| 13 | // Try resolve latest supported SDK |
| 14 | // In case resolving is failed exit the execution |
| 15 | try { |
| 16 | analyst_resolve_sdk($options['base-dir']); |
| 17 | } catch (Exception $exception) { |
| 18 | // error_log('[ANALYST] Cannot resolve any supported SDK'); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | try { |
| 23 | global /** @var Analyst\Analyst $analyst */ |
| 24 | $analyst; |
| 25 | |
| 26 | // Set global instance of analyst |
| 27 | if (!$analyst) { |
| 28 | $analyst = Analyst\Analyst::getInstance(); |
| 29 | } |
| 30 | |
| 31 | $analyst->registerAccount(new Account\Account($options['client-id'], $options['client-secret'], $options['base-dir'])); |
| 32 | } catch (Exception $e) { |
| 33 | // error_log('Analyst SDK receive an error: [' . $e->getMessage() . '] Please contact our support at support@analyst.com'); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 |