mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51919 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -17,7 +17,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
if ( function_exists( 'mb_substr' )
|
||||
&& ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
|
||||
) {
|
||||
@@ -46,7 +46,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
*
|
||||
* @param string $endian Set the endianness of the file. Accepts 'big', or 'little'.
|
||||
*/
|
||||
function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
||||
public function setEndian( $endian ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
|
||||
$this->endian = $endian;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
* @return mixed The integer, corresponding to the next 32 bits from
|
||||
* the stream of false if there are not enough bytes or on error
|
||||
*/
|
||||
function readint32() {
|
||||
public function readint32() {
|
||||
$bytes = $this->read( 4 );
|
||||
if ( 4 != $this->strlen( $bytes ) ) {
|
||||
return false;
|
||||
@@ -73,7 +73,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
* @return mixed Array of integers or false if there isn't
|
||||
* enough data or on error
|
||||
*/
|
||||
function readint32array( $count ) {
|
||||
public function readint32array( $count ) {
|
||||
$bytes = $this->read( 4 * $count );
|
||||
if ( 4 * $count != $this->strlen( $bytes ) ) {
|
||||
return false;
|
||||
@@ -88,7 +88,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
function substr( $string, $start, $length ) {
|
||||
public function substr( $string, $start, $length ) {
|
||||
if ( $this->is_overloaded ) {
|
||||
return mb_substr( $string, $start, $length, 'ascii' );
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
* @param string $string
|
||||
* @return int
|
||||
*/
|
||||
function strlen( $string ) {
|
||||
public function strlen( $string ) {
|
||||
if ( $this->is_overloaded ) {
|
||||
return mb_strlen( $string, 'ascii' );
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
* @param int $chunk_size
|
||||
* @return array
|
||||
*/
|
||||
function str_split( $string, $chunk_size ) {
|
||||
public function str_split( $string, $chunk_size ) {
|
||||
if ( ! function_exists( 'str_split' ) ) {
|
||||
$length = $this->strlen( $string );
|
||||
$out = array();
|
||||
@@ -129,21 +129,21 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function pos() {
|
||||
public function pos() {
|
||||
return $this->_pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true
|
||||
*/
|
||||
function is_resource() {
|
||||
public function is_resource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true
|
||||
*/
|
||||
function close() {
|
||||
public function close() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ if ( ! class_exists( 'POMO_FileReader', false ) ) :
|
||||
/**
|
||||
* @param string $filename
|
||||
*/
|
||||
function __construct( $filename ) {
|
||||
public function __construct( $filename ) {
|
||||
parent::__construct();
|
||||
$this->_f = fopen( $filename, 'rb' );
|
||||
}
|
||||
@@ -176,7 +176,7 @@ if ( ! class_exists( 'POMO_FileReader', false ) ) :
|
||||
* @param int $bytes
|
||||
* @return string|false Returns read string, otherwise false.
|
||||
*/
|
||||
function read( $bytes ) {
|
||||
public function read( $bytes ) {
|
||||
return fread( $this->_f, $bytes );
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ if ( ! class_exists( 'POMO_FileReader', false ) ) :
|
||||
* @param int $pos
|
||||
* @return bool
|
||||
*/
|
||||
function seekto( $pos ) {
|
||||
public function seekto( $pos ) {
|
||||
if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -195,28 +195,28 @@ if ( ! class_exists( 'POMO_FileReader', false ) ) :
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function is_resource() {
|
||||
public function is_resource() {
|
||||
return is_resource( $this->_f );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function feof() {
|
||||
public function feof() {
|
||||
return feof( $this->_f );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function close() {
|
||||
public function close() {
|
||||
return fclose( $this->_f );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function read_all() {
|
||||
public function read_all() {
|
||||
$all = '';
|
||||
while ( ! $this->feof() ) {
|
||||
$all .= $this->read( 4096 );
|
||||
@@ -238,7 +238,7 @@ if ( ! class_exists( 'POMO_StringReader', false ) ) :
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $str = '' ) {
|
||||
public function __construct( $str = '' ) {
|
||||
parent::__construct();
|
||||
$this->_str = $str;
|
||||
$this->_pos = 0;
|
||||
@@ -260,7 +260,7 @@ if ( ! class_exists( 'POMO_StringReader', false ) ) :
|
||||
* @param string $bytes
|
||||
* @return string
|
||||
*/
|
||||
function read( $bytes ) {
|
||||
public function read( $bytes ) {
|
||||
$data = $this->substr( $this->_str, $this->_pos, $bytes );
|
||||
$this->_pos += $bytes;
|
||||
if ( $this->strlen( $this->_str ) < $this->_pos ) {
|
||||
@@ -273,7 +273,7 @@ if ( ! class_exists( 'POMO_StringReader', false ) ) :
|
||||
* @param int $pos
|
||||
* @return int
|
||||
*/
|
||||
function seekto( $pos ) {
|
||||
public function seekto( $pos ) {
|
||||
$this->_pos = $pos;
|
||||
if ( $this->strlen( $this->_str ) < $this->_pos ) {
|
||||
$this->_pos = $this->strlen( $this->_str );
|
||||
@@ -284,14 +284,14 @@ if ( ! class_exists( 'POMO_StringReader', false ) ) :
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function length() {
|
||||
public function length() {
|
||||
return $this->strlen( $this->_str );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function read_all() {
|
||||
public function read_all() {
|
||||
return $this->substr( $this->_str, $this->_pos, $this->strlen( $this->_str ) );
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ if ( ! class_exists( 'POMO_CachedFileReader', false ) ) :
|
||||
/**
|
||||
* PHP5 constructor.
|
||||
*/
|
||||
function __construct( $filename ) {
|
||||
public function __construct( $filename ) {
|
||||
parent::__construct();
|
||||
$this->_str = file_get_contents( $filename );
|
||||
if ( false === $this->_str ) {
|
||||
@@ -348,7 +348,7 @@ if ( ! class_exists( 'POMO_CachedIntFileReader', false ) ) :
|
||||
*
|
||||
* @see POMO_CachedIntFileReader::__construct()
|
||||
*/
|
||||
function POMO_CachedIntFileReader( $filename ) {
|
||||
public function POMO_CachedIntFileReader( $filename ) {
|
||||
_deprecated_constructor( self::class, '5.4.0', static::class );
|
||||
self::__construct( $filename );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user