| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | class Hybridauth |
||
| 16 | { |
||
| 17 | use SingletonTrait; |
||
| 18 | |||
| 19 | protected $hybridauth = null; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param $provider |
||
| 23 | * @return \Hybrid_User_Profile |
||
| 24 | */ |
||
| 25 | public function authenticate($provider, $params = null) |
||
| 26 | { |
||
| 27 | try { |
||
| 28 | /** @var \Hybrid_Provider_Model $adapter */ |
||
| 29 | $adapter = $this->getAuth()::authenticate($provider, $params); |
||
| 30 | // then grab the user profile |
||
| 31 | return $adapter->getUserProfile(); |
||
| 32 | } catch (Exception $e) { |
||
| 33 | /** @noinspection PhpIncompatibleReturnTypeInspection */ |
||
| 34 | return $e; |
||
|
|
|||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return null|Hybrid_Auth |
||
| 40 | */ |
||
| 41 | public function getAuth() |
||
| 42 | { |
||
| 43 | if ($this->hybridauth === null) { |
||
| 44 | $this->initAuth(); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $this->hybridauth; |
||
| 48 | } |
||
| 49 | |||
| 50 | protected function initAuth() |
||
| 55 | } |
||
| 56 | } |
||
| 57 |