From a6c43f5eb7b43f039eb3b44de7c8f030a77c57db Mon Sep 17 00:00:00 2001 From: Johnny Theill Date: Sat, 15 Feb 2014 17:53:57 +0100 Subject: [PATCH] Update doc-blocks and small fixes according to coding standards --- controllers/SiteController.php | 4 ++-- models/User.php | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index e538dcc..36e1ecc 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -76,7 +76,7 @@ class SiteController extends Controller public function actionContact() { - $model = new ContactForm; + $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); @@ -91,4 +91,4 @@ class SiteController extends Controller { return $this->render('about'); } -} +} \ No newline at end of file diff --git a/models/User.php b/models/User.php index af4c42e..b890e69 100644 --- a/models/User.php +++ b/models/User.php @@ -24,11 +24,20 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface ], ]; + /** + * @inheritdoc + */ public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; } + /** + * Finds user by username + * + * @param string $username + * @return static|null + */ public static function findByUsername($username) { foreach (self::$users as $user) { @@ -39,21 +48,36 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface return null; } + /** + * @inheritdoc + */ public function getId() { return $this->id; } + /** + * @inheritdoc + */ public function getAuthKey() { return $this->authKey; } + /** + * @inheritdoc + */ public function validateAuthKey($authKey) { return $this->authKey === $authKey; } + /** + * Validates password + * + * @param string $password password to validate + * @return bool if password provided is valid for current user + */ public function validatePassword($password) { return $this->password === $password;