@param array $data

@return AuthenticationScheme
18347
public static function deserializeObject(array $data)
    {
        return new static(
            $data['type'],
            $data['name'],
            $data['description'],
            isset($data['specUri']) ? $data['specUri'] : null,
            isset($data['documentationUri']) ? $data['documentationUri'] : null
        );
    }
1319286
public function create(array $data)
    {
        $entityManager = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
        $zfcUserOptions = $this->getServiceManager()->get('zfcuser_module_options');
        $class = $zfcUserOptions->getUserEntityClass();
        $user  = new $class;
        $form  = $this->getServiceManager()->get('playgrounduseradmin_register_form');
        $form->get('dob')->setOptions(array('format' => 'Y-m-d'));

        $form->bind($user);

        $avatarPath = $this->getOptions()->getAvatarPath() . DIRECTORY_SEPARATOR;
        if (!is_dir($avatarPath)) {
            mkdir($avatarPath, 0777, true);
        }
        $avatarUrl = $this->getOptions()->getAvatarUrl() . '/';

        $clearPassword = (isset($data['password']))?  $data['password'] : '';

        if ($this->getOptions()->getCreateUserAutoPassword()) {
            $rand = \Zend\Math\Rand::getString(8);
            $clearPassword = $rand;
            $bcrypt = new Bcrypt;
            $bcrypt->setCost($zfcUserOptions->getPasswordCost());
            $pass = $bcrypt->create($rand);
            /*$data = array_merge(
                $data,
                array('password'=> $pass)
            );*/
            $user->setPassword($pass);
        }

        $filter = $user->getInputFilter();
        $filter->remove('password');
        $filter->remove('passwordVerify');
        $filter->get('title')->setRequired(false);
        $filter->remove('firstname');
        $filter->remove('lastname');
        $filter->remove('postalCode');
        //$filter->remove('dob');
        $form->setInputFilter($filter);

        $emailInput = $form->getInputFilter()->get('email');
        $noObjectExistsValidator = new NoObjectExistsValidator(array(
                'object_repository' => $entityManager->getRepository($class),
                'fields'            => 'email',
                'messages'          => array('objectFound' => 'This email already exists !')
        ));

        $emailInput->getValidatorChain()->addValidator($noObjectExistsValidator);

        if (!$zfcUserOptions->getEnableUsername()) {
            unset($data['username']);
        }

        if (!$zfcUserOptions->getEnableDisplayName()) {
            unset($data['display_name']);
        }

        // If user state is enabled, set the default state value
        if ($zfcUserOptions->getEnableUserState()) {
            if ($zfcUserOptions->getDefaultUserState()) {
                /*$data = array_merge(
                    $data,
                    array('state'=> $zfcUserOptions->getDefaultUserState())
                );*/
                $user->setState((int) $zfcUserOptions->getDefaultUserState());
            }
        }

        // If avatar is set, I prepend the url path to the image
        $fileName=null;
        if (isset($data['avatar'])) {
            $fileName = $data['avatar'];
            $data['avatar'] = $avatarUrl . $fileName;
        }

        if (!isset($data['username']) || $data['username'] == '') {
            $data['username'] = ucfirst($data['firstname']) . " " . substr(ucfirst($data['lastname']), 0, 1);
        }

        // Convert birth date format
        if (isset($data['dob']) && $data['dob']) {
            $tmpDate = \DateTime::createFromFormat('d/m/Y', $data['dob']);
            $data['dob'] = $tmpDate->format('Y-m-d');
        }

        $form->setData($data);

        if (!$form->isValid()) {
            if (isset($data['dob']) && $data['dob']) {
                $tmpDate = \DateTime::createFromFormat('Y-m-d', $data['dob']);
                $data['dob'] = $tmpDate->format('d/m/Y');
                $form->setData(array('dob' => $data['dob']));
            }
            return false;
        }

        $roleMapper          = $this->getRoleMapper();
        $defaultRegisterRole = $this->getOptions()->getDefaultRegisterRole();
        if (isset($data['roleId'])) {
            $role = $roleMapper->findByRoleId($data['roleId']);
        } else {
            $role = $roleMapper->findByRoleId($defaultRegisterRole);
        }
        if ($role) {
            $user->addRole($role);
        }

        if ($fileName) {
            $adapter = new \Zend\File\Transfer\Adapter\Http();
            $size = new Size(array('max'=>'500kb'));
            $adapter->setValidators(array($size), $fileName);

            if (!$adapter->isValid()) {
                $dataError = $adapter->getMessages();
                if (isset($dataError['fileSizeTooBig'])) {
                    $dataError['fileSizeTooBig'] = 'Votre fichier dépasse le poids autorisé';
                }
                $error = array();
                foreach ($dataError as $key => $row) {
                    $error[] = $row;
                }
                if (isset($data['dob']) && $data['dob']) {
                    $tmpDate = \DateTime::createFromFormat('Y-m-d', $data['dob']);
                    $data['dob'] = $tmpDate->format('d/m/Y');
                    $form->setData(array('dob' => $data['dob']));
                }
                $form->setMessages(array('avatar'=>$error ));
            } else {
                $adapter->setDestination($avatarPath);
                if ($adapter->receive($fileName)) {
                    $user = $this->getUserMapper()->insert($user);
                    $this->sendNewEmailMessage($user->getEmail(), $clearPassword);

                    return $user;
                }
            }
        } else {
            $user = $this->getUserMapper()->insert($user);
            $this->sendNewEmailMessage($user->getEmail(), $clearPassword);

            return $user;
        }

        return false;
    }
