r100148 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100147‎ | r100148 | r100149 >
Date:19:56, 18 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Create some temporary variables rather than a load of chained method calls
Modified paths:
  • /trunk/extensions/Contest/specials/SpecialMyContests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialMyContests.php
@@ -275,24 +275,27 @@
276276 * @param ContestContestant $contestant
277277 */
278278 protected function showSubmissionPage( ContestContestant $contestant ) {
279 - if ( $this->getRequest()->getCheck( 'new' ) ) {
280 - $this->showSuccess( 'contest-mycontests-signup-success', $contestant->getContest()->getField( 'name' ) );
 279+ $request = $this->getRequest();
 280+ $contest = $contestant->getContest();
 281+ if ( $request->getCheck( 'new' ) ) {
 282+ $this->showSuccess( 'contest-mycontests-signup-success', $contest->getField( 'name' ) );
281283 }
282 - else if ( $this->getRequest()->getCheck( 'added' ) ) {
 284+ else if ( $request->getCheck( 'added' ) ) {
283285 $this->showSuccess( 'contest-mycontests-addition-success' );
284286 }
285 - else if ( $this->getRequest()->getCheck( 'updated' ) ) {
 287+ else if ( $request->getCheck( 'updated' ) ) {
286288 $this->showSuccess( 'contest-mycontests-updated-success' );
287289 }
288 - else if ( $this->getRequest()->wasPosted()
289 - && !$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
 290+ else if ( $request->wasPosted()
 291+ && !$this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
290292 $this->showError( 'contest-mycontests-sessionfail' );
291293 }
292294
293 - $this->getOutput()->setPageTitle( $contestant->getContest()->getField( 'name' ) );
 295+ $output = $this->getOutput();
 296+ $output->setPageTitle( $contest->getField( 'name' ) );
294297
295 - $this->getOutput()->addHTML('<div style="clear:both;"></div>');
296 - $this->getOutput()->addWikiMsg( 'contest-submission-header', $contestant->getContest()->getField( 'name' ) );
 298+ $output->addHTML('<div style="clear:both;"></div>');
 299+ $output->addWikiMsg( 'contest-submission-header', $contest->getField( 'name' ) );
297300
298301 $form = new HTMLForm( $this->getFormFields( $contestant ), $this->getContext() );
299302
@@ -301,10 +304,10 @@
302305
303306 if( $form->show() ) {
304307 $query = is_null( $this->submissionState ) ? '' : $this->submissionState;
305 - $this->getOutput()->redirect( $this->getTitle( $contestant->getContest()->getField( 'name' ) )->getLocalURL( $query ) );
 308+ $output->redirect( $this->getTitle( $contest->getField( 'name' ) )->getLocalURL( $query ) );
306309 }
307310 else {
308 - $this->getOutput()->addModules( 'contest.special.submission' );
 311+ $output->addModules( 'contest.special.submission' );
309312 }
310313 }
311314

Status & tagging log