@todo define what I do

@param \Claroline\CoreBundle\Entity\User $user
@param array                             $excludedWidgetInstances

@return \Claroline\CoreBundle\Entity\Widget\WidgetInstance[]
512660
public function getDesktopWidgetInstance(
        User $user,
        array $excludedWidgetInstances
    )
    {
        if (count($excludedWidgetInstances) === 0) {
            return $this->widgetInstanceRepo->findBy(
                array(
                    'user' => $user,
                    'isAdmin' => false,
                    'isDesktop' => true
                )
            );
        }

        return $this->widgetInstanceRepo
            ->findDesktopWidgetInstance($user, $excludedWidgetInstances);
    }
994857
public function removeUser($user)
    {
        if ($this->getUsers()->contains($user))
        {
            $this->getUsers()->removeElement($user);
            $user->removeGroup($this);
        }
        return $this;
    }
1046609
public function formAction($resourceId, User $user)
    {
        $likeManager = $this->getLikeActionManager();
        $criteria = ['resource' => $resourceId];
        $userLike = $likeManager->getLikeBy($user, null, $criteria);
        $likesQB = $likeManager->getLikesForPagination(null, $criteria);
        $pager = $this->paginateQuery($likesQB, 1);

        return ['resourceId' => $resourceId, 'pager' => $pager, 'userLike' => $userLike];
    }
181577
public function removeUser(ChildUser $user)
    {
        if ($this->getUsers()->contains($user)) { $userRole = new ChildUserRole();

            $userRole->setUser($user);
            if ($user->isRolesLoaded()) {
                //remove the back reference if available
                $user->getRoles()->removeObject($this);
            }

            $userRole->setRole($this);
            $this->removeUserRole(clone $userRole);
            $userRole->clear();

            $this->collUsers->remove($this->collUsers->search($user));

            if (null === $this->usersScheduledForDeletion) {
                $this->usersScheduledForDeletion = clone $this->collUsers;
                $this->usersScheduledForDeletion->clear();
            }

            $this->usersScheduledForDeletion->push($user);
        }


        return $this;
    }
761077
public function removeUser(UserInterface $user)
    {
        $this->users->removeElement($user);

        if ($user->hasRole($this) === true)
            $user->removeRole($this);
        
        return $this;
    }
552663
public function bulletinComportementWidgetAction(User $user)
    {
        $comportements = $this->totauxManager->getMoyenneComportement($user);

        $params = array('comportements' => $comportements);

        return $this->render('LaurentBulletinBundle::BulletinComportementWidget.html.twig', $params);
    }
210826
public function getAdminWorkspaceWidgetInstance(array $excludedWidgetInstances)
    {
        if (count($excludedWidgetInstances) === 0) {
            return $this->widgetInstanceRepo->findBy(
                array(
                    'isAdmin' => true,
                    'isDesktop' => false
                )
            );
        }

        return $this->widgetInstanceRepo
            ->findAdminWorkspaceWidgetInstance($excludedWidgetInstances);
    }
595478
public function getAssignments(User $user)
    {
        $assignments = [];
        foreach ($this->getInternalServices() as $service) {
            $assignments = array_merge($assignments, $service->getAssignments($user));
        }

        return $assignments;
    }
1179116
protected function getUserThrottles(UserInterface $user)
    {
        if (! $this->userThrottles->has($user->getUserId()))
        {
            $this->userThrottles[$user->getUserId()] = $this->loadUserThrottles($user);
        }

        return $this->userThrottles[$user->getUserId()];
    }
347110
public function serialize(User $user)
    {
        return [
            self::SERIALIZED_USER_USERNAME_KEY => $this->encrypt($user->getUsername(), $this->surrogateKey),
            self::SERIALIZED_USER_PASSWORD_KEY => $this->encrypt($user->getPassword(), $this->surrogateKey),
            self::SERIALIZED_USER_KEY_KEY => $this->encrypt($this->surrogateKey, $this->key),
        ];
    }
487239
public function bulletinPointsDiversWidgetAction(User $user)
    {
        $pointsDivers = $this->totauxManager->getMoyennePointsDivers($user);

        $params = array('pointsDivers' => $pointsDivers);

        return $this->render('LaurentBulletinBundle::BulletinPointsDiversWidget.html.twig', $params);
    }
1194547
public function getAssignments(User $user)
    {
        $assignments = array();
        foreach ($this->getAssignmentFactories($user) as $factory) {
            $assignments[] = $factory->toAssignment();
        }
        
        return $this->orderAssignments($assignments);
    }
948399
public function getWidgetContent(Workspace $workspace = null, User $user = null)
    {
        $results = [];

        if (!is_null($user)) {
            $results = is_null($workspace) ?
                $this->om->getRepository('ClarolineResultBundle:Result')->findByUser($user) :
                $this->om->getRepository('ClarolineResultBundle:Result')->findByUserAndWorkspace($user, $workspace);
        }

        return $this->templating->render('ClarolineResultBundle:result:widget.html.twig', [
            'results' => $results,
        ]);
    }
1068188
private function invitationHandlerArguments($user)
    {
        return [
            $this->container->getDefinition(
                'bengor.user.infrastructure.persistence.' . $user . '_repository'
            ),
            $this->container->getDefinition(
                'bengor.user.infrastructure.security.symfony.' . $user . '_password_encoder'
            ),
        ];
    }
1114532
public function findOneByWidgetType($type, $id, User $user, $executeQuery = true)
    {
        $queryBuilder = $this->createQueryBuilder('w')
            ->andWhere($this->getWigetInstanceString($type))
            ->andWhere('w.id = :id')
            ->andWhere('w.user = :user')
            ->setParameters([
                'id' => $id,
                'user' => $user,
            ])
        ;

        return $executeQuery ? $queryBuilder->getQuery()->getSingleResult() : $queryBuilder->getQuery();
    }
1271813
protected function loadUserThrottles(UserInterface $user)
    {
        $queryBuilder = $this->getEntityManager()->createQueryBuilder();
        $queryBuilder
            ->select('t')
            ->from($this->entityName('user'), 't')
            ->where('t.createdAt > :interval')
            ->andWhere('t.user = :user')
            ->setParameters([
                'interval' => Carbon::now()->subSeconds($this->userInterval),
                'user'     => $user
            ]);

        return new Collection($queryBuilder->getQuery()->getResult());
    }
366560
public function getResumableDeliveries(User $user)
    {
        $deliveryExecutionService = ServiceProxy::singleton();
        $resumable = array();
        foreach ($this->getResumableStates() as $state) {
            foreach ($deliveryExecutionService->getDeliveryExecutionsByStatus($user->getIdentifier(), $state) as $execution) {
                $delivery = $execution->getDelivery();
                if ($delivery->exists()) {
                    $resumable[] = $execution;
                }
            }
        }
        return $resumable;
    }