To prototicket

@return ProtoAuthTicket
340331
public function toProto() : ProtoAuthTicket
    {
        $ticket = new ProtoAuthTicket();
        $ticket->setStart($this->start);
        $ticket->setEnd($this->end);
        $ticket->setExpireTimestampMs($this->expiry);

        return $ticket;
    }
385468
public function getHybridAuth()
    {
        if ($this->hybridAuth == null) {
            $this->hybridAuth = $this->getServiceManager()->get('HybridAuth');
        }

        return $this->hybridAuth;
    }
57314
public static Timestamp fromProto(com.google.protobuf.Timestamp proto) {
    return new Timestamp(proto.getSeconds(), proto.getNanos());
  }
835120
public function basicAuth()
    {
        $auth = ['auth' => [$this->config->get('auth.basic.username'), $this->config->get('auth.basic.password')]];

        $this->options += $auth;

        return $this;
    }
732779
public function getGroupTicket()
    {
        $key = 'stoneworld.wechat.group_ticket.' . $this->appId;

        // for php 5.3
        $appId = $this->appId;
        $appSecret = $this->appSecret;
        $cache = $this->cache;
        $apiTicket = self::API_TICKET_CONTACT;

        return $this->cache->get(
            $key,
            function ($key) use ($appId, $appSecret, $cache, $apiTicket) {
                $http = new Http(new AccessToken($appId, $appSecret));

                $result = $http->get($apiTicket);

                $cache->set($key, $result, $result['expires_in']);

                return $result;
            }
        );
    }
707827
public function toAuthy(): AuthyMessage
    {
        $message = AuthyMessage::create()->method($this->method);

        if ($this->force) {
            $message->force();
        }

        return $message;
    }
1253662
public function sendTicket()
    {
        // Get the mail sender or fallback to the admin email
        if (empty($from = Reservation::config()->get('mail_sender'))) {
            $from = Config::inst()->get('Email', 'admin_email');
        }

        $email = new Email();
        $email->setSubject(_t(
            'AttendeeMail.TITLE',
            'Your ticket for {event}',
            null,
            array(
                'event' => $this->Event()->Title
            )
        ));
        $email->setFrom($from);
        $email->setTo($this->getEmail());
        $email->setTemplate('AttendeeMail');
        $email->populateTemplate($this);
        $this->extend('updateTicketMail', $email);
        return $email->send();
    }
838660
public function to_avro()
  {
    $avro = array("protocol" => $this->name, "namespace" => $this->namespace);
    
    if (!is_null($this->doc))
      $avro["doc"] = $this->doc;
    
    $types = array();
    $avro["types"] = $this->schemata->to_avro();
    
    $messages = array();
    foreach ($this->messages as $name => $msg)
      $messages[$name] = $msg->to_avro();
    $avro["messages"] = $messages;
    
    return $avro;
  }
1365206
public function authenticateAction()
    {
        if ($this->zfcUserAuthentication()->getAuthService()->hasIdentity()) {
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }
        $adapter = $this->zfcUserAuthentication()->getAuthAdapter();
        $redirect = $this->params()->fromPost('redirect', $this->params()->fromQuery('redirect', false));
        
        $routeLoginAdmin = $this->params()->fromPost('routeLoginAdmin', $this->params()->fromQuery('routeLoginAdmin', false));

        $result = $adapter->prepareForAuthentication($this->getRequest());

        // Return early if an adapter returned a response
        if ($result instanceof Response) {
            return $result;
        }

        $auth = $this->zfcUserAuthentication()->getAuthService()->authenticate($adapter);

        if (!$auth->isValid()) {
            $this->flashMessenger()->setNamespace('zfcuser-login-form')->addMessage($this->failedLoginMessage);
            $adapter->resetAdapters();

            if (!empty($routeLoginAdmin)) {
                return $this->redirect()->toUrl($routeLoginAdmin);
            }

            return $this->redirect()->toUrl(
                $this->url()->fromRoute('frontend/zfcuser/login')
                . ($redirect ? '?redirect='.$redirect : '')
            );
        }

        $user = $this->zfcUserAuthentication()->getIdentity();
        $this->getEventManager()->trigger('login.post', $this, array('user' => $user));

        if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) {
            return $this->redirect()->toUrl($redirect);
        }

        return $this->redirect()->toUrl(
            $this->url()->fromRoute(
                $this->getOptions()->getLoginRedirectRoute()
            )
        );
    }
