From 1eea41eb1ce559f20697b891a2a05eeadaa45b47 Mon Sep 17 00:00:00 2001 From: Reedy Date: Fri, 11 May 2012 19:05:16 +0100 Subject: [PATCH] Couple of fixme comments Tidy up parameter documentation Change-Id: I1a615d44e9092cf080ef1aed9dba50c3b5416392 --- OATHAuth.i18n.php | 1 + OATHUser.php | 33 +++++++++++++++++++-------------- special/SpecialOATH.php | 21 ++++++++++++++------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/OATHAuth.i18n.php b/OATHAuth.i18n.php index b8d55752..d36ad45c 100644 --- a/OATHAuth.i18n.php +++ b/OATHAuth.i18n.php @@ -48,4 +48,5 @@ $messages['en'] = array( * @author Ryan Lane */ $messages['qqq'] = array( + 'oathauth-desc' => '{{desc}}', ); diff --git a/OATHUser.php b/OATHUser.php index c4a80ce8..31fba8ad 100644 --- a/OATHUser.php +++ b/OATHUser.php @@ -14,11 +14,14 @@ class OATHUser { /** * Constructor. Can't be called directly. Call one of the static NewFrom* methods * @param $id Int Database id for the group - * @param $name String User-defined name of the group - * @param $position int - * @param $project string|null + * @param $account + * @param $secret + * @param $secretReset + * @param $scratchTokens + * @param $scratchTokensReset + * @param bool $isValidated bool */ - public function __construct( $id, $account, $secret=null, $secretReset = null, $scratchTokens=null, $scratchTokensReset=null, $isValidated=false ) { + public function __construct( $id, $account, $secret = null, $secretReset = null, $scratchTokens = null, $scratchTokensReset = null, $isValidated = false ) { $this->id = $id; $this->account = $account; $this->isEnabled = true; @@ -36,7 +39,7 @@ class OATHUser { if ( $scratchTokens ) { $this->scratchTokens = $scratchTokens; } else { - $this->regenerateScratchTokens(); + $this->regenerateScratchTokens(); // FIXME: Missing parameter $this->isEnabled = false; } if ( $scratchTokensReset ) { @@ -47,6 +50,9 @@ class OATHUser { $this->isValidated = $isValidated; } + /** + * @param $reset bool + */ public function regenerateScratchTokens( $reset ) { $scratchTokens = array(); for ( $i = 0; $i < 5; $i++ ) { @@ -109,10 +115,12 @@ class OATHUser { } /** + * @param $token + * @param $reset bool * @return Boolean */ - public function verifyToken( $token, $reset=false ) { - if ( $reset ) { + public function verifyToken( $token, $reset = false ) { + if ( $reset ) { $secret = $this->secretReset; } else { $secret = $this->secret; @@ -139,7 +147,7 @@ class OATHUser { } /** - * @param $name string + * @param $user User * @return OATHUser|null */ public static function newFromUser( $user ) { @@ -180,7 +188,7 @@ class OATHUser { } /** - * @param $name string + * @param $username string * @return OATHUser|null */ public static function newFromUsername( $username ) { @@ -228,7 +236,7 @@ class OATHUser { array( 'secret' => $this->secretReset, 'secret_reset' => null, 'scratch_tokens' => base64_encode( serialize( $this->scratchTokensReset ) ), - 'scratch_tokens_reset' => null, + 'scratch_tokens_reset' => null, ), array( 'id' => $this->id ), __METHOD__ @@ -236,7 +244,6 @@ class OATHUser { } /** - * @param $token string * @return bool */ public function validate() { @@ -263,7 +270,6 @@ class OATHUser { } /** - * @param $id int * @return bool */ public function disable() { @@ -276,11 +282,11 @@ class OATHUser { } /** - * @static * @param $template * @return bool */ static function ModifyUITemplate( &$template ) { + // FIXME: First assignment of $input unused $input = array( 'msg' => 'oathauth-token', 'type' => 'text', 'name' => 'token', 'value' => '', 'helptext' => 'oathauth-tokenhelp' ); $input = '' . Html::input( 'wpOATHToken', null, 'password', array( 'class' => 'loginPassword', 'id' => 'wpOATHToken', 'tabindex' => '2', 'size' => '20' ) ) . ''; $template->set( 'extrafields', $input ); @@ -289,7 +295,6 @@ class OATHUser { } /** - * @static * @param $username string * @param $password string * @param $result bool diff --git a/special/SpecialOATH.php b/special/SpecialOATH.php index dff28749..b7bf1bfb 100644 --- a/special/SpecialOATH.php +++ b/special/SpecialOATH.php @@ -76,7 +76,10 @@ class SpecialOATH extends SpecialPage { return true; } - function displaySecret( $reset=false ) { + /** + * @param $reset bool + */ + function displaySecret( $reset = false ) { $this->getOutput()->addModules( 'ext.oathauth' ); if ( $reset ) { $secret = $this->OATHUser->getSecretReset(); @@ -198,6 +201,10 @@ class SpecialOATH extends SpecialPage { $this->getOutput()->addHTML( $this->createResourceList( $resources ) ); } + /** + * @param $resources array + * @return string + */ function createResourceList( $resources ) { $resourceList = ''; foreach ( $resources as $resource ) { @@ -207,8 +214,8 @@ class SpecialOATH extends SpecialPage { } /** - * @param $formData - * @param string $entryPoint + * @param $formData array + * @param $entryPoint string * @return bool */ function tryValidateSubmit( $formData, $entryPoint = 'internal' ) { @@ -246,8 +253,8 @@ class SpecialOATH extends SpecialPage { } /** - * @param $formData - * @param string $entryPoint + * @param $formData array + * @param $entryPoint string * @return bool */ function tryDisableSubmit( $formData, $entryPoint = 'internal' ) { @@ -268,8 +275,8 @@ class SpecialOATH extends SpecialPage { } /** - * @param $formData - * @param string $entryPoint + * @param $formData array + * @param $entryPoint string * @return bool */ function tryResetSubmit( $formData, $entryPoint = 'internal' ) {