1314730
public function userCredentials(array $data = [])
    {

        $data = $this->mergeData($data);

        $refreshCredentials = new OAuth2TokenBuilder();

        return $refreshCredentials->withClientId($data['clientId'])
            ->withClientSecret($data['clientSecret'])
            ->withRefreshToken($data['refreshToken'])
            ->build();
    }
713211
protected function create(array $data)
    {
        $user = UserGate::create([
            'first_name' => $data[ 'first_name' ],
            'last_name'  => $data[ 'last_name' ],
            'username'   => $data[ 'username' ],
            'email'      => $data[ 'email' ],
            'password'   => bcrypt($data[ 'password' ]),
            'enabled'    => 1,
        ]);

        if ($user) {
            $user->attachRole(2);
        }

        return $user;
    }
1280463
public function mapUser(array $data)
    {
        $user = new User();
        $user->id = $data['contentobject_id'];
        $user->login = $data['login'];
        $user->email = $data['email'];
        $user->passwordHash = $data['password_hash'];
        $user->hashAlgorithm = (int)$data['password_hash_type'];
        $user->isEnabled = (bool)$data['is_enabled'];
        $user->maxLogin = $data['max_login'];

        return $user;
    }
278156
public function store(array $data)
    {
        return DB::transaction(function () use ($data) {
            $admin = new Admin;

            $admin->name          = $data['name'];
            $admin->email         = $data['email'];
            $admin->password      = bcrypt($data['password']);
            $admin->administrator = !empty($data['administrator']) ? 1 : 0;

            $permission = [];

            if (!empty($data['permission'])) {
                $permission = $data['permission'];
            }

            $admin->permission = serialize($permission);

            $admin->save();

            return $admin->id;
        });
    }
157820
public function data($data = []) {
		$bind =& $this->_entity;

		if ($data) {
			$bind ? $bind->set($data) : $this->_data = array_merge($this->_data, $data);
			return $this;
		}
		$data = $bind ? $bind->data() : $this->_data;
		return ($list = $this->_config['whitelist']) ? array_intersect_key($data, $list) : $data;
	}
1264921
protected function validate(array $data)
    {
        $validator = $this->validator->make(
            $data,
            [
                'username' => 'min:6|max:60',
                'password' => 'min:6|max:255',
                'email' => 'email|max:100'
            ]
        );

        if ($validator->fails()) {
            $message = sprintf(
                'Invalid user credentials. %s',
                implode(' ', $validator->errors()->all())
            );
            throw new UserException($message);
        }
    }
566555
public function payload(array $data)
    {
        foreach ($data as $key => $value) {
            $this->data->{$key} = $value;
        }

        return $this;
    }
239335
protected function renderLogin(array $data)
    {
        $template = sprintf(
            'FOSUserBundle:Security:login.html.%s',
            $this->container->getParameter('fos_user.template.engine')
        );

        return $this->container->get('templating')->renderResponse($template, $data);
    }
324610
public function build(array $data = [])
    {
        if(!$this->oAuth2Credential)
            $this->oAuth();

        $data = $this->mergeData($data);

        $adwordsSession = new AdWordsSessionBuilder();

        return $adwordsSession->withDeveloperToken($data['developerToken'])
                ->withClientCustomerId($data['clientCustomerId'])
                ->withOAuth2Credential($this->oAuth2Credential)
                ->build();
    }
1000521
protected function create(array $data)
    {
        $fields = [
            'name'     => $data['name'],
            'email'    => $data['email'],
            'password' => bcrypt($data['password']),
        ];
        if (config('auth.providers.users.field', 'email') === 'username' && isset($data['username'])) {
            $fields['username'] = $data['username'];
        }
        return User::create($fields);
    }
30090
public function data(array $data)
        {
            foreach ($data as $key => $value) {
                $this->attributes['data-'.$key] = $value;
            }
            return $this;
        }
1297889
public function createSessionToken(array $data = [])
    {
        $token = new SessionToken();

        if (array_key_exists('session_id', $data)) {
            $token->setToken($data['session_id']);
        }

        if (array_key_exists('success', $data)) {
            $token->setSuccess($data['success']);
        }

        return $token;
    }
928442
public function fromData(array $data): ModuleConfiguration
    {
        $moduleConfiguration = new ModuleConfiguration();
        $moduleConfiguration
            ->setId($data['id'])
            ->setAutoActive($data['autoActive'])
            ->setTitle($data['title'])
            ->setDescription($data['description'])
            ->setLang($data['lang'])
            ->setThumbnail($data['thumbnail'])
            ->setAuthor($data['author'])
            ->setUrl($data['url'])
            ->setEmail($data['email'])
        ;

        if (isset($data['settings'])) {
            $this->setSettings($moduleConfiguration, $data['settings']);
        }

        return $moduleConfiguration;
    }
834915
public function sign(array $data)
    {
        ksort($data);

        $queryString = $this->buildQueryString($data);
        $data['h'] = base64_encode(hash_hmac('sha1', $queryString, $this->clientSecret, true));

        return $data;
    }
800439
public function register(array $data): PodiumResponse
    {
        $registration = $this->getRegisterer();

        if (!$registration->loadData($data)) {
            return PodiumResponse::error();
        }

        return $registration->register();
    }