541308
public function token()
    {
        $payload = [
            'auth'        => [$this->config['client_id'], $this->config['client_secret']],
            'form_params' => ['grant_type' => 'client_credentials'],
        ];

        $request = array_merge($this->requestTemplate, $payload);
        $rawResponse = $this->getHttpClient()->post($this->buildUrlFromString('oauth2/token'), $request);
        $rawResponse = $this->responseToArray($rawResponse);

        return [
            'token'  => Arr::get($rawResponse, 'access_token'),
            'type'   => Arr::get($rawResponse, 'token_type'),
            'scope'  => Arr::get($rawResponse, 'scope'),
            'expiry' => isset($rawResponse['expires_in'])
                ? time() + Arr::get($rawResponse, 'expires_in')
                : null,
        ];
    }
561844
public function getStart() {
		return Util::toISO8601($this->getStartTimestamp(), Util::UTC, $this->getEvent()->getTimezone());
	}
1160969
public function getTicket()
    {
        $cacheKey = sprintf($this->cacheKey, $this->appId);

        return Cache::get($cacheKey, function () use ($cacheKey) {
            $response = $this->http->get(self::API_TICKET);

            // 设置token
            $ticket = $response['ticket'];

            // 把token缓存起来
            $expiresAt = Carbon::now()->addSeconds($response['expires_in']);
            Cache::put($cacheKey, $ticket, $expiresAt);

            return $ticket;
        });
    }
183982
protected function getOpauthResponse() {
		$config = OpauthAuthenticator::get_opauth_config();
		$transportMethod = $config['callback_transport'];
		switch($transportMethod) {
			case 'session':
				return $this->getResponseFromSession();
			case 'get':
			case 'post':
				return $this->getResponseFromRequest($transportMethod);
			default:
				throw new InvalidArgumentException('Invalid transport method: ' . $transportMethod);
		}
	}
672915
public function getTicket()
    {
        $key = 'stoneworld.wechat.jsapi_ticket.' . $this->appId;

        // for php 5.3
        $appId = $this->appId;
        $appSecret = $this->appSecret;
        $cache = $this->cache;
        $apiTicket = self::API_TICKET;

        return $this->cache->get(
            $key,
            function ($key) use ($appId, $appSecret, $cache, $apiTicket) {
                $http = new Http(new AccessToken($appId, $appSecret));

                $result = $http->get($apiTicket);

                $cache->set($key, $result['ticket'], $result['expires_in']);

                return $result['ticket'];
            }
        );
    }
1295623
public function toUser()
    {
        if (func_num_args() > 0) {
            $userIds = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args();

            $this->to['touser'] = implode('|', $userIds);
        }

        return $this;
    }
650875
function getAuthAdapter()
    {
        if (!$this->__authAdapter) {
            $authAdapter = new AggrAuthAdapter(new BaseIdentity(get_class($this)));
            $authAdapter->addAuthentication(
                new DigestFileAuthAdapter()
            );

            $this->__authAdapter = $authAdapter;
        }

        return $this->__authAdapter;
    }
925696
public function actionConnectStep2()
    {
        $providerHandle = craft()->httpSession->get('oauth.console.providerHandle');
        $referer = craft()->httpSession->get('oauth.console.referer');


        // connect

        $provider = craft()->oauth->getProvider($providerHandle);

        if($response = craft()->oauth->connect(array(
            'plugin' => 'oauth',
            'provider' => $providerHandle
        )))
        {
            if($response['success'])
            {
                // token
                $token = $response['token'];

                $tokenArray = OauthHelper::tokenToArray($token);

                // save token
                craft()->httpSession->add('oauth.console.token.'.$providerHandle, $tokenArray);

                // session notice
                craft()->userSession->setNotice(Craft::t("Connected."));
            }
            else
            {
                craft()->userSession->setError(Craft::t($response['errorMsg']));
            }
        }
        else
        {
            // session error
            craft()->userSession->setError(Craft::t("Couldn’t connect"));
        }

        // redirect
        $this->redirect($referer);
    }