@param bool $hydrateUser

@return array
979256
public function toArray($hydrateUser)
    {
        $json = [
            'id' => $this->getId(),
            'editable' => $this->getEditable(),
        ];

        if (true === $this->getFinished()) {
            $json['valid'] = $this->getValid();
            $json['totalGrade'] = $this->getTotalGrade();
            $json['comment'] = $this->getComment();
            $json['reporter'] = $this->getReporter();
            $json['reportComment'] = $this->getReportComment();
        }

        if (true === $hydrateUser) {
            $json['user'] = [
                'id' => $this->getUser()->getId(),
                'lastName' => $this->getUser()->getLastName(),
                'firstName' => $this->getUser()->getFirstName(),
                'username' => $this->getUser()->getUsername(),
            ];
        }

        return $json;
    }
131844
private function byInvitationSpecification($user)
    {
        (new InviteUserCommandBuilder($this->container, $this->persistence))->build($user);
        (new ResendInvitationUserCommandBuilder($this->container, $this->persistence))->build($user);

        return [
            'command'          => ByInvitationSignUpUserCommand::class,
            'handler'          => ByInvitationSignUpUserHandler::class,
            'handlerArguments' => $this->invitationHandlerArguments($user),
        ];
    }
277682
public function transform($user)
    {
        $user = $this->entityToArray(User::class, $user);
        return [
            'id'        => (int) $user['id'],
            'email'     => $user['email'],
            'nick'      => $user['nick'],
            'firstName' => $user['first_name'],
            'lastName'  => $user['last_name'],
            'roles'     => !empty($user['roles']) ? $user['roles'] : []
        ];
    }
1108614
protected function buildDoctrineObjectHydratorPrototype($hydratorName)
    {
        if (!class_exists($hydratorName)) {
            $this->prototype[$hydratorName] = false;
            return false;
        }

        if (!$this->isValidDoctrineObjectHydratorClass($hydratorName)) {
            $this->prototype[$hydratorName] = false;
            return false;
        }

        $objectManagerAutoDetector = $this->getObjectManagerAutoDetector();
        if (false === $objectManagerAutoDetector->hasObjectManagerNameByClassName($hydratorName)) {
            $this->prototype[$hydratorName] = false;
            return false;
        }

        $objectManagerName = $objectManagerAutoDetector->getObjectManagerNameByClassName($hydratorName);

        $doctrineObjectManager = $this->getDoctrineObjectManager();

        if (false === $doctrineObjectManager->has($objectManagerName)) {
            $this->prototype[$hydratorName] = false;
            return false;
        }

        /** @var ObjectManager $objectManager */
        $objectManager = $doctrineObjectManager->get($objectManagerName);

        $r = array_key_exists($hydratorName, $this->reflectionClassCache) ? $this->reflectionClassCache[$hydratorName] : new ReflectionClass($hydratorName);

        $this->prototype[$hydratorName] = $r->newInstance($objectManager);


        return $this->prototype[$hydratorName];
    }
1260849
public static function Attributes($user) {
      $user = (array)$user;
      $attributes = $user['Attributes'];
      if (is_string($attributes))
         $attributes = unserialize($attributes);
      if (!is_array($attributes))
         $attributes = array();
      return $attributes;
   }
281113
public static function hydrateCollection(array $comments)
    {
        $hydrated = [];

        foreach ($comments as $comment) {
            $hydrated[] = self::hydrate($comment);
        }

        return $hydrated;
    }
1181112
public function indexAction(User $user = null)
    {
        return [
            'isAdmin' => !is_null($user) ? $user->hasRole('ROLE_ADMIN') : false,
            'resourceTypes' => array_map(function (ResourceType $type) {
                return $this->resourceTypeSerializer->serialize($type);
            }, $this->resourceTypeRepo->findBy([], ['name' => 'ASC'])),
        ];
    }
