| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function convertAzureUser($azure_user) |
||
| 16 | { |
||
| 17 | $user_class = config('enterpriseauth.user_class'); |
||
| 18 | $user_map = config('enterpriseauth.user_map'); |
||
| 19 | $id_field = config('enterpriseauth.user_id_field'); |
||
| 20 | |||
| 21 | $new_user = new $user_class(); |
||
| 22 | $new_user->$id_field = $azure_user->id; |
||
| 23 | //$new_user->password = bcrypt(''); |
||
| 24 | |||
| 25 | foreach ($user_map as $azure_field => $user_field) { |
||
| 26 | $new_user->$user_field = $azure_user->$azure_field; |
||
| 27 | } |
||
| 28 | |||
| 29 | $callback = static::$user_callback; |
||
| 30 | |||
| 31 | if ($callback && is_callable($callback)) { |
||
| 32 | $callback($new_user); |
||
| 33 | } |
||
| 34 | |||
| 35 | $new_user->save(); |
||
| 36 | |||
| 37 | return $new_user; |
||
| 38 | } |
||
| 49 |