Make WordPress Core


Ignore:
Timestamp:
10/18/2021 05:51:17 PM (5 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add public visibility to methods in src directory.

This commit adds the public visibility keyword to each method which did not have an explicit visibility keyword.

Why public?

With no visibility previously declared, these methods are implicitly public and available for use. Changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf.
See #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/streams.php

    r51032 r51919  
    1818                 * PHP5 constructor.
    1919                 */
    20                 function __construct() {
     20                public function __construct() {
    2121                        if ( function_exists( 'mb_substr' )
    2222                                && ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
     
    4747                 * @param string $endian Set the endianness of the file. Accepts 'big', or 'little'.
    4848                 */
    49                 function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
     49                public function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
    5050                        $this->endian = $endian;
    5151                }
     
    5757                 *  the stream of false if there are not enough bytes or on error
    5858                 */
    59                 function readint32() {
     59                public function readint32() {
    6060                        $bytes = $this->read( 4 );
    6161                        if ( 4 != $this->strlen( $bytes ) ) {
     
    7474                 *  enough data or on error
    7575                 */
    76                 function readint32array( $count ) {
     76                public function readint32array( $count ) {
    7777                        $bytes = $this->read( 4 * $count );
    7878                        if ( 4 * $count != $this->strlen( $bytes ) ) {
     
    8989                 * @return string
    9090                 */
    91                 function substr( $string, $start, $length ) {
     91                public function substr( $string, $start, $length ) {
    9292                        if ( $this->is_overloaded ) {
    9393                                return mb_substr( $string, $start, $length, 'ascii' );
     
    101101                 * @return int
    102102                 */
    103                 function strlen( $string ) {
     103                public function strlen( $string ) {
    104104                        if ( $this->is_overloaded ) {
    105105                                return mb_strlen( $string, 'ascii' );
     
    114114                 * @return array
    115115                 */
    116                 function str_split( $string, $chunk_size ) {
     116                public function str_split( $string, $chunk_size ) {
    117117                        if ( ! function_exists( 'str_split' ) ) {
    118118                                $length = $this->strlen( $string );
     
    130130                 * @return int
    131131                 */
    132                 function pos() {
     132                public function pos() {
    133133                        return $this->_pos;
    134134                }
     
    137137                 * @return true
    138138                 */
    139                 function is_resource() {
     139                public function is_resource() {
    140140                        return true;
    141141                }
     
    144144                 * @return true
    145145                 */
    146                 function close() {
     146                public function close() {
    147147                        return true;
    148148                }
     
    156156                 * @param string $filename
    157157                 */
    158                 function __construct( $filename ) {
     158                public function __construct( $filename ) {
    159159                        parent::__construct();
    160160                        $this->_f = fopen( $filename, 'rb' );
     
    177177                 * @return string|false Returns read string, otherwise false.
    178178                 */
    179                 function read( $bytes ) {
     179                public function read( $bytes ) {
    180180                        return fread( $this->_f, $bytes );
    181181                }
     
    185185                 * @return bool
    186186                 */
    187                 function seekto( $pos ) {
     187                public function seekto( $pos ) {
    188188                        if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) {
    189189                                return false;
     
    196196                 * @return bool
    197197                 */
    198                 function is_resource() {
     198                public function is_resource() {
    199199                        return is_resource( $this->_f );
    200200                }
     
    203203                 * @return bool
    204204                 */
    205                 function feof() {
     205                public function feof() {
    206206                        return feof( $this->_f );
    207207                }
     
    210210                 * @return bool
    211211                 */
    212                 function close() {
     212                public function close() {
    213213                        return fclose( $this->_f );
    214214                }
     
    217217                 * @return string
    218218                 */
    219                 function read_all() {
     219                public function read_all() {
    220220                        $all = '';
    221221                        while ( ! $this->feof() ) {
     
    239239                 * PHP5 constructor.
    240240                 */
    241                 function __construct( $str = '' ) {
     241                public function __construct( $str = '' ) {
    242242                        parent::__construct();
    243243                        $this->_str = $str;
     
    261261                 * @return string
    262262                 */
    263                 function read( $bytes ) {
     263                public function read( $bytes ) {
    264264                        $data        = $this->substr( $this->_str, $this->_pos, $bytes );
    265265                        $this->_pos += $bytes;
     
    274274                 * @return int
    275275                 */
    276                 function seekto( $pos ) {
     276                public function seekto( $pos ) {
    277277                        $this->_pos = $pos;
    278278                        if ( $this->strlen( $this->_str ) < $this->_pos ) {
     
    285285                 * @return int
    286286                 */
    287                 function length() {
     287                public function length() {
    288288                        return $this->strlen( $this->_str );
    289289                }
     
    292292                 * @return string
    293293                 */
    294                 function read_all() {
     294                public function read_all() {
    295295                        return $this->substr( $this->_str, $this->_pos, $this->strlen( $this->_str ) );
    296296                }
     
    307307                 * PHP5 constructor.
    308308                 */
    309                 function __construct( $filename ) {
     309                public function __construct( $filename ) {
    310310                        parent::__construct();
    311311                        $this->_str = file_get_contents( $filename );
     
    349349                 * @see POMO_CachedIntFileReader::__construct()
    350350                 */
    351                 function POMO_CachedIntFileReader( $filename ) {
     351                public function POMO_CachedIntFileReader( $filename ) {
    352352                        _deprecated_constructor( self::class, '5.4.0', static::class );
    353353                        self::__construct( $filename );
Note: See TracChangeset for help on using the changeset viewer.