689104
private function loadAllUserGroupsIdsOfUser(User $user): array
    {
        $allUserGroups = [];
        $offset = 0;

        do {
            $userGroups = $this->userService->loadUserGroupsOfUser($user, $offset, self::USER_GROUPS_LIMIT);
            foreach ($userGroups as $userGroup) {
                $allUserGroups[] = $userGroup->contentInfo->id;
            }
            $offset += self::USER_GROUPS_LIMIT;
        } while (\count($userGroups) === self::USER_GROUPS_LIMIT);

        return $allUserGroups;
    }
1333309
private function serializeMeta(User $user)
    {
        $locale = $user->getLocale();
        if (empty($locale)) {
            $locale = $this->config->getParameter('locale_language');
        }

        return [
            'publicUrl' => $user->getPublicUrl(),
            'publicUrlTuned' => $user->hasTunedPublicUrl(),
            'acceptedTerms' => $user->hasAcceptedTerms(),
            'lastLogin' => $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d\TH:i:s') : null,
            'created' => $user->getCreated() ? $user->getCreated()->format('Y-m-d\TH:i:s') : null,
            'description' => $user->getDescription(),
            'mailValidated' => $user->isMailValidated(),
            'mailNotified' => $user->isMailNotified(),
            'mailWarningHidden' => $user->getHideMailWarning(),
            'authentication' => $user->getAuthentication(),
            'personalWorkspace' => (bool) $user->getPersonalWorkspace(),
            'removed' => $user->isRemoved(),
            'locale' => $locale,
            'loggedIn' => $user === $this->tokenStorage->getToken()->getUser(),
        ];
    }
641846
public static function hydrateCollection(array $sources)
    {
        $hydrated = [];

        foreach ($sources as $source) {
            $hydrated[] = self::hydrate($source);
        }

        return $hydrated;
    }
946667
public static function getDefaultPermissions(BaseUser $user)
    {
        return array_fill_keys(self::getAllPermissions(), !in_array(Roles::ROLE_GUESTADMIN, $user->getRoles()));
    }
1200558
protected function getUsers(string $user = null): array
    {
        if ($user !== null) {
            return array_intersect_key($this->users, array_flip((array) $user));
        }

        return $this->users;
    }
159316
public function getUserDetails($credential)
    {
        $user = $this->getUserDataMapper()->findByCredential($credential);

        if (! $user instanceof $this->userClass) {
            return false;
        }

        return [
            'user_id' => (string) $user->getUuid(),
            'scope'   => $user instanceof Entity\ScopesProviderInterface ? $user->getScopesString() : null,
        ];
    }
585232
private function byRequestRememberPasswordSpecification($user)
    {
        (new RequestRememberPasswordCommandBuilder($this->container, $this->persistence))->build($user);

        return [
            'command' => ByRequestRememberPasswordChangeUserPasswordCommand::class,
            'handler' => ByRequestRememberPasswordChangeUserPasswordHandler::class,
        ];
    }
1115353
public function getUsers() : array
    {
        /** @var \Adldap\Query\Builder $query */
        $query = Resolver::query();

        if ($filter = $this->option('filter')) {
            // If the filter option was given, we'll
            // insert it into our search query.
            $query->rawFilter($filter);
        }

        if ($user = $this->argument('user')) {
            $users = [$query->findOrFail($user)];
        } else {
            // Retrieve all users. We'll paginate our search in case we
            // hit the 1000 record hard limit of active directory.
            $users = $query->paginate()->getResults();
        }

        // We need to filter our results to make sure they are
        // only users. In some cases, Contact models may be
        // returned due the possibility of them
        // existing in the same scope.
        return array_filter($users, function ($user) {
            return $user instanceof User;
        });
    }
1245808
public function hydrateAll(Result $dbResult)
    {
        $result = [];

        foreach ($dbResult->records() as $record) {
            $this->hydrateRecord($record, $result);
        }

        return $result;
    }
907198
protected function getListUser()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        $list = (array) $this->user->getList($conditions);
        $this->prepareListUser($list);
        return $list;
    }