@param array $user

@return \Overtrue\Socialite\User
487675
protected function mapUserToObject(array $user)
    {
        if ($this->detailed) {
            return new User([
                'id' => $this->arrayItem($user, 'userid'),
                'name' => $this->arrayItem($user, 'name'),
                'avatar' => $this->arrayItem($user, 'avatar'),
                'email' => $this->arrayItem($user, 'email'),
            ]);
        }

        return new User(array_filter([
            'id' => $this->arrayItem($user, 'UserId') ?: $this->arrayItem($user, 'OpenId'),
            'userId' => $this->arrayItem($user, 'UserId'),
            'openid' => $this->arrayItem($user, 'OpenId'),
            'deviceId' => $this->arrayItem($user, 'DeviceId'),
        ]));
    }
39648
public function unfollow($user)
	{
		// Build the request path.
		$path = '/user/following/' . $user;

		return $this->processResponse(
			$this->client->delete($this->fetchUrl($path)),
			204
		);
	}
90812
public function makeUserLoggedIn($user)
    {
        if (!is_array($user) && !is_object($user)) {
            $user = $this->getUser($user);
        } elseif (!($user instanceof UserDataInterface)) {
            $user = new UserData($user);
        }

        if ($user->isNull()) {
            return false;
        }

        return $this->getHandler()->login($user);
    }
886722
public function userToRooms($user)
    {
        $url          = $this->url.'users/'.$user.'/joined_chatrooms';
        $option       = [];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'GET');
    }
406455
public function create($user)
    {
        $user = User::findOrFail($user->id);

        return $user->hasPermission('laralum::users.create') || $user->superAdmin();
    }
1169724
public function socialUpdate($provider, User $user)
    {
        $this->getProviderDetails($provider);

        // Get the users.
        $socialUser = $this->getSocialUser();

        // Update or create provider details.
        $this->updateFromProvider($user, $socialUser);

        return $socialUser;
    }
1173382
public function persistUser(User $user)
    {
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        return $user;
    }
239660
public function make($user)
    {
        $RagnarokUser = new SecUser();
        $this->userRagnarok = $RagnarokUser->populate($user);
        Session::put($this->getName(), $this->userRagnarok);
        return $this->userRagnarok;
    }
231533
public function validator(User $user, array $data)
    {
        return Validator::make($data, [
            'name'                  => 'required|max:255|unique:users,name,'.$user->id,
            'email'                 => 'required|email|max:255|unique:users,email,'.$user->id,
            'password'              => 'confirmed|min:6',
            'birthday_at'           => 'date|before:now',
            'gender'                => 'in:male,female',
            'locale'                => 'required|size:2',
            'homepage'              => 'url|max:100',
            'skype'                 => 'min:6|max:32',
            'facebook'              => 'url|max:50',
            'twitter'               => 'url|max:50',
            'main_character'        => 'min:2|max:20',
            'main_guild'            => 'max:50',
            'favorite_race'         => 'max:20',
            'favorite_class'        => 'max:20',
            'favorite_spec'         => 'max:20',
            'favorite_instance'     => 'max:50',
            'favorite_battleground' => 'max:50',
        ]);
    }
70283
public function getLastPinsFromUser($user)
  {
    $pins = array();
    libxml_use_internal_errors(true);
    $xml = @simplexml_load_file('https://www.pinterest.com/'.$user.'/feed.rss');
    if($xml !== false) {
      for($i = 0; $i < 50; $i++) {
        if(!isset($xml->channel->item[$i])) {
          break;
        }
        $datas = array();
        $tags = array();
        preg_match ('/<img src=\"(?<media>.+?)\"><\/a><\/p><p>(?<text>.+?)<\/p>/', $xml->channel->item[$i]->description, $datas);
        preg_match_all('/(?<=#)\w+/', $datas['text'], $tags);
        $pins[] = array(
          'url'       => $xml->channel->item[$i]->link->asXML(),
          'media'     => $datas['media'],
          'text'      => $datas['text'],
          'tags'      => $tags[0],
          'timestamp' => strtotime($xml->channel->item[$i]->pubDate)
        );
      }
      return $pins;
    } else {
      $error = libxml_get_last_error();
      return $this->debug_mode && $error ? $error->message : null;
    }
  }
219756
public function registeredToCustomer(array $user)
    {
        $store = $this->store->get($user['store_id']);
        $options = $this->store->getConfig(null, $store);
        $store_name = $this->store->getTranslation('title', $this->translation->getLangcode(), $store);
        $base = $this->store->getUrl($store);

        $vars = array(
            '@store' => $store_name,
            '@name' => $user['name'],
            '@order' => "$base/account/{$user['user_id']}",
            '@edit' => "$base/account/{$user['user_id']}/edit",
            '@status' => empty($user['status']) ? $this->translation->text('Inactive') : $this->translation->text('Active')
        );

        $subject = $this->translation->text('Account details for @name on @store', $vars);
        $message = $this->translation->text("Thank you for registering on @store\r\n\r\nAccount status: @status\r\n\r\nEdit account: @edit\r\nView orders: @order", $vars);
        $message .= $this->getSignature($options);

        $options['from'] = $this->store->getConfig('email.0', $store);
        return array($user['email'], $subject, $message, $options);
    }
169393
public function to(User $user)
    {
        $this->user = $user;
        $this->request['touser'] = $user['wechatOpenId'];

        return $this;
    }
