Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-matchesmapregex.php

    r42201 r42343  
    4747     * @param array  $matches data to use in map
    4848     */
    49     public function __construct($subject, $matches) {
     49    public function __construct( $subject, $matches ) {
    5050        $this->_subject = $subject;
    5151        $this->_matches = $matches;
    52         $this->output = $this->_map();
     52        $this->output   = $this->_map();
    5353    }
    5454
     
    6464     * @return string
    6565     */
    66     public static function apply($subject, $matches) {
    67         $oSelf = new WP_MatchesMapRegex($subject, $matches);
     66    public static function apply( $subject, $matches ) {
     67        $oSelf = new WP_MatchesMapRegex( $subject, $matches );
    6868        return $oSelf->output;
    6969    }
     
    7575     */
    7676    private function _map() {
    77         $callback = array($this, 'callback');
    78         return preg_replace_callback($this->_pattern, $callback, $this->_subject);
     77        $callback = array( $this, 'callback' );
     78        return preg_replace_callback( $this->_pattern, $callback, $this->_subject );
    7979    }
    8080
     
    8585     * @return string
    8686     */
    87     public function callback($matches) {
    88         $index = intval(substr($matches[0], 9, -1));
    89         return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
     87    public function callback( $matches ) {
     88        $index = intval( substr( $matches[0], 9, -1 ) );
     89        return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' );
    9090    }
    9191}
Note: See TracChangeset for help on using the changeset viewer.