@param \Drupal\user\Entity\User $user

@return \Drupal\domain\Entity\Domain|null
193132
public function getUserMainDomain(User $user) {
    if($this->domainEnabled) {
      $groups = Group::getUserGroup($user);
      if (is_array($groups)) {
        foreach ($groups as $group) {
          if ($domaine = $group->getDomain()) {
            if ($domaine->status()) {
              return $domaine;
            }
          }
        }
      }
    }
    return NULL;
  }
1048807
public function get(User $user)
    {
        if (null !== $acl = $this->fetchFromCache($user)) {
            return $acl;
        }

        return $this->fetch($user);
    }
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'])),
        ];
    }
117271
public function bindUser(User $user, $binding)
    {
        return $this->bindUserID(intval($user->getUserID(), 10), $binding);
    }
839321
public function setUser(\ACS\ACSPanelUsersBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }
536352
public static function getUserAwareChoiceBuilder(FormBuilderInterface $builder, UserInterface $user = null)
    {
        return function (EntityRepository $objectRepository) use ($builder, $user) {
            return $objectRepository->createQueryBuilder('o')
                ->andWhere('o.user = :user')
                ->setParameter('user', $user ?: $builder->getAttribute('user_aware'))
            ;
        };
    }
402738
public function removeUser(\FOM\UserBundle\Entity\User $user)
    {
        $this->users->removeElement($users);
    }
470491
private function resolveProfilePictureField(ApiUser $user): ?Field
    {
        $contentType = $user->getContentType();
        foreach ($user->getFields() as $field) {
            $fieldDef = $contentType->getFieldDefinition($field->fieldDefIdentifier);

            if ('ezimage' === $fieldDef->fieldTypeIdentifier) {
                return $field;
            }
        }

        return null;
    }
202372
protected function _getCurrentUser($user = null)
    {
        $this->_setCurrentUser($user);

        if (!$this->_currentUserInstance &&
            isset($this->_currentUserViewVar) &&
            !empty($this->viewVars[$this->_currentUserViewVar])
        ) {
            $this->_currentUserInstance = $this->viewVars[$this->_currentUserViewVar];
        }

        return $this->_currentUserInstance;
    }
225231
public function setUser(\Neobazaar\Entity\User $user = null)
    {
        $this->user = $user;
    
        return $this;
    }
935835
public function getIdForSlug($slug, User $user = null)
    {
        $query = Tag::where('slug', 'like', $slug);

        return $this->scopeVisibleTo($query, $user)->pluck('id');
    }
744710
public function setUser(\Quazardous\Silex\UserPack\Entity\UserInterface $user = null)
    {
        $this->user = $user;

        return $this;
    }
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;
    }
1042135
public function findUserDomainOrCreateByUserAndDomain($user, $domain)
    {
        $userDomain = $this->getUserDomainMapper()->findBy(array('user' => $user, 'domain' => $domain));
        if (empty($userDomain)) {
            $userDomain = new UserDomainEntity();
            $userDomain->setDomain($domain)
                ->setUser($user);
            $userDomain = $this->getUserDomainMapper()->insert($userDomain);
        }

        return $userDomain;
    }
428412
private function get_api_user_scope_by_user( FS_User $user ) {
            return FS_Api::instance(
                $this->_module_id,
                'user',
                $user->id,
                $user->public_key,
                ! $this->is_live(),
                $user->secret_key
            );
        }
27351
protected function FormUrl(User $user = null)
    {
        $args = array();
        if ($user)
        {
            $args['user'] = $user->GetID();
        }
        return BackendRouter::ModuleUrl(new UserForm(), $args); 
    }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }