wp/wp-includes/class-wp-matchesmapregex.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-matchesmapregex.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-matchesmapregex.php	Mon Oct 14 18:28:13 2019 +0200
@@ -46,10 +46,10 @@
 	 * @param string $subject subject if regex
 	 * @param array  $matches data to use in map
 	 */
-	public function __construct($subject, $matches) {
+	public function __construct( $subject, $matches ) {
 		$this->_subject = $subject;
 		$this->_matches = $matches;
-		$this->output = $this->_map();
+		$this->output   = $this->_map();
 	}
 
 	/**
@@ -57,14 +57,12 @@
 	 *
 	 * static helper function to ease use
 	 *
-	 * @static
-	 *
 	 * @param string $subject subject
 	 * @param array  $matches data used for substitution
 	 * @return string
 	 */
-	public static function apply($subject, $matches) {
-		$oSelf = new WP_MatchesMapRegex($subject, $matches);
+	public static function apply( $subject, $matches ) {
+		$oSelf = new WP_MatchesMapRegex( $subject, $matches );
 		return $oSelf->output;
 	}
 
@@ -74,8 +72,8 @@
 	 * @return string
 	 */
 	private function _map() {
-		$callback = array($this, 'callback');
-		return preg_replace_callback($this->_pattern, $callback, $this->_subject);
+		$callback = array( $this, 'callback' );
+		return preg_replace_callback( $this->_pattern, $callback, $this->_subject );
 	}
 
 	/**
@@ -84,8 +82,8 @@
 	 * @param  array $matches preg_replace regexp matches
 	 * @return string
 	 */
-	public function callback($matches) {
-		$index = intval(substr($matches[0], 9, -1));
-		return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
+	public function callback( $matches ) {
+		$index = intval( substr( $matches[0], 9, -1 ) );
+		return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' );
 	}
 }