1173831
public function serialize($user, array $options = [])
    {
        if (isset($options['public']) && $options['public']) {
            // TODO : remove me (only used by BBBPlugin and it's not maintained)
            return $this->serializePublic($user);
        }

        $serializedUser = [
            'autoId' => $user->getId(), //for old compatibility purposes
            'id' => $user->getUuid(),
            'name' => $user->getFirstName().' '.$user->getLastName(),
            'firstName' => $user->getFirstName(),
            'lastName' => $user->getLastName(),
            'username' => $user->getUsername(),
            'picture' => $this->serializePicture($user),
            'email' => $user->getEmail(),
            'administrativeCode' => $user->getAdministrativeCode(),
            'phone' => $user->getPhone(),
            'meta' => $this->serializeMeta($user),
            'publicUrl' => $user->getPublicUrl(), // todo : merge with the one from meta (I do it to have it in minimal)
            'permissions' => $this->serializePermissions($user),
            'restrictions' => $this->serializeRestrictions($user),
        ];

        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $userRoles = array_map(function (Role $role) { // todo use role serializer with minimal option
                return [
                    'id' => $role->getUuid(),
                    'type' => $role->getType(),
                    'name' => $role->getName(),
                    'translationKey' => $role->getTranslationKey(),
                    'workspace' => $role->getWorkspace() ? ['id' => $role->getWorkspace()->getUuid()] : null,
                    'context' => 'user',
                ];
            }, $user->getEntityRoles(false));
            $groupRoles = array_map(function (Role $role) { // todo use role serializer with minimal option
                return [
                    'id' => $role->getUuid(),
                    'type' => $role->getType(),
                    'name' => $role->getName(),
                    'translationKey' => $role->getTranslationKey(),
                    'workspace' => $role->getWorkspace() ? ['id' => $role->getWorkspace()->getUuid()] : null,
                    'context' => 'group',
                ];
            }, $user->getGroupRoles());

            $serializedUser = array_merge($serializedUser, [
                'meta' => $this->serializeMeta($user),
                'restrictions' => $this->serializeRestrictions($user),
                'roles' => array_merge($userRoles, $groupRoles),
                'groups' => array_map(function (Group $group) { // todo use group serializer with minimal option
                    return [
                        'id' => $group->getUuid(),
                        'name' => $group->getName(),
                    ];
                }, $user->getGroups()->toArray()),
            ]);

            if ($user->getMainOrganization()) {
                $serializedUser['mainOrganization'] = $this->organizationSerializer->serialize($user->getMainOrganization());
            }

            $serializedUser['administratedOrganizations'] = array_map(function ($organization) {
                return $this->organizationSerializer->serialize($organization);
            }, $user->getAdministratedOrganizations()->toArray());
        }

        if (in_array(Options::SERIALIZE_FACET, $options)) {
            $fields = $this->om
                ->getRepository('Claroline\CoreBundle\Entity\Facet\FieldFacetValue')
                ->findPlatformValuesByUser($user);
            $serializedUser['facets'] = [];

            /** @var FieldFacetValue $field */
            foreach ($fields as $field) {
                // we just flatten field facets in the base user structure
                $serializedUser['profile'][$field->getFieldFacet()->getUuid()] = $field->getValue();
            }
        }

        return $this->decorate($user, $serializedUser);
    }
789259
public function getUserDashboards(array $user): QueryInterface
    {
        // get all dashboards
        $query = $this->find('all')->order('name');

        // return all dashboards if current user is superuser
        if (isset($user['is_superuser']) && $user['is_superuser']) {
            return $query;
        }

        $roles = [];
        /** @var \Groups\Model\Table\GroupsTable */
        $table = $this->Roles->Groups->getTarget();
        $groups = $table->getUserGroups($user['id']);
        // get group(s) roles
        if (!empty($groups)) {
            $roles = $this->Roles->Capabilities->getGroupsRoles($groups);
        }

        if (empty($roles)) {
            // get all dashboards not assigned to any role
            $query->where(['Dashboards.role_id IS NULL']);

            return $query;
        }

        // return all dashboards for Admins
        if (in_array(Configure::read('RolesCapabilities.Roles.Admin.name'), $roles)) {
            return $query;
        }

        // get role(s) dashboards
        $query->where(['OR' => [
            ['Dashboards.role_id IN' => array_keys($roles)],
            ['Dashboards.role_id IS NULL']
        ]]);

        return $query;
    }
973351
protected function mapUserToObject(array $user)
    {
        return (new User)->setRaw($user)->map([
            'id' => Arr::get($user, 'sub'),
            'email' => Arr::get($user, 'email'),
            'email_verified' => Arr::get($user, 'email_verified', false),
            'nickname' => Arr::get($user, 'nickname'),
            'name' => Arr::get($user, 'name'),
            'first_name' => Arr::get($user, 'given_name'),
            'last_name' => Arr::get($user, 'family_name'),
            'profileUrl' => Arr::get($user, 'profile'),
            'address' => Arr::get($user, 'address'),
            'phone' => Arr::get($user, 'phone'),
        ]);
    }
102876
public function userCreate($user)
    {
        $this->dispatchHooks('BeforeUserCreateScope', $user);
        $this->parseEntityFields('user', $user);
        $this->getDriver()->userCreate($user);
        $this->dispatchHooks('AfterUserCreateScope', $user);
        $this->userManager->addUser($user);
        return $user;
    }
391846
protected function mapUserToObject(array $user): User
    {

        return (new User)->setRaw($user)->map([
            'character_id'         => $user['CharacterID'],
            'name'                 => $user['CharacterName'],
            'character_owner_hash' => $user['CharacterOwnerHash'],
            'scopes'               => $user['Scopes'],
            'refresh_token'        => $user['RefreshToken'],
            'expires_on'           => Carbon($user['ExpiresOn']),
            'avatar'               => $this->imageUrl . $user['CharacterID'] . '_128.jpg',
        ]);
    }