Code Duplication    Length = 9-12 lines in 3 locations

includes/Revision.php 2 locations

@@ 828-836 (lines=9) @@
825
	 *   to the $audience parameter
826
	 * @return int
827
	 */
828
	public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
829
		if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
830
			return 0;
831
		} elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
832
			return 0;
833
		} else {
834
			return $this->mUser;
835
		}
836
	}
837
838
	/**
839
	 * Fetch revision's user id without regard for the current user's permissions
@@ 904-912 (lines=9) @@
901
	 *   to the $audience parameter
902
	 * @return string
903
	 */
904
	function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
905
		if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
906
			return '';
907
		} elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_COMMENT, $user ) ) {
908
			return '';
909
		} else {
910
			return $this->mComment;
911
		}
912
	}
913
914
	/**
915
	 * Fetch revision comment without regard for the current user's permissions

includes/filerepo/file/LocalFile.php 1 location

@@ 1823-1834 (lines=12) @@
1820
	 * @param User $user
1821
	 * @return string
1822
	 */
1823
	function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
1824
		$this->load();
1825
		if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
1826
			return '';
1827
		} elseif ( $audience == self::FOR_THIS_USER
1828
			&& !$this->userCan( self::DELETED_COMMENT, $user )
1829
		) {
1830
			return '';
1831
		} else {
1832
			return $this->description;
1833
		}
1834
	}
1835
1836
	/**
1837
	 * @return bool|string