repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.createRequest | public function createRequest()
{
$request = parent::createRequest();
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
return $request;
} | php | public function createRequest()
{
$request = parent::createRequest();
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
return $request;
} | [
"public",
"function",
"createRequest",
"(",
")",
"{",
"$",
"request",
"=",
"parent",
"::",
"createRequest",
"(",
")",
";",
"$",
"request",
"->",
"on",
"(",
"Request",
"::",
"EVENT_BEFORE_SEND",
",",
"[",
"$",
"this",
",",
"'beforeRequestSend'",
"]",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L195-L200 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.createApiRequest | public function createApiRequest()
{
$request = parent::createApiRequest();
// ensure correct event handlers order :
$request->off(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
return $requ... | php | public function createApiRequest()
{
$request = parent::createApiRequest();
// ensure correct event handlers order :
$request->off(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeRequestSend']);
return $requ... | [
"public",
"function",
"createApiRequest",
"(",
")",
"{",
"$",
"request",
"=",
"parent",
"::",
"createApiRequest",
"(",
")",
";",
"// ensure correct event handlers order :",
"$",
"request",
"->",
"off",
"(",
"Request",
"::",
"EVENT_BEFORE_SEND",
",",
"[",
"$",
"t... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L205-L214 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.applyAccessTokenToRequest | public function applyAccessTokenToRequest($request, $accessToken)
{
$data = $request->getData();
$data['oauth_consumer_key'] = $this->consumerKey;
$data['oauth_token'] = $accessToken->getToken();
$request->setData($data);
} | php | public function applyAccessTokenToRequest($request, $accessToken)
{
$data = $request->getData();
$data['oauth_consumer_key'] = $this->consumerKey;
$data['oauth_token'] = $accessToken->getToken();
$request->setData($data);
} | [
"public",
"function",
"applyAccessTokenToRequest",
"(",
"$",
"request",
",",
"$",
"accessToken",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"getData",
"(",
")",
";",
"$",
"data",
"[",
"'oauth_consumer_key'",
"]",
"=",
"$",
"this",
"->",
"consumerKey... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L230-L236 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.signRequest | public function signRequest($request, $token = null)
{
$params = $request->getData();
if (isset($params['oauth_signature_method']) || $request->hasHeaders() && $request->getHeaders()->has('authorization')) {
// avoid double sign of request
return;
}
if (empt... | php | public function signRequest($request, $token = null)
{
$params = $request->getData();
if (isset($params['oauth_signature_method']) || $request->hasHeaders() && $request->getHeaders()->has('authorization')) {
// avoid double sign of request
return;
}
if (empt... | [
"public",
"function",
"signRequest",
"(",
"$",
"request",
",",
"$",
"token",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"request",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'oauth_signature_method'",
"]",
")",
... | Sign given request with [[signatureMethod]].
@param \yii\httpclient\Request $request request instance.
@param OAuthToken|null $token OAuth token to be used for signature, if not set [[accessToken]] will be used.
@since 2.1 this method is public. | [
"Sign",
"given",
"request",
"with",
"[[",
"signatureMethod",
"]]",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L301-L340 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.composeSignatureBaseString | protected function composeSignatureBaseString($method, $url, array $params)
{
if (strpos($url, '?') !== false) {
list($url, $queryString) = explode('?', $url, 2);
parse_str($queryString, $urlParams);
$params = array_merge($urlParams, $params);
}
unset($par... | php | protected function composeSignatureBaseString($method, $url, array $params)
{
if (strpos($url, '?') !== false) {
list($url, $queryString) = explode('?', $url, 2);
parse_str($queryString, $urlParams);
$params = array_merge($urlParams, $params);
}
unset($par... | [
"protected",
"function",
"composeSignatureBaseString",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'?'",
")",
"!==",
"false",
")",
"{",
"list",
"(",
"$",
"url",
",",
"$",
"... | Creates signature base string, which will be signed by [[signatureMethod]].
@param string $method request method.
@param string $url request URL.
@param array $params request params.
@return string base signature string. | [
"Creates",
"signature",
"base",
"string",
"which",
"will",
"be",
"signed",
"by",
"[[",
"signatureMethod",
"]]",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L349-L366 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.composeSignatureKey | protected function composeSignatureKey($token = null)
{
$signatureKeyParts = [
$this->consumerSecret
];
if ($token === null) {
$token = $this->getAccessToken();
}
if (is_object($token)) {
$signatureKeyParts[] = $token->getTokenSecret();
... | php | protected function composeSignatureKey($token = null)
{
$signatureKeyParts = [
$this->consumerSecret
];
if ($token === null) {
$token = $this->getAccessToken();
}
if (is_object($token)) {
$signatureKeyParts[] = $token->getTokenSecret();
... | [
"protected",
"function",
"composeSignatureKey",
"(",
"$",
"token",
"=",
"null",
")",
"{",
"$",
"signatureKeyParts",
"=",
"[",
"$",
"this",
"->",
"consumerSecret",
"]",
";",
"if",
"(",
"$",
"token",
"===",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this... | Composes request signature key.
@param OAuthToken|null $token OAuth token to be used for signature key.
@return string signature key. | [
"Composes",
"request",
"signature",
"key",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L373-L391 |
yiisoft/yii2-authclient | src/OAuth1.php | OAuth1.composeAuthorizationHeader | protected function composeAuthorizationHeader(array $params, $realm = '')
{
$header = 'OAuth';
$headerParams = [];
if (!empty($realm)) {
$headerParams[] = 'realm="' . rawurlencode($realm) . '"';
}
foreach ($params as $key => $value) {
if (substr_compar... | php | protected function composeAuthorizationHeader(array $params, $realm = '')
{
$header = 'OAuth';
$headerParams = [];
if (!empty($realm)) {
$headerParams[] = 'realm="' . rawurlencode($realm) . '"';
}
foreach ($params as $key => $value) {
if (substr_compar... | [
"protected",
"function",
"composeAuthorizationHeader",
"(",
"array",
"$",
"params",
",",
"$",
"realm",
"=",
"''",
")",
"{",
"$",
"header",
"=",
"'OAuth'",
";",
"$",
"headerParams",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"realm",
")",
... | Composes authorization header.
@param array $params request params.
@param string $realm authorization realm.
@return array authorization header in format: [name => content]. | [
"Composes",
"authorization",
"header",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth1.php#L399-L417 |
yiisoft/yii2-authclient | src/clients/VKontakte.php | VKontakte.initUserAttributes | protected function initUserAttributes()
{
$response = $this->api('users.get.json', 'GET', [
'fields' => implode(',', $this->attributeNames),
]);
if (empty($response['response'])) {
throw new \RuntimeException('Unable to init user attributes due to unexpected response... | php | protected function initUserAttributes()
{
$response = $this->api('users.get.json', 'GET', [
'fields' => implode(',', $this->attributeNames),
]);
if (empty($response['response'])) {
throw new \RuntimeException('Unable to init user attributes due to unexpected response... | [
"protected",
"function",
"initUserAttributes",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"(",
"'users.get.json'",
",",
"'GET'",
",",
"[",
"'fields'",
"=>",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"attributeNames",
")",
",",
"]... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/VKontakte.php#L85-L106 |
yiisoft/yii2-authclient | src/signature/HmacSha.php | HmacSha.generateSignature | public function generateSignature($baseString, $key)
{
return base64_encode(hash_hmac($this->algorithm, $baseString, $key, true));
} | php | public function generateSignature($baseString, $key)
{
return base64_encode(hash_hmac($this->algorithm, $baseString, $key, true));
} | [
"public",
"function",
"generateSignature",
"(",
"$",
"baseString",
",",
"$",
"key",
")",
"{",
"return",
"base64_encode",
"(",
"hash_hmac",
"(",
"$",
"this",
"->",
"algorithm",
",",
"$",
"baseString",
",",
"$",
"key",
",",
"true",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/HmacSha.php#L50-L53 |
yiisoft/yii2-authclient | src/signature/RsaSha.php | RsaSha.getName | public function getName()
{
if (is_int($this->algorithm)) {
$constants = get_defined_constants(true);
if (isset($constants['openssl'])) {
foreach ($constants['openssl'] as $name => $value) {
if (strpos($name, 'OPENSSL_ALGO_') !== 0) {
... | php | public function getName()
{
if (is_int($this->algorithm)) {
$constants = get_defined_constants(true);
if (isset($constants['openssl'])) {
foreach ($constants['openssl'] as $name => $value) {
if (strpos($name, 'OPENSSL_ALGO_') !== 0) {
... | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"this",
"->",
"algorithm",
")",
")",
"{",
"$",
"constants",
"=",
"get_defined_constants",
"(",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"constants",
"[",
"'openssl'",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/RsaSha.php#L105-L128 |
yiisoft/yii2-authclient | src/signature/RsaSha.php | RsaSha.initPublicCertificate | protected function initPublicCertificate()
{
if (!empty($this->publicCertificateFile)) {
if (!file_exists($this->publicCertificateFile)) {
throw new InvalidConfigException("Public certificate file '{$this->publicCertificateFile}' does not exist!");
}
retur... | php | protected function initPublicCertificate()
{
if (!empty($this->publicCertificateFile)) {
if (!file_exists($this->publicCertificateFile)) {
throw new InvalidConfigException("Public certificate file '{$this->publicCertificateFile}' does not exist!");
}
retur... | [
"protected",
"function",
"initPublicCertificate",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"publicCertificateFile",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"publicCertificateFile",
")",
")",
"{",
"throw"... | Creates initial value for [[publicCertificate]].
This method will attempt to fetch the certificate value from [[publicCertificateFile]] file.
@throws InvalidConfigException on failure.
@return string public certificate content. | [
"Creates",
"initial",
"value",
"for",
"[[",
"publicCertificate",
"]]",
".",
"This",
"method",
"will",
"attempt",
"to",
"fetch",
"the",
"certificate",
"value",
"from",
"[[",
"publicCertificateFile",
"]]",
"file",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/RsaSha.php#L136-L145 |
yiisoft/yii2-authclient | src/signature/RsaSha.php | RsaSha.initPrivateCertificate | protected function initPrivateCertificate()
{
if (!empty($this->privateCertificateFile)) {
if (!file_exists($this->privateCertificateFile)) {
throw new InvalidConfigException("Private certificate file '{$this->privateCertificateFile}' does not exist!");
}
... | php | protected function initPrivateCertificate()
{
if (!empty($this->privateCertificateFile)) {
if (!file_exists($this->privateCertificateFile)) {
throw new InvalidConfigException("Private certificate file '{$this->privateCertificateFile}' does not exist!");
}
... | [
"protected",
"function",
"initPrivateCertificate",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"privateCertificateFile",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"privateCertificateFile",
")",
")",
"{",
"thr... | Creates initial value for [[privateCertificate]].
This method will attempt to fetch the certificate value from [[privateCertificateFile]] file.
@throws InvalidConfigException on failure.
@return string private certificate content. | [
"Creates",
"initial",
"value",
"for",
"[[",
"privateCertificate",
"]]",
".",
"This",
"method",
"will",
"attempt",
"to",
"fetch",
"the",
"certificate",
"value",
"from",
"[[",
"privateCertificateFile",
"]]",
"file",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/RsaSha.php#L153-L162 |
yiisoft/yii2-authclient | src/signature/RsaSha.php | RsaSha.generateSignature | public function generateSignature($baseString, $key)
{
$privateCertificateContent = $this->getPrivateCertificate();
// Pull the private key ID from the certificate
$privateKeyId = openssl_pkey_get_private($privateCertificateContent, $key);
// Sign using the key
openssl_sign($... | php | public function generateSignature($baseString, $key)
{
$privateCertificateContent = $this->getPrivateCertificate();
// Pull the private key ID from the certificate
$privateKeyId = openssl_pkey_get_private($privateCertificateContent, $key);
// Sign using the key
openssl_sign($... | [
"public",
"function",
"generateSignature",
"(",
"$",
"baseString",
",",
"$",
"key",
")",
"{",
"$",
"privateCertificateContent",
"=",
"$",
"this",
"->",
"getPrivateCertificate",
"(",
")",
";",
"// Pull the private key ID from the certificate",
"$",
"privateKeyId",
"=",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/RsaSha.php#L167-L178 |
yiisoft/yii2-authclient | src/signature/RsaSha.php | RsaSha.verify | public function verify($signature, $baseString, $key)
{
$decodedSignature = base64_decode($signature);
// Fetch the public key cert based on the request
$publicCertificate = $this->getPublicCertificate();
// Pull the public key ID from the certificate
$publicKeyId = openssl_p... | php | public function verify($signature, $baseString, $key)
{
$decodedSignature = base64_decode($signature);
// Fetch the public key cert based on the request
$publicCertificate = $this->getPublicCertificate();
// Pull the public key ID from the certificate
$publicKeyId = openssl_p... | [
"public",
"function",
"verify",
"(",
"$",
"signature",
",",
"$",
"baseString",
",",
"$",
"key",
")",
"{",
"$",
"decodedSignature",
"=",
"base64_decode",
"(",
"$",
"signature",
")",
";",
"// Fetch the public key cert based on the request",
"$",
"publicCertificate",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/RsaSha.php#L183-L196 |
yiisoft/yii2-authclient | src/clients/GitHub.php | GitHub.initUserAttributes | protected function initUserAttributes()
{
$attributes = $this->api('user', 'GET');
if (empty($attributes['email'])) {
// in case user set 'Keep my email address private' in GitHub profile, email should be retrieved via extra API request
$scopes = explode(' ', $this->scope);
... | php | protected function initUserAttributes()
{
$attributes = $this->api('user', 'GET');
if (empty($attributes['email'])) {
// in case user set 'Keep my email address private' in GitHub profile, email should be retrieved via extra API request
$scopes = explode(' ', $this->scope);
... | [
"protected",
"function",
"initUserAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"api",
"(",
"'user'",
",",
"'GET'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"attributes",
"[",
"'email'",
"]",
")",
")",
"{",
"// in case user set 'K... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/GitHub.php#L71-L92 |
yiisoft/yii2-authclient | src/clients/LinkedIn.php | LinkedIn.initUserAttributes | protected function initUserAttributes()
{
$attributes = $this->api('me?projection=(' . implode(',', $this->attributeNames) . ')', 'GET');
$scopes = explode(' ', $this->scope);
if (in_array('r_emailaddress', $scopes, true)) {
$emails = $this->api('emailAddress?q=members&projectio... | php | protected function initUserAttributes()
{
$attributes = $this->api('me?projection=(' . implode(',', $this->attributeNames) . ')', 'GET');
$scopes = explode(' ', $this->scope);
if (in_array('r_emailaddress', $scopes, true)) {
$emails = $this->api('emailAddress?q=members&projectio... | [
"protected",
"function",
"initUserAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"api",
"(",
"'me?projection=('",
".",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"attributeNames",
")",
".",
"')'",
",",
"'GET'",
")",
";",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/LinkedIn.php#L101-L115 |
yiisoft/yii2-authclient | src/BaseClient.php | BaseClient.getHttpClient | public function getHttpClient()
{
if (!is_object($this->_httpClient)) {
$this->_httpClient = $this->createHttpClient($this->_httpClient);
}
return $this->_httpClient;
} | php | public function getHttpClient()
{
if (!is_object($this->_httpClient)) {
$this->_httpClient = $this->createHttpClient($this->_httpClient);
}
return $this->_httpClient;
} | [
"public",
"function",
"getHttpClient",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"_httpClient",
")",
")",
"{",
"$",
"this",
"->",
"_httpClient",
"=",
"$",
"this",
"->",
"createHttpClient",
"(",
"$",
"this",
"->",
"_httpClient",
... | Returns HTTP client.
@return Client internal HTTP client.
@since 2.1 | [
"Returns",
"HTTP",
"client",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseClient.php#L225-L231 |
yiisoft/yii2-authclient | src/BaseClient.php | BaseClient.normalizeUserAttributes | protected function normalizeUserAttributes($attributes)
{
foreach ($this->getNormalizeUserAttributeMap() as $normalizedName => $actualName) {
if (is_scalar($actualName)) {
if (array_key_exists($actualName, $attributes)) {
$attributes[$normalizedName] = $attrib... | php | protected function normalizeUserAttributes($attributes)
{
foreach ($this->getNormalizeUserAttributeMap() as $normalizedName => $actualName) {
if (is_scalar($actualName)) {
if (array_key_exists($actualName, $attributes)) {
$attributes[$normalizedName] = $attrib... | [
"protected",
"function",
"normalizeUserAttributes",
"(",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getNormalizeUserAttributeMap",
"(",
")",
"as",
"$",
"normalizedName",
"=>",
"$",
"actualName",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",... | Normalize given user attributes according to [[normalizeUserAttributeMap]].
@param array $attributes raw attributes.
@throws InvalidConfigException on incorrect normalize attribute map.
@return array normalized attributes. | [
"Normalize",
"given",
"user",
"attributes",
"according",
"to",
"[[",
"normalizeUserAttributeMap",
"]]",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseClient.php#L341-L373 |
yiisoft/yii2-authclient | src/BaseClient.php | BaseClient.createRequest | public function createRequest()
{
return $this->getHttpClient()
->createRequest()
->addOptions($this->defaultRequestOptions())
->addOptions($this->getRequestOptions());
} | php | public function createRequest()
{
return $this->getHttpClient()
->createRequest()
->addOptions($this->defaultRequestOptions())
->addOptions($this->getRequestOptions());
} | [
"public",
"function",
"createRequest",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getHttpClient",
"(",
")",
"->",
"createRequest",
"(",
")",
"->",
"addOptions",
"(",
"$",
"this",
"->",
"defaultRequestOptions",
"(",
")",
")",
"->",
"addOptions",
"(",
"$",... | Creates HTTP request instance.
@return \yii\httpclient\Request HTTP request instance.
@since 2.1 | [
"Creates",
"HTTP",
"request",
"instance",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseClient.php#L380-L386 |
yiisoft/yii2-authclient | src/BaseClient.php | BaseClient.setState | protected function setState($key, $value)
{
$this->getStateStorage()->set($this->getStateKeyPrefix() . $key, $value);
return $this;
} | php | protected function setState($key, $value)
{
$this->getStateStorage()->set($this->getStateKeyPrefix() . $key, $value);
return $this;
} | [
"protected",
"function",
"setState",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"getStateStorage",
"(",
")",
"->",
"set",
"(",
"$",
"this",
"->",
"getStateKeyPrefix",
"(",
")",
".",
"$",
"key",
",",
"$",
"value",
")",
";",
"re... | Sets persistent state.
@param string $key state key.
@param mixed $value state value
@return $this the object itself | [
"Sets",
"persistent",
"state",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseClient.php#L407-L411 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.setAccessToken | public function setAccessToken($token)
{
if (!is_object($token) && $token !== null) {
$token = $this->createToken($token);
}
$this->_accessToken = $token;
$this->saveAccessToken($token);
} | php | public function setAccessToken($token)
{
if (!is_object($token) && $token !== null) {
$token = $this->createToken($token);
}
$this->_accessToken = $token;
$this->saveAccessToken($token);
} | [
"public",
"function",
"setAccessToken",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"token",
")",
"&&",
"$",
"token",
"!==",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"createToken",
"(",
"$",
"token",
")",
";",... | Sets access token to be used.
@param array|OAuthToken $token access token or its configuration. | [
"Sets",
"access",
"token",
"to",
"be",
"used",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L94-L101 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.setSignatureMethod | public function setSignatureMethod($signatureMethod)
{
if (!is_object($signatureMethod) && !is_array($signatureMethod)) {
throw new InvalidParamException('"' . get_class($this) . '::signatureMethod" should be instance of "\yii\autclient\signature\BaseMethod" or its array configuration. "' . gett... | php | public function setSignatureMethod($signatureMethod)
{
if (!is_object($signatureMethod) && !is_array($signatureMethod)) {
throw new InvalidParamException('"' . get_class($this) . '::signatureMethod" should be instance of "\yii\autclient\signature\BaseMethod" or its array configuration. "' . gett... | [
"public",
"function",
"setSignatureMethod",
"(",
"$",
"signatureMethod",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"signatureMethod",
")",
"&&",
"!",
"is_array",
"(",
"$",
"signatureMethod",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
... | Set signature method to be used.
@param array|signature\BaseMethod $signatureMethod signature method instance or its array configuration.
@throws InvalidParamException on wrong argument. | [
"Set",
"signature",
"method",
"to",
"be",
"used",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L120-L126 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.setHttpClient | public function setHttpClient($httpClient)
{
if (is_object($httpClient)) {
$httpClient = clone $httpClient;
$httpClient->baseUrl = $this->apiBaseUrl;
}
parent::setHttpClient($httpClient);
} | php | public function setHttpClient($httpClient)
{
if (is_object($httpClient)) {
$httpClient = clone $httpClient;
$httpClient->baseUrl = $this->apiBaseUrl;
}
parent::setHttpClient($httpClient);
} | [
"public",
"function",
"setHttpClient",
"(",
"$",
"httpClient",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"httpClient",
")",
")",
"{",
"$",
"httpClient",
"=",
"clone",
"$",
"httpClient",
";",
"$",
"httpClient",
"->",
"baseUrl",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L143-L150 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.createHttpClient | protected function createHttpClient($reference)
{
$httpClient = parent::createHttpClient($reference);
$httpClient->baseUrl = $this->apiBaseUrl;
return $httpClient;
} | php | protected function createHttpClient($reference)
{
$httpClient = parent::createHttpClient($reference);
$httpClient->baseUrl = $this->apiBaseUrl;
return $httpClient;
} | [
"protected",
"function",
"createHttpClient",
"(",
"$",
"reference",
")",
"{",
"$",
"httpClient",
"=",
"parent",
"::",
"createHttpClient",
"(",
"$",
"reference",
")",
";",
"$",
"httpClient",
"->",
"baseUrl",
"=",
"$",
"this",
"->",
"apiBaseUrl",
";",
"return"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L155-L160 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.createSignatureMethod | protected function createSignatureMethod(array $signatureMethodConfig)
{
if (!array_key_exists('class', $signatureMethodConfig)) {
$signatureMethodConfig['class'] = signature\HmacSha1::className();
}
return Yii::createObject($signatureMethodConfig);
} | php | protected function createSignatureMethod(array $signatureMethodConfig)
{
if (!array_key_exists('class', $signatureMethodConfig)) {
$signatureMethodConfig['class'] = signature\HmacSha1::className();
}
return Yii::createObject($signatureMethodConfig);
} | [
"protected",
"function",
"createSignatureMethod",
"(",
"array",
"$",
"signatureMethodConfig",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'class'",
",",
"$",
"signatureMethodConfig",
")",
")",
"{",
"$",
"signatureMethodConfig",
"[",
"'class'",
"]",
"=",
... | Creates signature method instance from its configuration.
@param array $signatureMethodConfig signature method configuration.
@return signature\BaseMethod signature method instance. | [
"Creates",
"signature",
"method",
"instance",
"from",
"its",
"configuration",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L188-L194 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.createToken | protected function createToken(array $tokenConfig = [])
{
if (!array_key_exists('class', $tokenConfig)) {
$tokenConfig['class'] = OAuthToken::className();
}
return Yii::createObject($tokenConfig);
} | php | protected function createToken(array $tokenConfig = [])
{
if (!array_key_exists('class', $tokenConfig)) {
$tokenConfig['class'] = OAuthToken::className();
}
return Yii::createObject($tokenConfig);
} | [
"protected",
"function",
"createToken",
"(",
"array",
"$",
"tokenConfig",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'class'",
",",
"$",
"tokenConfig",
")",
")",
"{",
"$",
"tokenConfig",
"[",
"'class'",
"]",
"=",
"OAuthToken",
"::... | Creates token from its configuration.
@param array $tokenConfig token configuration.
@return OAuthToken token instance. | [
"Creates",
"token",
"from",
"its",
"configuration",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L201-L207 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.sendRequest | protected function sendRequest($request)
{
$response = $request->send();
if (!$response->getIsOk()) {
throw new InvalidResponseException($response, 'Request failed with code: ' . $response->getStatusCode() . ', message: ' . $response->getContent());
}
return $response->... | php | protected function sendRequest($request)
{
$response = $request->send();
if (!$response->getIsOk()) {
throw new InvalidResponseException($response, 'Request failed with code: ' . $response->getStatusCode() . ', message: ' . $response->getContent());
}
return $response->... | [
"protected",
"function",
"sendRequest",
"(",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"request",
"->",
"send",
"(",
")",
";",
"if",
"(",
"!",
"$",
"response",
"->",
"getIsOk",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidResponseException",
... | Sends the given HTTP request, returning response data.
@param \yii\httpclient\Request $request HTTP request to be sent.
@return array response data.
@throws InvalidResponseException on invalid remote response.
@since 2.1 | [
"Sends",
"the",
"given",
"HTTP",
"request",
"returning",
"response",
"data",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L216-L225 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.restoreAccessToken | protected function restoreAccessToken()
{
$token = $this->getState('token');
if (is_object($token)) {
/* @var $token OAuthToken */
if ($token->getIsExpired() && $this->autoRefreshAccessToken) {
$token = $this->refreshAccessToken($token);
}
... | php | protected function restoreAccessToken()
{
$token = $this->getState('token');
if (is_object($token)) {
/* @var $token OAuthToken */
if ($token->getIsExpired() && $this->autoRefreshAccessToken) {
$token = $this->refreshAccessToken($token);
}
... | [
"protected",
"function",
"restoreAccessToken",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"getState",
"(",
"'token'",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"token",
")",
")",
"{",
"/* @var $token OAuthToken */",
"if",
"(",
"$",
"token",
"... | Restores access token.
@return OAuthToken auth token. | [
"Restores",
"access",
"token",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L260-L270 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.createApiRequest | public function createApiRequest()
{
$request = $this->createRequest();
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeApiRequestSend']);
return $request;
} | php | public function createApiRequest()
{
$request = $this->createRequest();
$request->on(Request::EVENT_BEFORE_SEND, [$this, 'beforeApiRequestSend']);
return $request;
} | [
"public",
"function",
"createApiRequest",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequest",
"(",
")",
";",
"$",
"request",
"->",
"on",
"(",
"Request",
"::",
"EVENT_BEFORE_SEND",
",",
"[",
"$",
"this",
",",
"'beforeApiRequestSend'",
"]... | Creates an HTTP request for the API call.
The created request will be automatically processed adding access token parameters and signature
before sending. You may use [[createRequest()]] to gain full control over request composition and execution.
@see createRequest()
@return Request HTTP request instance.
@since 2.1 | [
"Creates",
"an",
"HTTP",
"request",
"for",
"the",
"API",
"call",
".",
"The",
"created",
"request",
"will",
"be",
"automatically",
"processed",
"adding",
"access",
"token",
"parameters",
"and",
"signature",
"before",
"sending",
".",
"You",
"may",
"use",
"[[",
... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L280-L285 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.beforeApiRequestSend | public function beforeApiRequestSend($event)
{
$accessToken = $this->getAccessToken();
if (!is_object($accessToken) || !$accessToken->getIsValid()) {
throw new Exception('Invalid access token.');
}
$this->applyAccessTokenToRequest($event->request, $accessToken);
} | php | public function beforeApiRequestSend($event)
{
$accessToken = $this->getAccessToken();
if (!is_object($accessToken) || !$accessToken->getIsValid()) {
throw new Exception('Invalid access token.');
}
$this->applyAccessTokenToRequest($event->request, $accessToken);
} | [
"public",
"function",
"beforeApiRequestSend",
"(",
"$",
"event",
")",
"{",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"getAccessToken",
"(",
")",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"accessToken",
")",
"||",
"!",
"$",
"accessToken",
"->",
"getIs... | Handles [[Request::EVENT_BEFORE_SEND]] event.
Applies [[accessToken]] to the request.
@param \yii\httpclient\RequestEvent $event event instance.
@throws Exception on invalid access token.
@since 2.1 | [
"Handles",
"[[",
"Request",
"::",
"EVENT_BEFORE_SEND",
"]]",
"event",
".",
"Applies",
"[[",
"accessToken",
"]]",
"to",
"the",
"request",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L294-L302 |
yiisoft/yii2-authclient | src/BaseOAuth.php | BaseOAuth.api | public function api($apiSubUrl, $method = 'GET', $data = [], $headers = [])
{
$request = $this->createApiRequest()
->setMethod($method)
->setUrl($apiSubUrl)
->addHeaders($headers);
if (!empty($data)) {
if (is_array($data)) {
$request->... | php | public function api($apiSubUrl, $method = 'GET', $data = [], $headers = [])
{
$request = $this->createApiRequest()
->setMethod($method)
->setUrl($apiSubUrl)
->addHeaders($headers);
if (!empty($data)) {
if (is_array($data)) {
$request->... | [
"public",
"function",
"api",
"(",
"$",
"apiSubUrl",
",",
"$",
"method",
"=",
"'GET'",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createApiRequest",
"(",
")",
"->",
"setM... | Performs request to the OAuth API returning response data.
You may use [[createApiRequest()]] method instead, gaining more control over request execution.
@see createApiRequest()
@param string $apiSubUrl API sub URL, which will be append to [[apiBaseUrl]], or absolute API URL.
@param string $method request method.
@par... | [
"Performs",
"request",
"to",
"the",
"OAuth",
"API",
"returning",
"response",
"data",
".",
"You",
"may",
"use",
"[[",
"createApiRequest",
"()",
"]]",
"method",
"instead",
"gaining",
"more",
"control",
"over",
"request",
"execution",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/BaseOAuth.php#L314-L330 |
yiisoft/yii2-authclient | src/signature/BaseMethod.php | BaseMethod.verify | public function verify($signature, $baseString, $key)
{
$expectedSignature = $this->generateSignature($baseString, $key);
if (empty($signature) || empty($expectedSignature)) {
return false;
}
return (strcmp($expectedSignature, $signature) === 0);
} | php | public function verify($signature, $baseString, $key)
{
$expectedSignature = $this->generateSignature($baseString, $key);
if (empty($signature) || empty($expectedSignature)) {
return false;
}
return (strcmp($expectedSignature, $signature) === 0);
} | [
"public",
"function",
"verify",
"(",
"$",
"signature",
",",
"$",
"baseString",
",",
"$",
"key",
")",
"{",
"$",
"expectedSignature",
"=",
"$",
"this",
"->",
"generateSignature",
"(",
"$",
"baseString",
",",
"$",
"key",
")",
";",
"if",
"(",
"empty",
"(",... | Verifies given OAuth request.
@param string $signature signature to be verified.
@param string $baseString signature base string.
@param string $key signature key.
@return bool success. | [
"Verifies",
"given",
"OAuth",
"request",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/signature/BaseMethod.php#L41-L49 |
yiisoft/yii2-authclient | src/OAuthToken.php | OAuthToken.defaultExpireDurationParamKey | protected function defaultExpireDurationParamKey()
{
$expireDurationParamKey = 'expires_in';
foreach ($this->getParams() as $name => $value) {
if (strpos($name, 'expir') !== false) {
$expireDurationParamKey = $name;
break;
}
}
... | php | protected function defaultExpireDurationParamKey()
{
$expireDurationParamKey = 'expires_in';
foreach ($this->getParams() as $name => $value) {
if (strpos($name, 'expir') !== false) {
$expireDurationParamKey = $name;
break;
}
}
... | [
"protected",
"function",
"defaultExpireDurationParamKey",
"(",
")",
"{",
"$",
"expireDurationParamKey",
"=",
"'expires_in'",
";",
"foreach",
"(",
"$",
"this",
"->",
"getParams",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"strpos",
... | Fetches default expire duration param key.
@return string expire duration param key. | [
"Fetches",
"default",
"expire",
"duration",
"param",
"key",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuthToken.php#L190-L201 |
yiisoft/yii2-authclient | src/OAuthToken.php | OAuthToken.getIsExpired | public function getIsExpired()
{
$expirationDuration = $this->getExpireDuration();
if (empty($expirationDuration)) {
return false;
}
return (time() >= ($this->createTimestamp + $expirationDuration));
} | php | public function getIsExpired()
{
$expirationDuration = $this->getExpireDuration();
if (empty($expirationDuration)) {
return false;
}
return (time() >= ($this->createTimestamp + $expirationDuration));
} | [
"public",
"function",
"getIsExpired",
"(",
")",
"{",
"$",
"expirationDuration",
"=",
"$",
"this",
"->",
"getExpireDuration",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"expirationDuration",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"ti... | Checks if token has expired.
@return bool is token expired. | [
"Checks",
"if",
"token",
"has",
"expired",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuthToken.php#L207-L215 |
yiisoft/yii2-authclient | src/clients/Facebook.php | Facebook.applyAccessTokenToRequest | public function applyAccessTokenToRequest($request, $accessToken)
{
parent::applyAccessTokenToRequest($request, $accessToken);
$data = $request->getData();
if (($machineId = $accessToken->getParam('machine_id')) !== null) {
$data['machine_id'] = $machineId;
}
$da... | php | public function applyAccessTokenToRequest($request, $accessToken)
{
parent::applyAccessTokenToRequest($request, $accessToken);
$data = $request->getData();
if (($machineId = $accessToken->getParam('machine_id')) !== null) {
$data['machine_id'] = $machineId;
}
$da... | [
"public",
"function",
"applyAccessTokenToRequest",
"(",
"$",
"request",
",",
"$",
"accessToken",
")",
"{",
"parent",
"::",
"applyAccessTokenToRequest",
"(",
"$",
"request",
",",
"$",
"accessToken",
")",
";",
"$",
"data",
"=",
"$",
"request",
"->",
"getData",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/Facebook.php#L104-L114 |
yiisoft/yii2-authclient | src/clients/Facebook.php | Facebook.fetchAccessToken | public function fetchAccessToken($authCode, array $params = [])
{
$token = parent::fetchAccessToken($authCode, $params);
if ($this->autoExchangeAccessToken) {
$token = $this->exchangeAccessToken($token);
}
return $token;
} | php | public function fetchAccessToken($authCode, array $params = [])
{
$token = parent::fetchAccessToken($authCode, $params);
if ($this->autoExchangeAccessToken) {
$token = $this->exchangeAccessToken($token);
}
return $token;
} | [
"public",
"function",
"fetchAccessToken",
"(",
"$",
"authCode",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"token",
"=",
"parent",
"::",
"fetchAccessToken",
"(",
"$",
"authCode",
",",
"$",
"params",
")",
";",
"if",
"(",
"$",
"this",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/Facebook.php#L146-L153 |
yiisoft/yii2-authclient | src/clients/Facebook.php | Facebook.exchangeAccessToken | public function exchangeAccessToken(OAuthToken $token)
{
$params = [
'grant_type' => 'fb_exchange_token',
'fb_exchange_token' => $token->getToken(),
];
$request = $this->createRequest()
->setMethod('POST')
->setUrl($this->tokenUrl)
... | php | public function exchangeAccessToken(OAuthToken $token)
{
$params = [
'grant_type' => 'fb_exchange_token',
'fb_exchange_token' => $token->getToken(),
];
$request = $this->createRequest()
->setMethod('POST')
->setUrl($this->tokenUrl)
... | [
"public",
"function",
"exchangeAccessToken",
"(",
"OAuthToken",
"$",
"token",
")",
"{",
"$",
"params",
"=",
"[",
"'grant_type'",
"=>",
"'fb_exchange_token'",
",",
"'fb_exchange_token'",
"=>",
"$",
"token",
"->",
"getToken",
"(",
")",
",",
"]",
";",
"$",
"req... | Exchanges short-live (2 hours) access token to long-live (60 days) one.
Note that this method will success for already long-live token, but will not actually prolong it any further.
Pay attention, that this method will fail on already expired access token.
@see https://developers.facebook.com/docs/facebook-login/access... | [
"Exchanges",
"short",
"-",
"live",
"(",
"2",
"hours",
")",
"access",
"token",
"to",
"long",
"-",
"live",
"(",
"60",
"days",
")",
"one",
".",
"Note",
"that",
"this",
"method",
"will",
"success",
"for",
"already",
"long",
"-",
"live",
"token",
"but",
"... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/Facebook.php#L164-L184 |
yiisoft/yii2-authclient | src/clients/Facebook.php | Facebook.fetchClientAuthCode | public function fetchClientAuthCode(OAuthToken $token = null, $params = [])
{
if ($token === null) {
$token = $this->getAccessToken();
}
$params = array_merge([
'access_token' => $token->getToken(),
'redirect_uri' => $this->getReturnUrl(),
], $par... | php | public function fetchClientAuthCode(OAuthToken $token = null, $params = [])
{
if ($token === null) {
$token = $this->getAccessToken();
}
$params = array_merge([
'access_token' => $token->getToken(),
'redirect_uri' => $this->getReturnUrl(),
], $par... | [
"public",
"function",
"fetchClientAuthCode",
"(",
"OAuthToken",
"$",
"token",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"token",
"===",
"null",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"getAccessToken",
"(",
")"... | Requests the authorization code for the client-specific access token.
This make sense for the distributed applications, which provides several Auth clients (web and mobile)
to avoid triggering Facebook's automated spam systems.
@see https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extens... | [
"Requests",
"the",
"authorization",
"code",
"for",
"the",
"client",
"-",
"specific",
"access",
"token",
".",
"This",
"make",
"sense",
"for",
"the",
"distributed",
"applications",
"which",
"provides",
"several",
"Auth",
"clients",
"(",
"web",
"and",
"mobile",
"... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/Facebook.php#L197-L218 |
yiisoft/yii2-authclient | src/clients/Facebook.php | Facebook.fetchClientAccessToken | public function fetchClientAccessToken($authCode, array $params = [])
{
$params = array_merge([
'code' => $authCode,
'redirect_uri' => $this->getReturnUrl(),
'client_id' => $this->clientId,
], $params);
$request = $this->createRequest()
->setM... | php | public function fetchClientAccessToken($authCode, array $params = [])
{
$params = array_merge([
'code' => $authCode,
'redirect_uri' => $this->getReturnUrl(),
'client_id' => $this->clientId,
], $params);
$request = $this->createRequest()
->setM... | [
"public",
"function",
"fetchClientAccessToken",
"(",
"$",
"authCode",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"[",
"'code'",
"=>",
"$",
"authCode",
",",
"'redirect_uri'",
"=>",
"$",
"this",
"->",
"get... | Fetches access token from client-specific authorization code.
This make sense for the distributed applications, which provides several Auth clients (web and mobile)
to avoid triggering Facebook's automated spam systems.
@see https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension
@see... | [
"Fetches",
"access",
"token",
"from",
"client",
"-",
"specific",
"authorization",
"code",
".",
"This",
"make",
"sense",
"for",
"the",
"distributed",
"applications",
"which",
"provides",
"several",
"Auth",
"clients",
"(",
"web",
"and",
"mobile",
")",
"to",
"avo... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/clients/Facebook.php#L231-L250 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.discoverConfig | protected function discoverConfig()
{
$request = $this->createRequest();
$configUrl = rtrim($this->issuerUrl, '/') . '/.well-known/openid-configuration';
$request->setMethod('GET')
->setUrl($configUrl);
$response = $this->sendRequest($request);
return $response;
... | php | protected function discoverConfig()
{
$request = $this->createRequest();
$configUrl = rtrim($this->issuerUrl, '/') . '/.well-known/openid-configuration';
$request->setMethod('GET')
->setUrl($configUrl);
$response = $this->sendRequest($request);
return $response;
... | [
"protected",
"function",
"discoverConfig",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequest",
"(",
")",
";",
"$",
"configUrl",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"issuerUrl",
",",
"'/'",
")",
".",
"'/.well-known/openid-configuration'"... | Discovers OpenID Provider configuration parameters.
@return array OpenID Provider configuration parameters.
@throws InvalidResponseException on failure. | [
"Discovers",
"OpenID",
"Provider",
"configuration",
"parameters",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L206-L214 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.buildAuthUrl | public function buildAuthUrl(array $params = [])
{
if ($this->authUrl === null) {
$this->authUrl = $this->getConfigParam('authorization_endpoint');
}
return parent::buildAuthUrl($params);
} | php | public function buildAuthUrl(array $params = [])
{
if ($this->authUrl === null) {
$this->authUrl = $this->getConfigParam('authorization_endpoint');
}
return parent::buildAuthUrl($params);
} | [
"public",
"function",
"buildAuthUrl",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"authUrl",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"authUrl",
"=",
"$",
"this",
"->",
"getConfigParam",
"(",
"'authorization_e... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L219-L225 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.fetchAccessToken | public function fetchAccessToken($authCode, array $params = [])
{
if ($this->tokenUrl === null) {
$this->tokenUrl = $this->getConfigParam('token_endpoint');
}
if (!isset($params['nonce']) && $this->getValidateAuthNonce()) {
$nonce = $this->generateAuthNonce();
... | php | public function fetchAccessToken($authCode, array $params = [])
{
if ($this->tokenUrl === null) {
$this->tokenUrl = $this->getConfigParam('token_endpoint');
}
if (!isset($params['nonce']) && $this->getValidateAuthNonce()) {
$nonce = $this->generateAuthNonce();
... | [
"public",
"function",
"fetchAccessToken",
"(",
"$",
"authCode",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokenUrl",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"tokenUrl",
"=",
"$",
"this",
"->",
"getConfig... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L230-L243 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.refreshAccessToken | public function refreshAccessToken(OAuthToken $token)
{
if ($this->tokenUrl === null) {
$this->tokenUrl = $this->getConfigParam('token_endpoint');
}
return parent::refreshAccessToken($token);
} | php | public function refreshAccessToken(OAuthToken $token)
{
if ($this->tokenUrl === null) {
$this->tokenUrl = $this->getConfigParam('token_endpoint');
}
return parent::refreshAccessToken($token);
} | [
"public",
"function",
"refreshAccessToken",
"(",
"OAuthToken",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokenUrl",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"tokenUrl",
"=",
"$",
"this",
"->",
"getConfigParam",
"(",
"'token_endpoint'",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L248-L254 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.applyClientCredentialsToRequest | protected function applyClientCredentialsToRequest($request)
{
$supportedAuthMethods = $this->getConfigParam('token_endpoint_auth_methods_supported');
if (in_array('client_secret_basic', $supportedAuthMethods)) {
$request->addHeaders([
'Authorization' => 'Basic ' . base6... | php | protected function applyClientCredentialsToRequest($request)
{
$supportedAuthMethods = $this->getConfigParam('token_endpoint_auth_methods_supported');
if (in_array('client_secret_basic', $supportedAuthMethods)) {
$request->addHeaders([
'Authorization' => 'Basic ' . base6... | [
"protected",
"function",
"applyClientCredentialsToRequest",
"(",
"$",
"request",
")",
"{",
"$",
"supportedAuthMethods",
"=",
"$",
"this",
"->",
"getConfigParam",
"(",
"'token_endpoint_auth_methods_supported'",
")",
";",
"if",
"(",
"in_array",
"(",
"'client_secret_basic'... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L276-L315 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.defaultReturnUrl | protected function defaultReturnUrl()
{
$params = Yii::$app->getRequest()->getQueryParams();
// OAuth2 specifics :
unset($params['code']);
unset($params['state']);
// OpenIdConnect specifics :
unset($params['nonce']);
unset($params['authuser']);
unset(... | php | protected function defaultReturnUrl()
{
$params = Yii::$app->getRequest()->getQueryParams();
// OAuth2 specifics :
unset($params['code']);
unset($params['state']);
// OpenIdConnect specifics :
unset($params['nonce']);
unset($params['authuser']);
unset(... | [
"protected",
"function",
"defaultReturnUrl",
"(",
")",
"{",
"$",
"params",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getQueryParams",
"(",
")",
";",
"// OAuth2 specifics :",
"unset",
"(",
"$",
"params",
"[",
"'code'",
"]",
")",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L320-L334 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.createToken | protected function createToken(array $tokenConfig = [])
{
if ($this->validateJws) {
$jwsData = $this->loadJws($tokenConfig['params']['id_token']);
$this->validateClaims($jwsData);
$tokenConfig['params'] = array_merge($tokenConfig['params'], $jwsData);
if ($th... | php | protected function createToken(array $tokenConfig = [])
{
if ($this->validateJws) {
$jwsData = $this->loadJws($tokenConfig['params']['id_token']);
$this->validateClaims($jwsData);
$tokenConfig['params'] = array_merge($tokenConfig['params'], $jwsData);
if ($th... | [
"protected",
"function",
"createToken",
"(",
"array",
"$",
"tokenConfig",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validateJws",
")",
"{",
"$",
"jwsData",
"=",
"$",
"this",
"->",
"loadJws",
"(",
"$",
"tokenConfig",
"[",
"'params'",
"]",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L339-L357 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.loadJws | protected function loadJws($jws)
{
try {
$jwkSet = JWKFactory::createFromJKU($this->getConfigParam('jwks_uri'));
$loader = new Loader();
return $loader->loadAndVerifySignatureUsingKeySet($jws, $jwkSet, $this->allowedJwsAlgorithms)->getPayload();
} catch (\Exceptio... | php | protected function loadJws($jws)
{
try {
$jwkSet = JWKFactory::createFromJKU($this->getConfigParam('jwks_uri'));
$loader = new Loader();
return $loader->loadAndVerifySignatureUsingKeySet($jws, $jwkSet, $this->allowedJwsAlgorithms)->getPayload();
} catch (\Exceptio... | [
"protected",
"function",
"loadJws",
"(",
"$",
"jws",
")",
"{",
"try",
"{",
"$",
"jwkSet",
"=",
"JWKFactory",
"::",
"createFromJKU",
"(",
"$",
"this",
"->",
"getConfigParam",
"(",
"'jwks_uri'",
")",
")",
";",
"$",
"loader",
"=",
"new",
"Loader",
"(",
")... | Decrypts/validates JWS, returning related data.
@param string $jws raw JWS input.
@return array JWS underlying data.
@throws HttpException on invalid JWS signature. | [
"Decrypts",
"/",
"validates",
"JWS",
"returning",
"related",
"data",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L365-L375 |
yiisoft/yii2-authclient | src/OpenIdConnect.php | OpenIdConnect.validateClaims | private function validateClaims(array $claims)
{
if (!isset($claims['iss']) || (strcmp(rtrim($claims['iss'], '/'), rtrim($this->issuerUrl, '/')) !== 0)) {
throw new HttpException(400, 'Invalid "iss"');
}
if (!isset($claims['aud']) || (strcmp($claims['aud'], $this->clientId) !== 0... | php | private function validateClaims(array $claims)
{
if (!isset($claims['iss']) || (strcmp(rtrim($claims['iss'], '/'), rtrim($this->issuerUrl, '/')) !== 0)) {
throw new HttpException(400, 'Invalid "iss"');
}
if (!isset($claims['aud']) || (strcmp($claims['aud'], $this->clientId) !== 0... | [
"private",
"function",
"validateClaims",
"(",
"array",
"$",
"claims",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"claims",
"[",
"'iss'",
"]",
")",
"||",
"(",
"strcmp",
"(",
"rtrim",
"(",
"$",
"claims",
"[",
"'iss'",
"]",
",",
"'/'",
")",
",",
"... | Validates the claims data received from OpenID provider.
@param array $claims claims data.
@throws HttpException on invalid claims. | [
"Validates",
"the",
"claims",
"data",
"received",
"from",
"OpenID",
"provider",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenIdConnect.php#L382-L390 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.defaultBaseAuthUrl | protected function defaultBaseAuthUrl()
{
$baseAuthUrl = [
Yii::$app->controller->getRoute()
];
$params = Yii::$app->getRequest()->getQueryParams();
unset($params[$this->clientIdGetParamName]);
$baseAuthUrl = array_merge($baseAuthUrl, $params);
return $ba... | php | protected function defaultBaseAuthUrl()
{
$baseAuthUrl = [
Yii::$app->controller->getRoute()
];
$params = Yii::$app->getRequest()->getQueryParams();
unset($params[$this->clientIdGetParamName]);
$baseAuthUrl = array_merge($baseAuthUrl, $params);
return $ba... | [
"protected",
"function",
"defaultBaseAuthUrl",
"(",
")",
"{",
"$",
"baseAuthUrl",
"=",
"[",
"Yii",
"::",
"$",
"app",
"->",
"controller",
"->",
"getRoute",
"(",
")",
"]",
";",
"$",
"params",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
... | Composes default base auth URL configuration.
@return array base auth URL configuration. | [
"Composes",
"default",
"base",
"auth",
"URL",
"configuration",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L163-L173 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.clientLink | public function clientLink($client, $text = null, array $htmlOptions = [])
{
$viewOptions = $client->getViewOptions();
if (empty($viewOptions['widget'])) {
if ($text === null) {
$text = Html::tag('span', '', ['class' => 'auth-icon ' . $client->getName()]);
}
... | php | public function clientLink($client, $text = null, array $htmlOptions = [])
{
$viewOptions = $client->getViewOptions();
if (empty($viewOptions['widget'])) {
if ($text === null) {
$text = Html::tag('span', '', ['class' => 'auth-icon ' . $client->getName()]);
}
... | [
"public",
"function",
"clientLink",
"(",
"$",
"client",
",",
"$",
"text",
"=",
"null",
",",
"array",
"$",
"htmlOptions",
"=",
"[",
"]",
")",
"{",
"$",
"viewOptions",
"=",
"$",
"client",
"->",
"getViewOptions",
"(",
")",
";",
"if",
"(",
"empty",
"(",
... | Outputs client auth link.
@param ClientInterface $client external auth client instance.
@param string $text link text, if not set - default value will be generated.
@param array $htmlOptions link HTML options.
@return string generated HTML.
@throws InvalidConfigException on wrong configuration. | [
"Outputs",
"client",
"auth",
"link",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L183-L223 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.createClientUrl | public function createClientUrl($client)
{
$this->autoRender = false;
$url = $this->getBaseAuthUrl();
$url[$this->clientIdGetParamName] = $client->getId();
return Url::to($url);
} | php | public function createClientUrl($client)
{
$this->autoRender = false;
$url = $this->getBaseAuthUrl();
$url[$this->clientIdGetParamName] = $client->getId();
return Url::to($url);
} | [
"public",
"function",
"createClientUrl",
"(",
"$",
"client",
")",
"{",
"$",
"this",
"->",
"autoRender",
"=",
"false",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"getBaseAuthUrl",
"(",
")",
";",
"$",
"url",
"[",
"$",
"this",
"->",
"clientIdGetParamName",
... | Composes client auth URL.
@param ClientInterface $client external auth client instance.
@return string auth URL. | [
"Composes",
"client",
"auth",
"URL",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L230-L237 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.renderMainContent | protected function renderMainContent()
{
$items = [];
foreach ($this->getClients() as $externalService) {
$items[] = Html::tag('li', $this->clientLink($externalService));
}
return Html::tag('ul', implode('', $items), ['class' => 'auth-clients']);
} | php | protected function renderMainContent()
{
$items = [];
foreach ($this->getClients() as $externalService) {
$items[] = Html::tag('li', $this->clientLink($externalService));
}
return Html::tag('ul', implode('', $items), ['class' => 'auth-clients']);
} | [
"protected",
"function",
"renderMainContent",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getClients",
"(",
")",
"as",
"$",
"externalService",
")",
"{",
"$",
"items",
"[",
"]",
"=",
"Html",
"::",
"tag",
"(",
... | Renders the main content, which includes all external services links.
@return string generated HTML. | [
"Renders",
"the",
"main",
"content",
"which",
"includes",
"all",
"external",
"services",
"links",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L243-L250 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.init | public function init()
{
$view = Yii::$app->getView();
if ($this->popupMode) {
AuthChoiceAsset::register($view);
if (empty($this->clientOptions)) {
$options = '';
} else {
$options = Json::htmlEncode($this->clientOptions);
... | php | public function init()
{
$view = Yii::$app->getView();
if ($this->popupMode) {
AuthChoiceAsset::register($view);
if (empty($this->clientOptions)) {
$options = '';
} else {
$options = Json::htmlEncode($this->clientOptions);
... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"view",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getView",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"popupMode",
")",
"{",
"AuthChoiceAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"if",
"(... | Initializes the widget. | [
"Initializes",
"the",
"widget",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L255-L271 |
yiisoft/yii2-authclient | src/widgets/AuthChoice.php | AuthChoice.run | public function run()
{
$content = '';
if ($this->autoRender) {
$content .= $this->renderMainContent();
}
$content .= Html::endTag('div');
return $content;
} | php | public function run()
{
$content = '';
if ($this->autoRender) {
$content .= $this->renderMainContent();
}
$content .= Html::endTag('div');
return $content;
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"autoRender",
")",
"{",
"$",
"content",
".=",
"$",
"this",
"->",
"renderMainContent",
"(",
")",
";",
"}",
"$",
"content",
".=",
"Html",
"::",
... | Runs the widget.
@return string rendered HTML. | [
"Runs",
"the",
"widget",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/AuthChoice.php#L277-L285 |
yiisoft/yii2-authclient | src/widgets/GooglePlusButton.php | GooglePlusButton.generateCallback | protected function generateCallback($url = [])
{
if (empty($url)) {
$url = $this->authChoice->createClientUrl($this->client);
} else {
$url = Url::to($url);
}
if (strpos($url, '?') === false) {
$url .= '?';
} else {
$url .= '&';... | php | protected function generateCallback($url = [])
{
if (empty($url)) {
$url = $this->authChoice->createClientUrl($this->client);
} else {
$url = Url::to($url);
}
if (strpos($url, '?') === false) {
$url .= '?';
} else {
$url .= '&';... | [
"protected",
"function",
"generateCallback",
"(",
"$",
"url",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"authChoice",
"->",
"createClientUrl",
"(",
"$",
"this",
"->",
"client",
... | Generates JavaScript callback function, which will be used to handle auth response.
@param array $url auth callback URL.
@return string JavaScript function name. | [
"Generates",
"JavaScript",
"callback",
"function",
"which",
"will",
"be",
"used",
"to",
"handle",
"auth",
"response",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/GooglePlusButton.php#L91-L132 |
yiisoft/yii2-authclient | src/widgets/GooglePlusButton.php | GooglePlusButton.renderButton | protected function renderButton()
{
$buttonHtmlOptions = array_merge(
[
'class' => 'g-signin',
'data-callback' => $this->getCallback(),
'data-clientid' => $this->client->clientId,
'data-cookiepolicy' => 'single_host_origin',
... | php | protected function renderButton()
{
$buttonHtmlOptions = array_merge(
[
'class' => 'g-signin',
'data-callback' => $this->getCallback(),
'data-clientid' => $this->client->clientId,
'data-cookiepolicy' => 'single_host_origin',
... | [
"protected",
"function",
"renderButton",
"(",
")",
"{",
"$",
"buttonHtmlOptions",
"=",
"array_merge",
"(",
"[",
"'class'",
"=>",
"'g-signin'",
",",
"'data-callback'",
"=>",
"$",
"this",
"->",
"getCallback",
"(",
")",
",",
"'data-clientid'",
"=>",
"$",
"this",
... | Renders sign-in button.
@return string button HTML. | [
"Renders",
"sign",
"-",
"in",
"button",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/widgets/GooglePlusButton.php#L153-L169 |
yiisoft/yii2-authclient | src/OAuth2.php | OAuth2.fetchAccessToken | public function fetchAccessToken($authCode, array $params = [])
{
if ($this->validateAuthState) {
$authState = $this->getState('authState');
$incomingRequest = Yii::$app->getRequest();
$incomingState = $incomingRequest->get('state', $incomingRequest->post('state'));
... | php | public function fetchAccessToken($authCode, array $params = [])
{
if ($this->validateAuthState) {
$authState = $this->getState('authState');
$incomingRequest = Yii::$app->getRequest();
$incomingState = $incomingRequest->get('state', $incomingRequest->post('state'));
... | [
"public",
"function",
"fetchAccessToken",
"(",
"$",
"authCode",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validateAuthState",
")",
"{",
"$",
"authState",
"=",
"$",
"this",
"->",
"getState",
"(",
"'authState'",
... | Fetches access token from authorization code.
@param string $authCode authorization code, usually comes at GET parameter 'code'.
@param array $params additional request params.
@return OAuthToken access token.
@throws HttpException on invalid auth state in case [[enableStateValidation]] is enabled. | [
"Fetches",
"access",
"token",
"from",
"authorization",
"code",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth2.php#L99-L130 |
yiisoft/yii2-authclient | src/OAuth2.php | OAuth2.generateAuthState | protected function generateAuthState()
{
$baseString = get_class($this) . '-' . time();
if (Yii::$app->has('session')) {
$baseString .= '-' . Yii::$app->session->getId();
}
return hash('sha256', uniqid($baseString, true));
} | php | protected function generateAuthState()
{
$baseString = get_class($this) . '-' . time();
if (Yii::$app->has('session')) {
$baseString .= '-' . Yii::$app->session->getId();
}
return hash('sha256', uniqid($baseString, true));
} | [
"protected",
"function",
"generateAuthState",
"(",
")",
"{",
"$",
"baseString",
"=",
"get_class",
"(",
"$",
"this",
")",
".",
"'-'",
".",
"time",
"(",
")",
";",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"has",
"(",
"'session'",
")",
")",
"{",
"$",
... | Generates the auth state value.
@return string auth state value.
@since 2.1 | [
"Generates",
"the",
"auth",
"state",
"value",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth2.php#L203-L210 |
yiisoft/yii2-authclient | src/OAuth2.php | OAuth2.authenticateClient | public function authenticateClient($params = [])
{
$defaultParams = [
'grant_type' => 'client_credentials',
];
if (!empty($this->scope)) {
$defaultParams['scope'] = $this->scope;
}
$request = $this->createRequest()
->setMethod('POST')
... | php | public function authenticateClient($params = [])
{
$defaultParams = [
'grant_type' => 'client_credentials',
];
if (!empty($this->scope)) {
$defaultParams['scope'] = $this->scope;
}
$request = $this->createRequest()
->setMethod('POST')
... | [
"public",
"function",
"authenticateClient",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"defaultParams",
"=",
"[",
"'grant_type'",
"=>",
"'client_credentials'",
",",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"scope",
")",
")",
"{... | Authenticate OAuth client directly at the provider without third party (user) involved,
using 'client_credentials' grant type.
@see http://tools.ietf.org/html/rfc6749#section-4.4
@param array $params additional request params.
@return OAuthToken access token.
@since 2.1.0 | [
"Authenticate",
"OAuth",
"client",
"directly",
"at",
"the",
"provider",
"without",
"third",
"party",
"(",
"user",
")",
"involved",
"using",
"client_credentials",
"grant",
"type",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth2.php#L232-L255 |
yiisoft/yii2-authclient | src/OAuth2.php | OAuth2.authenticateUserJwt | public function authenticateUserJwt($username, $signature = null, $options = [], $params = [])
{
if (empty($signature)) {
$signatureMethod = $this->getSignatureMethod();
} elseif (is_object($signature)) {
$signatureMethod = $signature;
} else {
$signatureM... | php | public function authenticateUserJwt($username, $signature = null, $options = [], $params = [])
{
if (empty($signature)) {
$signatureMethod = $this->getSignatureMethod();
} elseif (is_object($signature)) {
$signatureMethod = $signature;
} else {
$signatureM... | [
"public",
"function",
"authenticateUserJwt",
"(",
"$",
"username",
",",
"$",
"signature",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"signature",
")",
")",
"{",
"$",
... | Authenticates user directly using JSON Web Token (JWT).
@see https://tools.ietf.org/html/rfc7515
@param string $username
@param \yii\authclient\signature\BaseMethod|array $signature signature method or its array configuration.
If empty - [[signatureMethod]] will be used.
@param array $options additional options. Valid ... | [
"Authenticates",
"user",
"directly",
"using",
"JSON",
"Web",
"Token",
"(",
"JWT",
")",
".",
"@see",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7515",
"@param",
"string",
"$username",
"@param",
"\\",
"yii",
"\\",
"authclie... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OAuth2.php#L309-L364 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.run | public function run()
{
$clientId = Yii::$app->getRequest()->getQueryParam($this->clientIdGetParamName);
if (!empty($clientId)) {
/* @var $collection \yii\authclient\Collection */
$collection = Yii::$app->get($this->clientCollection);
if (!$collection->hasClient($... | php | public function run()
{
$clientId = Yii::$app->getRequest()->getQueryParam($this->clientIdGetParamName);
if (!empty($clientId)) {
/* @var $collection \yii\authclient\Collection */
$collection = Yii::$app->get($this->clientCollection);
if (!$collection->hasClient($... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"clientId",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getQueryParam",
"(",
"$",
"this",
"->",
"clientIdGetParamName",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"clientId",
"... | Runs the action. | [
"Runs",
"the",
"action",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L199-L214 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.auth | protected function auth($client, $authUrlParams = [])
{
if ($client instanceof OAuth2) {
return $this->authOAuth2($client, $authUrlParams);
} elseif ($client instanceof OAuth1) {
return $this->authOAuth1($client, $authUrlParams);
} elseif ($client instanceof OpenId) {... | php | protected function auth($client, $authUrlParams = [])
{
if ($client instanceof OAuth2) {
return $this->authOAuth2($client, $authUrlParams);
} elseif ($client instanceof OAuth1) {
return $this->authOAuth1($client, $authUrlParams);
} elseif ($client instanceof OpenId) {... | [
"protected",
"function",
"auth",
"(",
"$",
"client",
",",
"$",
"authUrlParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"client",
"instanceof",
"OAuth2",
")",
"{",
"return",
"$",
"this",
"->",
"authOAuth2",
"(",
"$",
"client",
",",
"$",
"authUrlParams... | Perform authentication for the given client.
@param mixed $client auth client instance.
@param array $authUrlParams additional auth GET params.
@return Response response instance.
@throws \yii\base\NotSupportedException on invalid client. | [
"Perform",
"authentication",
"for",
"the",
"given",
"client",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L223-L234 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.authSuccess | protected function authSuccess($client)
{
if (!is_callable($this->successCallback)) {
throw new InvalidConfigException('"' . get_class($this) . '::$successCallback" should be a valid callback.');
}
$response = call_user_func($this->successCallback, $client);
if ($respons... | php | protected function authSuccess($client)
{
if (!is_callable($this->successCallback)) {
throw new InvalidConfigException('"' . get_class($this) . '::$successCallback" should be a valid callback.');
}
$response = call_user_func($this->successCallback, $client);
if ($respons... | [
"protected",
"function",
"authSuccess",
"(",
"$",
"client",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"this",
"->",
"successCallback",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'\"'",
".",
"get_class",
"(",
"$",
"this",
")",
... | This method is invoked in case of successful authentication via auth client.
@param ClientInterface $client auth client instance.
@throws InvalidConfigException on invalid success callback.
@return Response response instance. | [
"This",
"method",
"is",
"invoked",
"in",
"case",
"of",
"successful",
"authentication",
"via",
"auth",
"client",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L242-L254 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.authCancel | protected function authCancel($client)
{
if ($this->cancelCallback !== null) {
$response = call_user_func($this->cancelCallback, $client);
if ($response instanceof Response) {
return $response;
}
}
return $this->redirectCancel();
} | php | protected function authCancel($client)
{
if ($this->cancelCallback !== null) {
$response = call_user_func($this->cancelCallback, $client);
if ($response instanceof Response) {
return $response;
}
}
return $this->redirectCancel();
} | [
"protected",
"function",
"authCancel",
"(",
"$",
"client",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cancelCallback",
"!==",
"null",
")",
"{",
"$",
"response",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"cancelCallback",
",",
"$",
"client",
")",
";",
... | This method is invoked in case of authentication cancelation.
@param ClientInterface $client auth client instance.
@return Response response instance.
@since 2.1.5 | [
"This",
"method",
"is",
"invoked",
"in",
"case",
"of",
"authentication",
"cancelation",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L262-L272 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.redirect | public function redirect($url, $enforceRedirect = true)
{
$viewFile = $this->redirectView;
if ($viewFile === null) {
$viewFile = __DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'redirect.php';
} else {
$viewFile = Yii::getAlias($viewFile);
}
... | php | public function redirect($url, $enforceRedirect = true)
{
$viewFile = $this->redirectView;
if ($viewFile === null) {
$viewFile = __DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'redirect.php';
} else {
$viewFile = Yii::getAlias($viewFile);
}
... | [
"public",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"enforceRedirect",
"=",
"true",
")",
"{",
"$",
"viewFile",
"=",
"$",
"this",
"->",
"redirectView",
";",
"if",
"(",
"$",
"viewFile",
"===",
"null",
")",
"{",
"$",
"viewFile",
"=",
"__DIR__",
... | Redirect to the given URL or simply close the popup window.
@param mixed $url URL to redirect, could be a string or array config to generate a valid URL.
@param bool $enforceRedirect indicates if redirect should be performed even in case of popup window.
@return \yii\web\Response response instance. | [
"Redirect",
"to",
"the",
"given",
"URL",
"or",
"simply",
"close",
"the",
"popup",
"window",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L280-L298 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.redirectSuccess | public function redirectSuccess($url = null)
{
if ($url === null) {
$url = $this->getSuccessUrl();
}
return $this->redirect($url);
} | php | public function redirectSuccess($url = null)
{
if ($url === null) {
$url = $this->getSuccessUrl();
}
return $this->redirect($url);
} | [
"public",
"function",
"redirectSuccess",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"url",
"===",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getSuccessUrl",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"redirect",
"(",
... | Redirect to the URL. If URL is null, [[successUrl]] will be used.
@param string $url URL to redirect.
@return \yii\web\Response response instance. | [
"Redirect",
"to",
"the",
"URL",
".",
"If",
"URL",
"is",
"null",
"[[",
"successUrl",
"]]",
"will",
"be",
"used",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L305-L311 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.redirectCancel | public function redirectCancel($url = null)
{
if ($url === null) {
$url = $this->getCancelUrl();
}
return $this->redirect($url, false);
} | php | public function redirectCancel($url = null)
{
if ($url === null) {
$url = $this->getCancelUrl();
}
return $this->redirect($url, false);
} | [
"public",
"function",
"redirectCancel",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"url",
"===",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getCancelUrl",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"redirect",
"(",
... | Redirect to the [[cancelUrl]] or simply close the popup window.
@param string $url URL to redirect.
@return \yii\web\Response response instance. | [
"Redirect",
"to",
"the",
"[[",
"cancelUrl",
"]]",
"or",
"simply",
"close",
"the",
"popup",
"window",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L318-L324 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.authOpenId | protected function authOpenId($client)
{
$request = Yii::$app->getRequest();
$mode = $request->get('openid_mode', $request->post('openid_mode'));
if (empty($mode)) {
$url = $client->buildAuthUrl();
return Yii::$app->getResponse()->redirect($url);
}
s... | php | protected function authOpenId($client)
{
$request = Yii::$app->getRequest();
$mode = $request->get('openid_mode', $request->post('openid_mode'));
if (empty($mode)) {
$url = $client->buildAuthUrl();
return Yii::$app->getResponse()->redirect($url);
}
s... | [
"protected",
"function",
"authOpenId",
"(",
"$",
"client",
")",
"{",
"$",
"request",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
";",
"$",
"mode",
"=",
"$",
"request",
"->",
"get",
"(",
"'openid_mode'",
",",
"$",
"request",
"->",
"pos... | Performs OpenID auth flow.
@param OpenId $client auth client instance.
@return Response action response.
@throws Exception on failure.
@throws HttpException on failure. | [
"Performs",
"OpenID",
"auth",
"flow",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L333-L354 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.authOAuth1 | protected function authOAuth1($client, $authUrlParams = [])
{
$request = Yii::$app->getRequest();
// user denied error
if ($request->get('denied') !== null) {
return $this->authCancel($client);
}
if (($oauthToken = $request->get('oauth_token', $request->post('oa... | php | protected function authOAuth1($client, $authUrlParams = [])
{
$request = Yii::$app->getRequest();
// user denied error
if ($request->get('denied') !== null) {
return $this->authCancel($client);
}
if (($oauthToken = $request->get('oauth_token', $request->post('oa... | [
"protected",
"function",
"authOAuth1",
"(",
"$",
"client",
",",
"$",
"authUrlParams",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
";",
"// user denied error",
"if",
"(",
"$",
"request",
"->",
"ge... | Performs OAuth1 auth flow.
@param OAuth1 $client auth client instance.
@param array $authUrlParams additional auth GET params.
@return Response action response. | [
"Performs",
"OAuth1",
"auth",
"flow",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L362-L383 |
yiisoft/yii2-authclient | src/AuthAction.php | AuthAction.authOAuth2 | protected function authOAuth2($client, $authUrlParams = [])
{
$request = Yii::$app->getRequest();
if (($error = $request->get('error')) !== null) {
if (
$error === 'access_denied' ||
$error === 'user_cancelled_login' ||
$error === 'user_ca... | php | protected function authOAuth2($client, $authUrlParams = [])
{
$request = Yii::$app->getRequest();
if (($error = $request->get('error')) !== null) {
if (
$error === 'access_denied' ||
$error === 'user_cancelled_login' ||
$error === 'user_ca... | [
"protected",
"function",
"authOAuth2",
"(",
"$",
"client",
",",
"$",
"authUrlParams",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"(",
"$",
"error",
"=",
"$",
"request",
"->",... | Performs OAuth2 auth flow.
@param OAuth2 $client auth client instance.
@param array $authUrlParams additional auth GET params.
@return Response action response.
@throws \yii\base\Exception on failure. | [
"Performs",
"OAuth2",
"auth",
"flow",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/AuthAction.php#L392-L424 |
yiisoft/yii2-authclient | src/Collection.php | Collection.createClient | protected function createClient($id, $config)
{
$config['id'] = $id;
if (!isset($config['httpClient']) && $this->httpClient !== null) {
$config['httpClient'] = $this->httpClient;
}
return Yii::createObject($config);
} | php | protected function createClient($id, $config)
{
$config['id'] = $id;
if (!isset($config['httpClient']) && $this->httpClient !== null) {
$config['httpClient'] = $this->httpClient;
}
return Yii::createObject($config);
} | [
"protected",
"function",
"createClient",
"(",
"$",
"id",
",",
"$",
"config",
")",
"{",
"$",
"config",
"[",
"'id'",
"]",
"=",
"$",
"id",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'httpClient'",
"]",
")",
"&&",
"$",
"this",
"->",
"htt... | Creates auth client instance from its array configuration.
@param string $id auth client id.
@param array $config auth client instance configuration.
@return ClientInterface auth client instance. | [
"Creates",
"auth",
"client",
"instance",
"from",
"its",
"array",
"configuration",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/Collection.php#L114-L123 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.init | public function init()
{
if ($this->data === null) {
$request = Yii::$app->getRequest();
$this->data = array_merge($request->get(), $request->post()); // OPs may send data as POST or GET.
}
} | php | public function init()
{
if ($this->data === null) {
$request = Yii::$app->getRequest();
$this->data = array_merge($request->get(), $request->post()); // OPs may send data as POST or GET.
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"===",
"null",
")",
"{",
"$",
"request",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
";",
"$",
"this",
"->",
"data",
"=",
"array_merge",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L123-L129 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.defaultReturnUrl | protected function defaultReturnUrl()
{
$params = Yii::$app->getRequest()->get();
foreach ($params as $name => $value) {
if (strncmp('openid', $name, 6) === 0) {
unset($params[$name]);
}
}
$params[0] = Yii::$app->requestedRoute;
$url = ... | php | protected function defaultReturnUrl()
{
$params = Yii::$app->getRequest()->get();
foreach ($params as $name => $value) {
if (strncmp('openid', $name, 6) === 0) {
unset($params[$name]);
}
}
$params[0] = Yii::$app->requestedRoute;
$url = ... | [
"protected",
"function",
"defaultReturnUrl",
"(",
")",
"{",
"$",
"params",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"get",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",... | Generates default [[returnUrl]] value.
@return string default authentication return URL. | [
"Generates",
"default",
"[[",
"returnUrl",
"]]",
"value",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L199-L211 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.hostExists | public function hostExists($url)
{
if (strpos($url, '/') === false) {
$server = $url;
} else {
$server = @parse_url($url, PHP_URL_HOST);
}
if (!$server) {
return false;
}
$ips = gethostbynamel($server);
return !empty($ips);... | php | public function hostExists($url)
{
if (strpos($url, '/') === false) {
$server = $url;
} else {
$server = @parse_url($url, PHP_URL_HOST);
}
if (!$server) {
return false;
}
$ips = gethostbynamel($server);
return !empty($ips);... | [
"public",
"function",
"hostExists",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'/'",
")",
"===",
"false",
")",
"{",
"$",
"server",
"=",
"$",
"url",
";",
"}",
"else",
"{",
"$",
"server",
"=",
"@",
"parse_url",
"(",
"$... | Checks if the server specified in the url exists.
@param string $url URL to check
@return bool true, if the server exists; false otherwise | [
"Checks",
"if",
"the",
"server",
"specified",
"in",
"the",
"url",
"exists",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L218-L231 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.sendRequest | protected function sendRequest($url, $method = 'GET', $params = [])
{
$request = $this->createRequest()
->setMethod($method)
->setUrl($url)
->setData($params);
if ($this->verifyPeer !== null) {
$options = [
'sslVerifyPeer' => $this->ve... | php | protected function sendRequest($url, $method = 'GET', $params = [])
{
$request = $this->createRequest()
->setMethod($method)
->setUrl($url)
->setData($params);
if ($this->verifyPeer !== null) {
$options = [
'sslVerifyPeer' => $this->ve... | [
"protected",
"function",
"sendRequest",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"'GET'",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequest",
"(",
")",
"->",
"setMethod",
"(",
"$",
"method",
")",
"... | Sends request to the server
@param string $url request URL.
@param string $method request method.
@param array $params request parameters.
@return array|string response.
@throws \yii\base\Exception on failure. | [
"Sends",
"request",
"to",
"the",
"server"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L241-L272 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildUrl | protected function buildUrl($baseUrl, $additionalUrl)
{
$baseUrl = parse_url($baseUrl);
if (!is_array($additionalUrl)) {
$additionalUrl = parse_url($additionalUrl);
}
if (isset($baseUrl['query'], $additionalUrl['query'])) {
$additionalUrl['query'] = $baseUrl[... | php | protected function buildUrl($baseUrl, $additionalUrl)
{
$baseUrl = parse_url($baseUrl);
if (!is_array($additionalUrl)) {
$additionalUrl = parse_url($additionalUrl);
}
if (isset($baseUrl['query'], $additionalUrl['query'])) {
$additionalUrl['query'] = $baseUrl[... | [
"protected",
"function",
"buildUrl",
"(",
"$",
"baseUrl",
",",
"$",
"additionalUrl",
")",
"{",
"$",
"baseUrl",
"=",
"parse_url",
"(",
"$",
"baseUrl",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"additionalUrl",
")",
")",
"{",
"$",
"additionalUrl",
... | Combines given URLs into single one.
@param string $baseUrl base URL.
@param string|array $additionalUrl additional URL string or information array.
@return string composed URL. | [
"Combines",
"given",
"URLs",
"into",
"single",
"one",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L293-L316 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.extractHtmlTagValue | protected function extractHtmlTagValue($content, $tag, $matchAttributeName, $matchAttributeValue, $valueAttributeName)
{
preg_match_all("#<{$tag}[^>]*$matchAttributeName=['\"].*?$matchAttributeValue.*?['\"][^>]*$valueAttributeName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
preg_match_all("#<{... | php | protected function extractHtmlTagValue($content, $tag, $matchAttributeName, $matchAttributeValue, $valueAttributeName)
{
preg_match_all("#<{$tag}[^>]*$matchAttributeName=['\"].*?$matchAttributeValue.*?['\"][^>]*$valueAttributeName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
preg_match_all("#<{... | [
"protected",
"function",
"extractHtmlTagValue",
"(",
"$",
"content",
",",
"$",
"tag",
",",
"$",
"matchAttributeName",
",",
"$",
"matchAttributeValue",
",",
"$",
"valueAttributeName",
")",
"{",
"preg_match_all",
"(",
"\"#<{$tag}[^>]*$matchAttributeName=['\\\"].*?$matchAttr... | Scans content for <meta>/<link> tags and extract information from them.
@param string $content HTML content to be be parsed.
@param string $tag name of the source tag.
@param string $matchAttributeName name of the source tag attribute, which should contain $matchAttributeValue
@param string $matchAttributeValue require... | [
"Scans",
"content",
"for",
"<meta",
">",
"/",
"<link",
">",
"tags",
"and",
"extract",
"information",
"from",
"them",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L327-L334 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.discover | public function discover($url)
{
if (empty($url)) {
throw new Exception('No identity supplied.');
}
$result = [
'url' => null,
'version' => null,
'identity' => $url,
'identifier_select' => false,
'ax' => false,
... | php | public function discover($url)
{
if (empty($url)) {
throw new Exception('No identity supplied.');
}
$result = [
'url' => null,
'version' => null,
'identity' => $url,
'identifier_select' => false,
'ax' => false,
... | [
"public",
"function",
"discover",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No identity supplied.'",
")",
";",
"}",
"$",
"result",
"=",
"[",
"'url'",
"=>",
"null",
",",
"'versio... | Performs Yadis and HTML discovery.
@param string $url Identity URL.
@return array OpenID provider info, following keys will be available:
- url: string, OP Endpoint (i.e. OpenID provider address).
- version: int, OpenID protocol version used by provider.
- identity: string, identity value.
- identifier_select: bool, w... | [
"Performs",
"Yadis",
"and",
"HTML",
"discovery",
".",
"@param",
"string",
"$url",
"Identity",
"URL",
".",
"@return",
"array",
"OpenID",
"provider",
"info",
"following",
"keys",
"will",
"be",
"available",
":"
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L350-L502 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildSregParams | protected function buildSregParams()
{
$params = [];
/* We always use SREG 1.1, even if the server is advertising only support for 1.0.
That's because it's fully backwards compatible with 1.0, and some providers
advertise 1.0 even if they accept only 1.1. One such provider is myopeni... | php | protected function buildSregParams()
{
$params = [];
/* We always use SREG 1.1, even if the server is advertising only support for 1.0.
That's because it's fully backwards compatible with 1.0, and some providers
advertise 1.0 even if they accept only 1.1. One such provider is myopeni... | [
"protected",
"function",
"buildSregParams",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"/* We always use SREG 1.1, even if the server is advertising only support for 1.0.\n That's because it's fully backwards compatible with 1.0, and some providers\n advertise 1.0 even i... | Composes SREG request parameters.
@return array SREG parameters. | [
"Composes",
"SREG",
"request",
"parameters",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L508-L538 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildAxParams | protected function buildAxParams()
{
$params = [];
if (!empty($this->requiredAttributes) || !empty($this->optionalAttributes)) {
$params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
$params['openid.ax.mode'] = 'fetch_request';
$aliases = [];
$coun... | php | protected function buildAxParams()
{
$params = [];
if (!empty($this->requiredAttributes) || !empty($this->optionalAttributes)) {
$params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
$params['openid.ax.mode'] = 'fetch_request';
$aliases = [];
$coun... | [
"protected",
"function",
"buildAxParams",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"requiredAttributes",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"optionalAttributes",
")",
")",
"{",
"... | Composes AX request parameters.
@return array AX parameters. | [
"Composes",
"AX",
"request",
"parameters",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L544-L588 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildAuthUrlV1 | protected function buildAuthUrlV1($serverInfo)
{
$returnUrl = $this->getReturnUrl();
/* If we have an openid.delegate that is different from our claimed id,
we need to somehow preserve the claimed id between requests.
The simplest way is to just send it along with the return_to url.*... | php | protected function buildAuthUrlV1($serverInfo)
{
$returnUrl = $this->getReturnUrl();
/* If we have an openid.delegate that is different from our claimed id,
we need to somehow preserve the claimed id between requests.
The simplest way is to just send it along with the return_to url.*... | [
"protected",
"function",
"buildAuthUrlV1",
"(",
"$",
"serverInfo",
")",
"{",
"$",
"returnUrl",
"=",
"$",
"this",
"->",
"getReturnUrl",
"(",
")",
";",
"/* If we have an openid.delegate that is different from our claimed id,\n we need to somehow preserve the claimed id betwe... | Builds authentication URL for the protocol version 1.
@param array $serverInfo OpenID server info.
@return string authentication URL. | [
"Builds",
"authentication",
"URL",
"for",
"the",
"protocol",
"version",
"1",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L595-L616 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildAuthUrlV2 | protected function buildAuthUrlV2($serverInfo)
{
$params = [
'openid.ns' => 'http://specs.openid.net/auth/2.0',
'openid.mode' => 'checkid_setup',
'openid.return_to' => $this->getReturnUrl(),
'openid.realm' => $this->getTrustRoot(),
];
if ($serv... | php | protected function buildAuthUrlV2($serverInfo)
{
$params = [
'openid.ns' => 'http://specs.openid.net/auth/2.0',
'openid.mode' => 'checkid_setup',
'openid.return_to' => $this->getReturnUrl(),
'openid.realm' => $this->getTrustRoot(),
];
if ($serv... | [
"protected",
"function",
"buildAuthUrlV2",
"(",
"$",
"serverInfo",
")",
"{",
"$",
"params",
"=",
"[",
"'openid.ns'",
"=>",
"'http://specs.openid.net/auth/2.0'",
",",
"'openid.mode'",
"=>",
"'checkid_setup'",
",",
"'openid.return_to'",
"=>",
"$",
"this",
"->",
"getRe... | Builds authentication URL for the protocol version 2.
@param array $serverInfo OpenID server info.
@return string authentication URL. | [
"Builds",
"authentication",
"URL",
"for",
"the",
"protocol",
"version",
"2",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L623-L652 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.buildAuthUrl | public function buildAuthUrl($identifierSelect = null)
{
$authUrl = $this->authUrl;
$claimedId = $this->getClaimedId();
if (empty($claimedId)) {
$this->setClaimedId($authUrl);
}
$serverInfo = $this->discover($authUrl);
if ($serverInfo['version'] == 2) {
... | php | public function buildAuthUrl($identifierSelect = null)
{
$authUrl = $this->authUrl;
$claimedId = $this->getClaimedId();
if (empty($claimedId)) {
$this->setClaimedId($authUrl);
}
$serverInfo = $this->discover($authUrl);
if ($serverInfo['version'] == 2) {
... | [
"public",
"function",
"buildAuthUrl",
"(",
"$",
"identifierSelect",
"=",
"null",
")",
"{",
"$",
"authUrl",
"=",
"$",
"this",
"->",
"authUrl",
";",
"$",
"claimedId",
"=",
"$",
"this",
"->",
"getClaimedId",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
... | Returns authentication URL. Usually, you want to redirect your user to it.
@param bool $identifierSelect whether to request OP to select identity for an user in OpenID 2, does not affect OpenID 1.
@return string the authentication URL.
@throws Exception on failure. | [
"Returns",
"authentication",
"URL",
".",
"Usually",
"you",
"want",
"to",
"redirect",
"your",
"user",
"to",
"it",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L660-L677 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.validate | public function validate($validateRequiredAttributes = true)
{
$claimedId = $this->getClaimedId();
if (empty($claimedId)) {
return false;
}
$params = [
'openid.assoc_handle' => $this->data['openid_assoc_handle'],
'openid.signed' => $this->data['ope... | php | public function validate($validateRequiredAttributes = true)
{
$claimedId = $this->getClaimedId();
if (empty($claimedId)) {
return false;
}
$params = [
'openid.assoc_handle' => $this->data['openid_assoc_handle'],
'openid.signed' => $this->data['ope... | [
"public",
"function",
"validate",
"(",
"$",
"validateRequiredAttributes",
"=",
"true",
")",
"{",
"$",
"claimedId",
"=",
"$",
"this",
"->",
"getClaimedId",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"claimedId",
")",
")",
"{",
"return",
"false",
";",
... | Performs OpenID verification with the OP.
@param bool $validateRequiredAttributes whether to validate required attributes.
@return bool whether the verification was successful. | [
"Performs",
"OpenID",
"verification",
"with",
"the",
"OP",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L684-L732 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.validateRequiredAttributes | protected function validateRequiredAttributes()
{
if (!empty($this->requiredAttributes)) {
$attributes = $this->fetchAttributes();
foreach ($this->requiredAttributes as $openIdAttributeName) {
if (!isset($attributes[$openIdAttributeName])) {
return... | php | protected function validateRequiredAttributes()
{
if (!empty($this->requiredAttributes)) {
$attributes = $this->fetchAttributes();
foreach ($this->requiredAttributes as $openIdAttributeName) {
if (!isset($attributes[$openIdAttributeName])) {
return... | [
"protected",
"function",
"validateRequiredAttributes",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"requiredAttributes",
")",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"fetchAttributes",
"(",
")",
";",
"foreach",
"(",
"$",
... | Checks if all required attributes are present in the server response.
@return bool whether all required attributes are present. | [
"Checks",
"if",
"all",
"required",
"attributes",
"are",
"present",
"in",
"the",
"server",
"response",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L738-L750 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.fetchAxAttributes | protected function fetchAxAttributes()
{
$alias = null;
if (isset($this->data['openid_ns_ax']) && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0') {
// It's the most likely case, so we'll check it before
$alias = 'ax';
} else {
// 'ax' prefix... | php | protected function fetchAxAttributes()
{
$alias = null;
if (isset($this->data['openid_ns_ax']) && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0') {
// It's the most likely case, so we'll check it before
$alias = 'ax';
} else {
// 'ax' prefix... | [
"protected",
"function",
"fetchAxAttributes",
"(",
")",
"{",
"$",
"alias",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'openid_ns_ax'",
"]",
")",
"&&",
"$",
"this",
"->",
"data",
"[",
"'openid_ns_ax'",
"]",
"!=",
"'http:... | Gets AX attributes provided by OP.
@return array array of attributes. | [
"Gets",
"AX",
"attributes",
"provided",
"by",
"OP",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L756-L794 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.fetchSregAttributes | protected function fetchSregAttributes()
{
$attributes = [];
$sregToAx = array_flip($this->axToSregMap);
foreach ($this->data as $key => $value) {
$keyMatch = 'openid_sreg_';
if (strncmp($key, $keyMatch, strlen($keyMatch))) {
continue;
}
... | php | protected function fetchSregAttributes()
{
$attributes = [];
$sregToAx = array_flip($this->axToSregMap);
foreach ($this->data as $key => $value) {
$keyMatch = 'openid_sreg_';
if (strncmp($key, $keyMatch, strlen($keyMatch))) {
continue;
}
... | [
"protected",
"function",
"fetchSregAttributes",
"(",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"$",
"sregToAx",
"=",
"array_flip",
"(",
"$",
"this",
"->",
"axToSregMap",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>"... | Gets SREG attributes provided by OP. SREG names will be mapped to AX names.
@return array array of attributes with keys being the AX schema names, e.g. 'contact/email' | [
"Gets",
"SREG",
"attributes",
"provided",
"by",
"OP",
".",
"SREG",
"names",
"will",
"be",
"mapped",
"to",
"AX",
"names",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L800-L818 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.fetchAttributes | public function fetchAttributes()
{
if (isset($this->data['openid_ns']) && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0') {
// OpenID 2.0
// We search for both AX and SREG attributes, with AX taking precedence.
return array_merge($this->fetchSregAttribute... | php | public function fetchAttributes()
{
if (isset($this->data['openid_ns']) && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0') {
// OpenID 2.0
// We search for both AX and SREG attributes, with AX taking precedence.
return array_merge($this->fetchSregAttribute... | [
"public",
"function",
"fetchAttributes",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'openid_ns'",
"]",
")",
"&&",
"$",
"this",
"->",
"data",
"[",
"'openid_ns'",
"]",
"==",
"'http://specs.openid.net/auth/2.0'",
")",
"{",
"// Op... | Gets AX/SREG attributes provided by OP. Should be used only after successful validation.
Note that it does not guarantee that any of the required/optional parameters will be present,
or that there will be no other attributes besides those specified.
In other words. OP may provide whatever information it wants to.
SREG ... | [
"Gets",
"AX",
"/",
"SREG",
"attributes",
"provided",
"by",
"OP",
".",
"Should",
"be",
"used",
"only",
"after",
"successful",
"validation",
".",
"Note",
"that",
"it",
"does",
"not",
"guarantee",
"that",
"any",
"of",
"the",
"required",
"/",
"optional",
"para... | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L829-L838 |
yiisoft/yii2-authclient | src/OpenId.php | OpenId.compareUrl | protected function compareUrl($expectedUrl, $actualUrl)
{
$expectedUrlInfo = parse_url($expectedUrl);
$actualUrlInfo = parse_url($actualUrl);
foreach ($expectedUrlInfo as $name => $expectedValue) {
if ($name == 'query') {
parse_str($expectedValue, $expectedUrlPara... | php | protected function compareUrl($expectedUrl, $actualUrl)
{
$expectedUrlInfo = parse_url($expectedUrl);
$actualUrlInfo = parse_url($actualUrl);
foreach ($expectedUrlInfo as $name => $expectedValue) {
if ($name == 'query') {
parse_str($expectedValue, $expectedUrlPara... | [
"protected",
"function",
"compareUrl",
"(",
"$",
"expectedUrl",
",",
"$",
"actualUrl",
")",
"{",
"$",
"expectedUrlInfo",
"=",
"parse_url",
"(",
"$",
"expectedUrl",
")",
";",
"$",
"actualUrlInfo",
"=",
"parse_url",
"(",
"$",
"actualUrl",
")",
";",
"foreach",
... | Compares 2 URLs taking in account possible GET parameters order miss match and URL encoding inconsistencies.
@param string $expectedUrl expected URL.
@param string $actualUrl actual URL.
@return bool whether URLs are equal. | [
"Compares",
"2",
"URLs",
"taking",
"in",
"account",
"possible",
"GET",
"parameters",
"order",
"miss",
"match",
"and",
"URL",
"encoding",
"inconsistencies",
"."
] | train | https://github.com/yiisoft/yii2-authclient/blob/07c087755ea02a19037f00a6eb9faaa012ab6f8e/src/OpenId.php#L854-L871 |
neos/neos-ui | Classes/Fusion/RenderConfigurationImplementation.php | RenderConfigurationImplementation.evaluate | public function evaluate()
{
$context = $this->getContext();
$pathToRender = $this->getPath();
$context['controllerContext'] = $this->getruntime()->getControllerContext();
if (!isset($this->settings[$pathToRender])) {
throw new Exception('The path "Neos.Neos.Ui.' . $path... | php | public function evaluate()
{
$context = $this->getContext();
$pathToRender = $this->getPath();
$context['controllerContext'] = $this->getruntime()->getControllerContext();
if (!isset($this->settings[$pathToRender])) {
throw new Exception('The path "Neos.Neos.Ui.' . $path... | [
"public",
"function",
"evaluate",
"(",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"pathToRender",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
";",
"$",
"context",
"[",
"'controllerContext'",
"]",
"=",
"$",
"t... | Appends an item to the given collection
@return array
@throws Exception | [
"Appends",
"an",
"item",
"to",
"the",
"given",
"collection"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Fusion/RenderConfigurationImplementation.php#L56-L67 |
neos/neos-ui | Classes/Domain/Model/Feedback/Operations/NodeCreated.php | NodeCreated.isSimilarTo | public function isSimilarTo(FeedbackInterface $feedback)
{
if (!$feedback instanceof NodeCreated) {
return false;
}
return $this->getNode()->getContextPath() === $feedback->getNode()->getContextPath();
} | php | public function isSimilarTo(FeedbackInterface $feedback)
{
if (!$feedback instanceof NodeCreated) {
return false;
}
return $this->getNode()->getContextPath() === $feedback->getNode()->getContextPath();
} | [
"public",
"function",
"isSimilarTo",
"(",
"FeedbackInterface",
"$",
"feedback",
")",
"{",
"if",
"(",
"!",
"$",
"feedback",
"instanceof",
"NodeCreated",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"getNode",
"(",
")",
"->",
"getConte... | Checks whether this feedback is similar to another
@param FeedbackInterface $feedback
@return boolean | [
"Checks",
"whether",
"this",
"feedback",
"is",
"similar",
"to",
"another"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Model/Feedback/Operations/NodeCreated.php#L74-L81 |
neos/neos-ui | Classes/Domain/Model/Feedback/Operations/NodeCreated.php | NodeCreated.serializePayload | public function serializePayload(ControllerContext $controllerContext)
{
$nodeService = new NodeService();
$node = $this->getNode();
return [
'contextPath' => $node->getContextPath(),
'identifier' => $node->getIdentifier(),
'isDocument' => $nodeService->i... | php | public function serializePayload(ControllerContext $controllerContext)
{
$nodeService = new NodeService();
$node = $this->getNode();
return [
'contextPath' => $node->getContextPath(),
'identifier' => $node->getIdentifier(),
'isDocument' => $nodeService->i... | [
"public",
"function",
"serializePayload",
"(",
"ControllerContext",
"$",
"controllerContext",
")",
"{",
"$",
"nodeService",
"=",
"new",
"NodeService",
"(",
")",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"getNode",
"(",
")",
";",
"return",
"[",
"'contextPath'... | Serialize the payload for this feedback
@param ControllerContext $controllerContext
@return mixed | [
"Serialize",
"the",
"payload",
"for",
"this",
"feedback"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Model/Feedback/Operations/NodeCreated.php#L89-L99 |
neos/neos-ui | Classes/Domain/Service/NodeTreeBuilder.php | NodeTreeBuilder.getRoot | public function getRoot()
{
if (!$this->root) {
$this->root = $this->active->getContext()->getCurrentSiteNode();
}
return $this->root;
} | php | public function getRoot()
{
if (!$this->root) {
$this->root = $this->active->getContext()->getCurrentSiteNode();
}
return $this->root;
} | [
"public",
"function",
"getRoot",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"root",
")",
"{",
"$",
"this",
"->",
"root",
"=",
"$",
"this",
"->",
"active",
"->",
"getContext",
"(",
")",
"->",
"getCurrentSiteNode",
"(",
")",
";",
"}",
"return"... | Get the root node
@return NodeInterface | [
"Get",
"the",
"root",
"node"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Service/NodeTreeBuilder.php#L90-L97 |
neos/neos-ui | Classes/Domain/Service/NodeTreeBuilder.php | NodeTreeBuilder.build | public function build($includeRoot = false, $root = null, $depth = null)
{
$root = $root === null ? $this->getRoot() : $root;
$depth = $depth === null ? $this->depth : $depth;
$result = [];
/** @var NodeInterface $childNode */
foreach ($root->getChildNodes($this->nodeTypeFi... | php | public function build($includeRoot = false, $root = null, $depth = null)
{
$root = $root === null ? $this->getRoot() : $root;
$depth = $depth === null ? $this->depth : $depth;
$result = [];
/** @var NodeInterface $childNode */
foreach ($root->getChildNodes($this->nodeTypeFi... | [
"public",
"function",
"build",
"(",
"$",
"includeRoot",
"=",
"false",
",",
"$",
"root",
"=",
"null",
",",
"$",
"depth",
"=",
"null",
")",
"{",
"$",
"root",
"=",
"$",
"root",
"===",
"null",
"?",
"$",
"this",
"->",
"getRoot",
"(",
")",
":",
"$",
... | Build a json serializable tree structure containing node information
@param bool $includeRoot
@param null $root
@param null $depth
@return array | [
"Build",
"a",
"json",
"serializable",
"tree",
"structure",
"containing",
"node",
"information"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Service/NodeTreeBuilder.php#L161-L224 |
neos/neos-ui | Classes/Fusion/ExceptionHandler/PageExceptionHandler.php | PageExceptionHandler.handle | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
if ($this->activationHelper->isLegacyBackendEnabled()) {
$handler = new PageHandler();
return $handler->handleRenderingException($fusionPath, $exception);
}
$handler = new HtmlMessageHand... | php | protected function handle($fusionPath, \Exception $exception, $referenceCode)
{
if ($this->activationHelper->isLegacyBackendEnabled()) {
$handler = new PageHandler();
return $handler->handleRenderingException($fusionPath, $exception);
}
$handler = new HtmlMessageHand... | [
"protected",
"function",
"handle",
"(",
"$",
"fusionPath",
",",
"\\",
"Exception",
"$",
"exception",
",",
"$",
"referenceCode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"activationHelper",
"->",
"isLegacyBackendEnabled",
"(",
")",
")",
"{",
"$",
"handler",
... | Handle an exception by displaying an error message inside the Neos backend, if logged in and not displaying the live workspace.
@param string $fusionPath path causing the exception
@param \Exception $exception exception to handle
@param integer $referenceCode
@return string
@throws \Neos\Flow\Mvc\Exception\StopActionE... | [
"Handle",
"an",
"exception",
"by",
"displaying",
"an",
"error",
"message",
"inside",
"the",
"Neos",
"backend",
"if",
"logged",
"in",
"and",
"not",
"displaying",
"the",
"live",
"workspace",
"."
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Fusion/ExceptionHandler/PageExceptionHandler.php#L46-L62 |
neos/neos-ui | Classes/Fusion/ExceptionHandler/PageExceptionHandler.php | PageExceptionHandler.wrapHttpResponse | protected function wrapHttpResponse(\Exception $exception, string $bodyContent): string
{
$body = fopen('php://temp', 'rw');
fputs($body, $bodyContent);
rewind($body);
/** @var Response $response */
$response = (new Response())
->withStatus($exception instanceof ... | php | protected function wrapHttpResponse(\Exception $exception, string $bodyContent): string
{
$body = fopen('php://temp', 'rw');
fputs($body, $bodyContent);
rewind($body);
/** @var Response $response */
$response = (new Response())
->withStatus($exception instanceof ... | [
"protected",
"function",
"wrapHttpResponse",
"(",
"\\",
"Exception",
"$",
"exception",
",",
"string",
"$",
"bodyContent",
")",
":",
"string",
"{",
"$",
"body",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'rw'",
")",
";",
"fputs",
"(",
"$",
"body",
",",
"$",... | Renders an actual HTTP response including the correct status and cache control header.
@param \Exception the exception
@param string $bodyContent
@return string | [
"Renders",
"an",
"actual",
"HTTP",
"response",
"including",
"the",
"correct",
"status",
"and",
"cache",
"control",
"header",
"."
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Fusion/ExceptionHandler/PageExceptionHandler.php#L71-L84 |
neos/neos-ui | Classes/Fusion/ExceptionHandler/PageExceptionHandler.php | PageExceptionHandler.prepareFluidView | protected function prepareFluidView(): ViewInterface
{
$fluidView = new StandaloneView();
$fluidView->setControllerContext($this->runtime->getControllerContext());
$fluidView->setFormat('html');
$fluidView->setTemplatePathAndFilename('resource://Neos.Neos.Ui/Private/Templates/Error/E... | php | protected function prepareFluidView(): ViewInterface
{
$fluidView = new StandaloneView();
$fluidView->setControllerContext($this->runtime->getControllerContext());
$fluidView->setFormat('html');
$fluidView->setTemplatePathAndFilename('resource://Neos.Neos.Ui/Private/Templates/Error/E... | [
"protected",
"function",
"prepareFluidView",
"(",
")",
":",
"ViewInterface",
"{",
"$",
"fluidView",
"=",
"new",
"StandaloneView",
"(",
")",
";",
"$",
"fluidView",
"->",
"setControllerContext",
"(",
"$",
"this",
"->",
"runtime",
"->",
"getControllerContext",
"(",... | Prepare a Fluid view for rendering an error page with the Neos backend
@return ViewInterface
@throws \Neos\FluidAdaptor\Exception | [
"Prepare",
"a",
"Fluid",
"view",
"for",
"rendering",
"an",
"error",
"page",
"with",
"the",
"Neos",
"backend"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Fusion/ExceptionHandler/PageExceptionHandler.php#L92-L100 |
neos/neos-ui | Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php | RenderContentOutOfBand.isSimilarTo | public function isSimilarTo(FeedbackInterface $feedback)
{
if (!$feedback instanceof RenderContentOutOfBand) {
return false;
}
return (
$this->getNode()->getContextPath() === $feedback->getNode()->getContextPath() &&
$this->getReferenceData() == $feedback... | php | public function isSimilarTo(FeedbackInterface $feedback)
{
if (!$feedback instanceof RenderContentOutOfBand) {
return false;
}
return (
$this->getNode()->getContextPath() === $feedback->getNode()->getContextPath() &&
$this->getReferenceData() == $feedback... | [
"public",
"function",
"isSimilarTo",
"(",
"FeedbackInterface",
"$",
"feedback",
")",
"{",
"if",
"(",
"!",
"$",
"feedback",
"instanceof",
"RenderContentOutOfBand",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"$",
"this",
"->",
"getNode",
"(",
")",
... | Checks whether this feedback is similar to another
@param FeedbackInterface $feedback
@return boolean | [
"Checks",
"whether",
"this",
"feedback",
"is",
"similar",
"to",
"another"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php#L175-L185 |
neos/neos-ui | Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php | RenderContentOutOfBand.serializePayload | public function serializePayload(ControllerContext $controllerContext)
{
return [
'contextPath' => $this->getNode()->getContextPath(),
'parentDomAddress' => $this->getParentDomAddress(),
'siblingDomAddress' => $this->getSiblingDomAddress(),
'mode' => $this->ge... | php | public function serializePayload(ControllerContext $controllerContext)
{
return [
'contextPath' => $this->getNode()->getContextPath(),
'parentDomAddress' => $this->getParentDomAddress(),
'siblingDomAddress' => $this->getSiblingDomAddress(),
'mode' => $this->ge... | [
"public",
"function",
"serializePayload",
"(",
"ControllerContext",
"$",
"controllerContext",
")",
"{",
"return",
"[",
"'contextPath'",
"=>",
"$",
"this",
"->",
"getNode",
"(",
")",
"->",
"getContextPath",
"(",
")",
",",
"'parentDomAddress'",
"=>",
"$",
"this",
... | Serialize the payload for this feedback
@return mixed | [
"Serialize",
"the",
"payload",
"for",
"this",
"feedback"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php#L192-L201 |
neos/neos-ui | Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php | RenderContentOutOfBand.renderContent | protected function renderContent(ControllerContext $controllerContext)
{
$cacheTags = $this->cachingHelper->nodeTag($this->getNode()->getParent());
foreach ($cacheTags as $tag) {
$this->contentCache->flushByTag($tag);
}
$parentDomAddress = $this->getParentDomAddress();
... | php | protected function renderContent(ControllerContext $controllerContext)
{
$cacheTags = $this->cachingHelper->nodeTag($this->getNode()->getParent());
foreach ($cacheTags as $tag) {
$this->contentCache->flushByTag($tag);
}
$parentDomAddress = $this->getParentDomAddress();
... | [
"protected",
"function",
"renderContent",
"(",
"ControllerContext",
"$",
"controllerContext",
")",
"{",
"$",
"cacheTags",
"=",
"$",
"this",
"->",
"cachingHelper",
"->",
"nodeTag",
"(",
"$",
"this",
"->",
"getNode",
"(",
")",
"->",
"getParent",
"(",
")",
")",... | Render the node
@param ControllerContext $controllerContext
@return string | [
"Render",
"the",
"node"
] | train | https://github.com/neos/neos-ui/blob/6770c243f0750bbef82d6f14b5c3e580493e068c/Classes/Domain/Model/Feedback/Operations/RenderContentOutOfBand.php#L209-L225 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.