mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
many phpcs fixes
This commit is contained in:
@ -359,4 +359,4 @@ class AuthAction extends Action
|
||||
return Yii::$app->getResponse()->redirect($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,4 +233,4 @@ abstract class BaseClient extends Component implements ClientInterface
|
||||
}
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,4 +54,4 @@ interface ClientInterface
|
||||
* @return array view options in format: optionName => optionValue
|
||||
*/
|
||||
public function getViewOptions();
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,4 +104,4 @@ class Collection extends Component
|
||||
$config['id'] = $id;
|
||||
return Yii::createObject($config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth
|
||||
}
|
||||
case 'POST': {
|
||||
$curlOptions[CURLOPT_POST] = true;
|
||||
if (!empty($params)){
|
||||
if (!empty($params)) {
|
||||
$curlOptions[CURLOPT_POSTFIELDS] = $params;
|
||||
}
|
||||
$authorizationHeader = $this->composeAuthorizationHeader($params);
|
||||
@ -352,4 +352,4 @@ class OAuth1 extends BaseOAuth
|
||||
}
|
||||
return $header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,4 +182,4 @@ class OAuth2 extends BaseOAuth
|
||||
$tokenConfig['tokenParamKey'] = 'access_token';
|
||||
return parent::createToken($tokenConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,14 +58,16 @@ class OAuthToken extends Object
|
||||
/**
|
||||
* @param string $expireDurationParamKey expire duration param key.
|
||||
*/
|
||||
public function setExpireDurationParamKey($expireDurationParamKey) {
|
||||
public function setExpireDurationParamKey($expireDurationParamKey)
|
||||
{
|
||||
$this->_expireDurationParamKey = $expireDurationParamKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string expire duration param key.
|
||||
*/
|
||||
public function getExpireDurationParamKey() {
|
||||
public function getExpireDurationParamKey()
|
||||
{
|
||||
if ($this->_expireDurationParamKey === null) {
|
||||
$this->_expireDurationParamKey = $this->defaultExpireDurationParamKey();
|
||||
}
|
||||
@ -75,14 +77,16 @@ class OAuthToken extends Object
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getParams() {
|
||||
public function getParams()
|
||||
{
|
||||
return $this->_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
*/
|
||||
public function setParams(array $params) {
|
||||
public function setParams(array $params)
|
||||
{
|
||||
$this->_params = $params;
|
||||
}
|
||||
|
||||
@ -91,7 +95,8 @@ class OAuthToken extends Object
|
||||
* @param string $name param name.
|
||||
* @param mixed $value param value,
|
||||
*/
|
||||
public function setParam($name, $value) {
|
||||
public function setParam($name, $value)
|
||||
{
|
||||
$this->_params[$name] = $value;
|
||||
}
|
||||
|
||||
@ -100,7 +105,8 @@ class OAuthToken extends Object
|
||||
* @param string $name param name.
|
||||
* @return mixed param value.
|
||||
*/
|
||||
public function getParam($name) {
|
||||
public function getParam($name)
|
||||
{
|
||||
return isset($this->_params[$name]) ? $this->_params[$name] : null;
|
||||
}
|
||||
|
||||
@ -109,7 +115,8 @@ class OAuthToken extends Object
|
||||
* @param string $token token value.
|
||||
* @return static self reference.
|
||||
*/
|
||||
public function setToken($token) {
|
||||
public function setToken($token)
|
||||
{
|
||||
$this->setParam($this->tokenParamKey, $token);
|
||||
}
|
||||
|
||||
@ -117,7 +124,8 @@ class OAuthToken extends Object
|
||||
* Returns token value.
|
||||
* @return string token value.
|
||||
*/
|
||||
public function getToken() {
|
||||
public function getToken()
|
||||
{
|
||||
return $this->getParam($this->tokenParamKey);
|
||||
}
|
||||
|
||||
@ -125,7 +133,8 @@ class OAuthToken extends Object
|
||||
* Sets the token secret value.
|
||||
* @param string $tokenSecret token secret.
|
||||
*/
|
||||
public function setTokenSecret($tokenSecret) {
|
||||
public function setTokenSecret($tokenSecret)
|
||||
{
|
||||
$this->setParam($this->tokenSecretParamKey, $tokenSecret);
|
||||
}
|
||||
|
||||
@ -133,7 +142,8 @@ class OAuthToken extends Object
|
||||
* Returns the token secret value.
|
||||
* @return string token secret value.
|
||||
*/
|
||||
public function getTokenSecret() {
|
||||
public function getTokenSecret()
|
||||
{
|
||||
return $this->getParam($this->tokenSecretParamKey);
|
||||
}
|
||||
|
||||
@ -141,7 +151,8 @@ class OAuthToken extends Object
|
||||
* Sets token expire duration.
|
||||
* @param string $expireDuration token expiration duration.
|
||||
*/
|
||||
public function setExpireDuration($expireDuration) {
|
||||
public function setExpireDuration($expireDuration)
|
||||
{
|
||||
$this->setParam($this->getExpireDurationParamKey(), $expireDuration);
|
||||
}
|
||||
|
||||
@ -149,7 +160,8 @@ class OAuthToken extends Object
|
||||
* Returns the token expiration duration.
|
||||
* @return integer token expiration duration.
|
||||
*/
|
||||
public function getExpireDuration() {
|
||||
public function getExpireDuration()
|
||||
{
|
||||
return $this->getParam($this->getExpireDurationParamKey());
|
||||
}
|
||||
|
||||
@ -157,7 +169,8 @@ class OAuthToken extends Object
|
||||
* Fetches default expire duration param key.
|
||||
* @return string expire duration param key.
|
||||
*/
|
||||
protected function defaultExpireDurationParamKey() {
|
||||
protected function defaultExpireDurationParamKey()
|
||||
{
|
||||
$expireDurationParamKey = 'expires_in';
|
||||
foreach ($this->getParams() as $name => $value) {
|
||||
if (strpos($name, 'expir') !== false) {
|
||||
@ -172,7 +185,8 @@ class OAuthToken extends Object
|
||||
* Checks if token has expired.
|
||||
* @return boolean is token expired.
|
||||
*/
|
||||
public function getIsExpired() {
|
||||
public function getIsExpired()
|
||||
{
|
||||
$expirationDuration = $this->getExpireDuration();
|
||||
if (empty($expirationDuration)) {
|
||||
return false;
|
||||
@ -184,8 +198,9 @@ class OAuthToken extends Object
|
||||
* Checks if token is valid.
|
||||
* @return boolean is token valid.
|
||||
*/
|
||||
public function getIsValid() {
|
||||
public function getIsValid()
|
||||
{
|
||||
$token = $this->getToken();
|
||||
return (!empty($token) && !$this->getIsExpired());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface
|
||||
|
||||
if ($this->verifyPeer !== null) {
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer);
|
||||
if($this->capath) {
|
||||
if ($this->capath) {
|
||||
curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
|
||||
}
|
||||
if($this->cainfo) {
|
||||
if ($this->cainfo) {
|
||||
curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
|
||||
}
|
||||
}
|
||||
@ -926,4 +926,4 @@ class OpenId extends BaseClient implements ClientInterface
|
||||
{
|
||||
return array_merge(['id' => $this->getClaimedId()], $this->fetchAttributes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,4 +80,4 @@ class Facebook extends OAuth2
|
||||
{
|
||||
return 'Facebook';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,4 +90,4 @@ class GitHub extends OAuth2
|
||||
{
|
||||
return 'GitHub';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,4 +90,4 @@ class GoogleOAuth extends OAuth2
|
||||
{
|
||||
return 'Google';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,4 +87,4 @@ class GoogleOpenId extends OpenId
|
||||
{
|
||||
return 'Google';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,8 @@ class LinkedIn extends OAuth2
|
||||
* Generates the auth state value.
|
||||
* @return string auth state value.
|
||||
*/
|
||||
protected function generateAuthState() {
|
||||
protected function generateAuthState()
|
||||
{
|
||||
return sha1(uniqid(get_class($this), true));
|
||||
}
|
||||
|
||||
@ -166,4 +167,4 @@ class LinkedIn extends OAuth2
|
||||
{
|
||||
return 'LinkedIn';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +88,4 @@ class Twitter extends OAuth1
|
||||
{
|
||||
return 'Twitter';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +88,4 @@ class YandexOAuth extends OAuth2
|
||||
{
|
||||
return 'Yandex';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,4 +83,4 @@ class YandexOpenId extends OpenId
|
||||
{
|
||||
return 'Yandex';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,4 +46,4 @@ abstract class BaseMethod extends Object
|
||||
}
|
||||
return (strcmp($expectedSignature, $signature) === 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,4 +44,4 @@ class HmacSha1 extends BaseMethod
|
||||
{
|
||||
return base64_encode(hash_hmac('sha1', $baseString, $key, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,4 +30,4 @@ class PlainText extends BaseMethod
|
||||
{
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,4 +165,4 @@ class RsaSha1 extends BaseMethod
|
||||
openssl_free_key($publicKeyId);
|
||||
return ($verificationResult == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,4 +27,4 @@ class ChoiceAsset extends AssetBundle
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user