private function getSharedForUser(User $user, array $shared)
    {
        $userLink = null;
        foreach ($shared as $shareLink) {
            if ($shareLink->getUser() === $user) {
                $userLink = $shareLink;
                break;
            }
        }

        return $userLink;
    }
private function getSharedForUser(User $user, array $shared)
    {
        $userLink = null;
        foreach ($shared as $shareLink) {
            if ($shareLink->getUser() === $user) {
                $userLink = $shareLink;
                break;
            }
        }

        return $userLink;
    }
private function getSharedForUser ( User $ user , array $ shared ) { $ userLink = null ; foreach ( $ shared as $ shareLink ) { if ( $ shareLink -> getUser ( ) === $ user ) { $ userLink = $ shareLink ; break ; } } return $ userLink ; }
Gets an existing share link for a user in the share list of the question.

@param User     $user
@param Shared[] $shared

@return Shared
Gets an existing share link for a user in the share list of the question .