Get the value of the console.
@param User   $user
@param string $attribute
@return void
970543
protected function readValue(User $user, string $attribute) : void
    {
        $user->$attribute = $this->prompt(mb_convert_case($attribute, MB_CASE_TITLE, 'utf-8') . ':', [
            'validator' => function ($input, &$error) use ($user, $attribute) {
                $user->$attribute = $input;
                if ($user->validate([$attribute])) {
                    return true;
                } else {
                    $error = implode(',', $user->getErrors($attribute));
                    return false;
                }
            },
        ]);
    }
388667
public function validateUser( $attribute, $params ) {

        if( !$this->hasErrors() ) {

			$user = $this->user;

            if( !isset( $user ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USER_NOT_EXIST ) );
            }
			else {

				if( !$this->hasErrors() && !$user->isVerified( false ) ) {

					$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USER_VERIFICATION ) );
				}

				if( !$this->hasErrors() && $user->isBlocked() ) {

					$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_BLOCKED ) );
				}
			}
        }
    }
945805
protected function getSettablePropertyValue($userProperty, $user)
    {
        if (empty($userProperty)) {
            return $user;
        }

        try {
            $propertyAccessor = PropertyAccess::createPropertyAccessor();
            return $propertyAccessor->getValue($user, $userProperty);
        } catch (NoSuchPropertyException $e) {
            return $this->handleException($e);
        }
    }
927230
protected function getValue($attribute)
    {
        if (! is_null($value = Arr::get($this->data, $attribute))) {
            return $value;
        } else if (! is_null($value = Arr::get($this->files, $attribute))) {
            return $value;
        }
    }
364320
static function values( $user = false )
    {
        if ( !( $user instanceof eZUser ) )
            $user = eZUser::currentUser();

        if ( !$user->isAnonymous() )
        {
            // If the user object is not the currently logged in user we cannot use the session values
            $http = eZHTTPTool::instance();
            $useCache = ( $user->ContentObjectID == $http->sessionVariable( 'eZUserLoggedInID', false ) );

            $returnArray = array();
            $userID = $user->attribute( 'contentobject_id' );
            $db = eZDB::instance();
            $values = $db->arrayQuery( "SELECT name,value FROM ezpreferences WHERE user_id=$userID ORDER BY id" );
            foreach ( $values as $item )
            {
                if ( $useCache )
                    eZPreferences::storeInSession( $item['name'], $item['value'] );
                $returnArray[$item['name']] = $item['value'];
            }
            return $returnArray;
        }
        else
        {
            // For the anonymous user we just return all values, or empty array if session is un-started / value undefined
            $http = eZHTTPTool::instance();
            return $http->sessionVariable( eZPreferences::SESSION_NAME, array() );
        }
    }
1334328
protected function saveUser(WebRequest $request, User $user)
    {
        $formValues = $this->layout->getFormValues();
        
        // Set the username
        $user->setName($formValues['required-data.username']);
        
        // Set the password to a new user or if the user has changed the password
        if ($user->isNew() || $formValues['required-data.password'] != '') {
            $user->setNewPassword($formValues['required-data.password']);
        }
        
        // Set the optional data
        $user->setMetaData('email', $formValues['optional-data.email']);
        $user->setMetaData('location', $formValues['optional-data.location']);
        $user->setMetaData('website', $formValues['optional-data.website']);
        $user->setMetaData('twitter', $formValues['optional-data.twitter']);
        $user->setMetaData('biography', $formValues['optional-data.biography']);

        // Save the user
        if ($user->isNew()) {
            $user = $this->userManager->add($user);
        } else {
            $this->userManager->update($user);
        }
        
        if ($user === false) {
            return false;
        }
        
        // Save the access levels
        $this->accessControlManager->updatePermissions($user, $formValues['access-levels'], $request->getSession()->getUser());
        
        return true;
    }
117271
public function bindUser(User $user, $binding)
    {
        return $this->bindUserID(intval($user->getUserID(), 10), $binding);
    }
449998
public function getCoins(UserInterface $user)
    {
        $class = $this->getGameOptions()->getEntityAccountClass();
        $accEntityManager = $this->getAccountEntityManager();

        /** @var \GameBackend\Entity\Metin\Account\Repository\Account $repoAccount */
        $repoAccount = $accEntityManager->getRepository($class);
        $metinUser = $repoAccount->getUser($user);

        $result = 0;
        if ($metinUser) {
            $result = $metinUser->getCash();
        }

        return $result;
    }
286375
public function updateUser(User $user)
    {
        $this->find("id", $user->id);
        $this->setUserData($user);
        $this->save();
    }
379227
public function attachMember(User $user,
        /** @noinspection PhpUnusedParameterInspection */
                                   MemberTag $memberTag,
                                   $memberId)
    {
        return $user->selected_context->id === $memberId;
    }
1050421
protected function resolveAttribute($resource, $attribute)
    {
        $this->setResourceId(data_get($resource, 'id'));
        return parent::resolveAttribute($resource, $attribute);
    }
1317466
private function prepareGetterParams($getter_params, $user, $resource)
    {
        if (empty($getter_params)) {
            return [];
        }
        $values = [];
        foreach ($getter_params as $getter_name=>$params) {
            foreach ($params as $param) {
                if ('@' !== $param[ 'param_name' ][ 0 ]) {
                    $values[$getter_name][] = $param[ 'param_value' ];
                } else {
                    $values[$getter_name][] = $this->attributeManager->retrieveAttribute($this->attributeManager->getAttribute($param[ 'param_value' ]), $user, $resource);
                }
            }
        }
        return $values;
    }
2115
public static function clean_data($user) {
        if (empty($user)) {
            return $user;
        }

        foreach ($user as $field => $value) {
            // Get the property parameter type and do the cleaning.
            try {
                $user->$field = core_user::clean_field($value, $field);
            } catch (coding_exception $e) {
                debugging("The property '$field' could not be cleaned.", DEBUG_DEVELOPER);
            }
        }

        return $user;
    }
1267897
public function regenerateApiKey(User $user)
    {
        $user->api_key = User::generateApiKey();
        $user->save();

        event(new UserRegeneratedApiTokenEvent($user));

        return cachet_redirect('dashboard.user');
    }
526913
public function replaceAttributes(User $user, array $attributes)
    {
        $url = self::makeAttributeUrl($user->username, $user->tenantId);
        $data = json_encode(array('attribute' => $attributes));
        $response = $this->service->prepAndSend($url, array(200), 'PUT', $data, true);
        $response = json_decode($response);

        $result = array();
        foreach ($response->attribute as $attr) {
            $result[] = Attribute::createFromJSON($attr);
        }
        return $result;
    }
558229
public static function accessPossible(User $user, $controller, $action) {
        return self::getImplementation()->accessPossible($user, $controller, $action);
    }
701807
public function processRuleAttributes(array $attributes, $user, $resource)
    {
        foreach ($attributes as $attributeName => $attribute) {
            $pra = (new PolicyRuleAttribute())
                ->setAttribute($this->attributeManager->getAttribute($attributeName))
                ->setComparison($attribute['comparison'])
                ->setComparisonType($attribute['comparison_type'])
                ->setValue((isset($attribute['value'])) ? $attribute['value'] : null)
                ->setGetterParams(isset($attribute[ 'getter_params' ]) ? $attribute[ 'getter_params' ] : []);
            $this->processRuleAttributeComparisonType($pra, $user, $resource);
            // In the case the user configured more keys than the basic ones
            // it will be stored as extra data
            foreach ($attribute as $key => $value) {
                if (!in_array($key, ['comparison', 'comparison_type', 'value','getter_params'])) {
                    $pra->addExtraData($key, $value);
                }
            }
            // This generator avoid useless memory consumption instead of returning a whole array
            yield $pra;
        }
    }