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/translations.php

    r49184 r51919  
    2222                 * @return bool true on success, false if the entry doesn't have a key
    2323                 */
    24                 function add_entry( $entry ) {
     24                public function add_entry( $entry ) {
    2525                        if ( is_array( $entry ) ) {
    2626                                $entry = new Translation_Entry( $entry );
    … …  
    3838                 * @return bool
    3939                 */
    40                 function add_entry_or_merge( $entry ) {
     40                public function add_entry_or_merge( $entry ) {
    4141                        if ( is_array( $entry ) ) {
    4242                                $entry = new Translation_Entry( $entry );
    … …  
    6464                 * @param string $value header value, without trailing \n
    6565                 */
    66                 function set_header( $header, $value ) {
     66                public function set_header( $header, $value ) {
    6767                        $this->headers[ $header ] = $value;
    6868                }
    … …  
    7171                 * @param array $headers
    7272                 */
    73                 function set_headers( $headers ) {
     73                public function set_headers( $headers ) {
    7474                        foreach ( $headers as $header => $value ) {
    7575                                $this->set_header( $header, $value );
    … …  
    8080                 * @param string $header
    8181                 */
    82                 function get_header( $header ) {
     82                public function get_header( $header ) {
    8383                        return isset( $this->headers[ $header ] ) ? $this->headers[ $header ] : false;
    8484                }
    … …  
    8787                 * @param Translation_Entry $entry
    8888                 */
    89                 function translate_entry( &$entry ) {
     89                public function translate_entry( &$entry ) {
    9090                        $key = $entry->key();
    9191                        return isset( $this->entries[ $key ] ) ? $this->entries[ $key ] : false;
    … …  
    9797                 * @return string
    9898                 */
    99                 function translate( $singular, $context = null ) {
     99                public function translate( $singular, $context = null ) {
    100100                        $entry      = new Translation_Entry(
    101101                                array(
    … …  
    119119                 * @param int $count number of items
    120120                 */
    121                 function select_plural_form( $count ) {
     121                public function select_plural_form( $count ) {
    122122                        return 1 == $count ? 0 : 1;
    123123                }
    … …  
    126126                 * @return int
    127127                 */
    128                 function get_plural_forms_count() {
     128                public function get_plural_forms_count() {
    129129                        return 2;
    130130                }
    … …  
    136136                 * @param string $context
    137137                 */
    138                 function translate_plural( $singular, $plural, $count, $context = null ) {
     138                public function translate_plural( $singular, $plural, $count, $context = null ) {
    139139                        $entry              = new Translation_Entry(
    140140                                array(
    … …  
    162162                 * @return void
    163163                 */
    164                 function merge_with( &$other ) {
     164                public function merge_with( &$other ) {
    165165                        foreach ( $other->entries as $entry ) {
    166166                                $this->entries[ $entry->key() ] = $entry;
    … …  
    171171                 * @param object $other
    172172                 */
    173                 function merge_originals_with( &$other ) {
     173                public function merge_originals_with( &$other ) {
    174174                        foreach ( $other->entries as $entry ) {
    175175                                if ( ! isset( $this->entries[ $entry->key() ] ) ) {
    … …  
    191191                 * @param int $count
    192192                 */
    193                 function gettext_select_plural_form( $count ) {
     193                public function gettext_select_plural_form( $count ) {
    194194                        if ( ! isset( $this->_gettext_select_plural_form ) || is_null( $this->_gettext_select_plural_form ) ) {
    195195                                list( $nplurals, $expression )     = $this->nplurals_and_expression_from_header( $this->get_header( 'Plural-Forms' ) );
    … …  
    204204                 * @return array
    205205                 */
    206                 function nplurals_and_expression_from_header( $header ) {
     206                public function nplurals_and_expression_from_header( $header ) {
    207207                        if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {
    208208                                $nplurals   = (int) $matches[1];
    … …  
    221221                 * @param string $expression
    222222                 */
    223                 function make_plural_form_function( $nplurals, $expression ) {
     223                public function make_plural_form_function( $nplurals, $expression ) {
    224224                        try {
    225225                                $handler = new Plural_Forms( rtrim( $expression, ';' ) );
    … …  
    238238                 * @return string the expression with parentheses added
    239239                 */
    240                 function parenthesize_plural_exression( $expression ) {
     240                public function parenthesize_plural_exression( $expression ) {
    241241                        $expression .= ';';
    242242                        $res         = '';
    … …  
    267267                 * @return array
    268268                 */
    269                 function make_headers( $translation ) {
     269                public function make_headers( $translation ) {
    270270                        $headers = array();
    271271                        // Sometimes \n's are used instead of real new lines.
    … …  
    286286                 * @param string $value
    287287                 */
    288                 function set_header( $header, $value ) {
     288                public function set_header( $header, $value ) {
    289289                        parent::set_header( $header, $value );
    290290                        if ( 'Plural-Forms' === $header ) {
    … …  
    305305                public $headers = array();
    306306
    307                 function add_entry( $entry ) {
     307                public function add_entry( $entry ) {
    308308                        return true;
    309309                }
    … …  
    313313                 * @param string $value
    314314                 */
    315                 function set_header( $header, $value ) {
     315                public function set_header( $header, $value ) {
    316316                }
    317317
    … …  
    319319                 * @param array $headers
    320320                 */
    321                 function set_headers( $headers ) {
     321                public function set_headers( $headers ) {
    322322                }
    323323
    … …  
    326326                 * @return false
    327327                 */
    328                 function get_header( $header ) {
     328                public function get_header( $header ) {
    329329                        return false;
    330330                }
    … …  
    334334                 * @return false
    335335                 */
    336                 function translate_entry( &$entry ) {
     336                public function translate_entry( &$entry ) {
    337337                        return false;
    338338                }
    … …  
    342342                 * @param string $context
    343343                 */
    344                 function translate( $singular, $context = null ) {
     344                public function translate( $singular, $context = null ) {
    345345                        return $singular;
    346346                }
    … …  
    350350                 * @return bool
    351351                 */
    352                 function select_plural_form( $count ) {
     352                public function select_plural_form( $count ) {
    353353                        return 1 == $count ? 0 : 1;
    354354                }
    … …  
    357357                 * @return int
    358358                 */
    359                 function get_plural_forms_count() {
     359                public function get_plural_forms_count() {
    360360                        return 2;
    361361                }
    … …  
    367367                 * @param string $context
    368368                 */
    369                 function translate_plural( $singular, $plural, $count, $context = null ) {
     369                public function translate_plural( $singular, $plural, $count, $context = null ) {
    370370                        return 1 == $count ? $singular : $plural;
    371371                }
    … …  
    374374                 * @param object $other
    375375                 */
    376                 function merge_with( &$other ) {
     376                public function merge_with( &$other ) {
    377377                }
    378378        }
Note: See TracChangeset for help on using the changeset viewer.