fix formatting

This commit is contained in:
Antonio Ramirez
2016-12-14 02:50:12 +01:00
parent f3f4b31bb4
commit 3ba01b4674
140 changed files with 512 additions and 523 deletions

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Traits\AuthManagerTrait;
@ -38,7 +39,7 @@ abstract class AbstractAuthItem extends Model
public $item;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function init()
{
@ -56,7 +57,7 @@ abstract class AbstractAuthItem extends Model
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attributeLabels()
{
@ -69,7 +70,7 @@ abstract class AbstractAuthItem extends Model
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function scenarios()
{
@ -80,7 +81,7 @@ abstract class AbstractAuthItem extends Model
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function rules()
{
@ -98,7 +99,7 @@ abstract class AbstractAuthItem extends Model
},
'when' => function () {
return $this->scenario == 'create' || $this->item->name != $this->name;
}
},
],
['children', RbacItemsValidator::class],
['rule', RbacRuleValidator::class],

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Traits\AuthManagerTrait;
@ -16,14 +17,15 @@ class Assignment extends Model
public $updated = false;
/**
* @inheritdoc
* {@inheritdoc}
*
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
if($this->user_id === null) {
if ($this->user_id === null) {
throw new InvalidConfigException('"user_id" must be set.');
}
@ -31,24 +33,24 @@ class Assignment extends Model
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'items' => Yii::t('user', 'Items')
'items' => Yii::t('user', 'Items'),
];
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function rules()
{
return [
['user_id', 'required'],
['items', RbacItemsValidator::class],
['user_id', 'integer']
['user_id', 'integer'],
];
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use yii\rbac\Item;

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Helper\GravatarHelper;
@ -13,8 +14,7 @@ use DateTimeZone;
use DateTime;
/**
*
* @property integer $user_id
* @property int $user_id
* @property string $name
* @property string $public_email
* @property string $gravatar_email
@ -23,7 +23,6 @@ use DateTime;
* @property string $website
* @property string $bio
* @property string $timezone
*
* @property User $user
*/
class Profile extends ActiveRecord
@ -32,12 +31,11 @@ class Profile extends ActiveRecord
use ContainerTrait;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function beforeSave($insert)
{
if ($this->isAttributeChanged('gravatar_email')) {
$this->setAttribute(
'gravatar_id',
$this->make(GravatarHelper::class)->buildId(trim($this->getAttribute('gravatar_email')))
@ -48,7 +46,7 @@ class Profile extends ActiveRecord
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function tableName()
{
@ -56,7 +54,7 @@ class Profile extends ActiveRecord
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function rules()
{
@ -68,7 +66,7 @@ class Profile extends ActiveRecord
if ($this->make(TimeZoneValidator::class, [$attribute])->validate()) {
$this->addError($attribute, Yii::t('user', 'Time zone is not valid'));
}
}
},
],
'publicEmailPattern' => ['public_email', 'email'],
'gravatarEmailPattern' => ['gravatar_email', 'email'],
@ -82,7 +80,7 @@ class Profile extends ActiveRecord
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attributeLabels()
{
@ -112,7 +110,7 @@ class Profile extends ActiveRecord
}
/**
* Set the User's timezone
* Set the User's timezone.
*
* @param DateTimeZone $timezone
*/
@ -122,7 +120,7 @@ class Profile extends ActiveRecord
}
/**
* Get User's local time
* Get User's local time.
*
* @param DateTime|null $dateTime
*

View File

@ -1,9 +1,9 @@
<?php
namespace Da\User\Model;
use yii\rbac\Item;
class Role extends AbstractAuthItem
{
public function getType()

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Query\SocialNetworkAccountQuery;
@ -10,8 +11,8 @@ use yii\helpers\Url;
/**
* /**
* @property integer $id Id
* @property integer $user_id User id, null if account is not bind to user
* @property int $id Id
* @property int $user_id User id, null if account is not bind to user
* @property string $provider Name of service
* @property string $client_id Account id
* @property string $data Account properties returned by social network (json encoded)
@ -19,9 +20,8 @@ use yii\helpers\Url;
* @property string $code
* @property string $email
* @property string $username
* @property integer $created_at
*
* @property User $user User that this account is connected for.
* @property int $created_at
* @property User $user User that this account is connected for
*/
class SocialNetworkAccount extends ActiveRecord
{
@ -34,7 +34,7 @@ class SocialNetworkAccount extends ActiveRecord
protected $decodedData;
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function tableName()
{
@ -42,7 +42,7 @@ class SocialNetworkAccount extends ActiveRecord
}
/**
* @return bool Whether this social account is connected to user.
* @return bool Whether this social account is connected to user
*/
public function getIsConnected()
{
@ -73,7 +73,7 @@ class SocialNetworkAccount extends ActiveRecord
}
/**
* Connects account to a user
* Connects account to a user.
*
* @param User $user
*

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Helper\SecurityHelper;
@ -8,18 +9,16 @@ use Da\User\Traits\ModuleTrait;
use yii\db\ActiveRecord;
use yii\helpers\Url;
use RuntimeException;
use Yii;
/**
* Token Active Record model.
*
* @property integer $user_id
* @property int $user_id
* @property string $code
* @property integer $type
* @property int $type
* @property string $url
* @property bool $isExpired
* @property integer $created_at
*
* @property int $created_at
* @property User $user
*/
class Token extends ActiveRecord
@ -36,11 +35,11 @@ class Token extends ActiveRecord
self::TYPE_CONFIRMATION => '/user/registration/confirm',
self::TYPE_RECOVERY => '/usr/recovery/reset',
self::TYPE_CONFIRM_NEW_EMAIL => '/user/settings/confirm',
self::TYPE_CONFIRM_OLD_EMAIL => '/usr/settings/confirm'
self::TYPE_CONFIRM_OLD_EMAIL => '/usr/settings/confirm',
];
/**
* @inheritdoc
* {@inheritdoc}
*/
public function beforeSave($insert)
{
@ -54,7 +53,7 @@ class Token extends ActiveRecord
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function tableName()
{
@ -62,7 +61,7 @@ class Token extends ActiveRecord
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function primaryKey()
{
@ -86,7 +85,7 @@ class Token extends ActiveRecord
}
/**
* @return bool Whether token has expired.
* @return bool Whether token has expired
*/
public function getIsExpired()
{

View File

@ -1,4 +1,5 @@
<?php
namespace Da\User\Model;
use Da\User\Helper\SecurityHelper;
@ -21,18 +22,18 @@ use yii\web\IdentityInterface;
* @property bool $isConfirmed
*
* Database fields:
* @property integer $id
* @property int $id
* @property string $username
* @property string $email
* @property string $unconfirmed_email
* @property string $password_hash
* @property string $auth_key
* @property integer $registration_ip
* @property integer $confirmed_at
* @property integer $blocked_at
* @property integer $flags
* @property integer $created_at
* @property integer $updated_at
* @property int $registration_ip
* @property int $confirmed_at
* @property int $blocked_at
* @property int $flags
* @property int $created_at
* @property int $updated_at
*
* Defined relations:
* @property SocialNetworkAccount[] $socialNetworkAccounts
@ -48,7 +49,7 @@ class User extends ActiveRecord implements IdentityInterface
const NEW_EMAIL_CONFIRMED = 0b10;
/**
* @var string Plain password. Used for model validation.
* @var string Plain password. Used for model validation
*/
public $password;
/**
@ -57,7 +58,7 @@ class User extends ActiveRecord implements IdentityInterface
protected $connectedAccounts;
/**
* @inheritdoc
* {@inheritdoc}
*/
public function beforeSave($insert)
{
@ -81,7 +82,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function tableName()
{
@ -89,7 +90,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function behaviors()
{
@ -99,7 +100,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function attributeLabels()
{
@ -115,7 +116,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function scenarios()
{
@ -132,7 +133,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function rules()
{
@ -145,7 +146,7 @@ class User extends ActiveRecord implements IdentityInterface
'usernameUnique' => [
'username',
'unique',
'message' => Yii::t('user', 'This username has already been taken')
'message' => Yii::t('user', 'This username has already been taken'),
],
// email rules
@ -155,7 +156,7 @@ class User extends ActiveRecord implements IdentityInterface
'emailUnique' => [
'email',
'unique',
'message' => Yii::t('user', 'This email address has already been taken')
'message' => Yii::t('user', 'This email address has already been taken'),
],
'emailTrim' => ['email', 'trim'],
@ -166,7 +167,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function validateAuthKey($authKey)
{
@ -174,7 +175,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getId()
{
@ -182,7 +183,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getAuthKey()
{
@ -190,7 +191,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function findIdentity($id)
{
@ -198,7 +199,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @return bool whether is blocked or not.
* @return bool whether is blocked or not
*/
public function getIsBlocked()
{
@ -222,7 +223,7 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* Checks whether a user has a specific role
* Checks whether a user has a specific role.
*
* @param string $role
*
@ -269,10 +270,10 @@ class User extends ActiveRecord implements IdentityInterface
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public static function findIdentityByAccessToken($token, $type = null)
{
throw new NotSupportedException('Method "' . __CLASS__ . '::' . __METHOD__ . '" is not implemented.');
throw new NotSupportedException('Method "'.__CLASS__.'::'.__METHOD__.'" is not implemented.');
}
}