Skip to content

Commit 7bfa0b7

Browse files
authored
Merge pull request #117 from wp-cli/rename-run-method
Rename private `_run` method to `run_recursively`
2 parents 4824973 + 75a2025 commit 7bfa0b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/WP_CLI/SearchReplacer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public function __construct( $from, $to, $recurse_objects = false, $regex = fals
5454
* @return array The original array with all elements replaced as needed.
5555
*/
5656
public function run( $data, $serialised = false ) {
57-
return $this->_run( $data, $serialised );
57+
return $this->run_recursively( $data, $serialised );
5858
}
5959

6060
/**
6161
* @param int $recursion_level Current recursion depth within the original data.
6262
* @param array $visited_data Data that has been seen in previous recursion iterations.
6363
*/
64-
private function _run( $data, $serialised, $recursion_level = 0, $visited_data = array() ) {
64+
private function run_recursively( $data, $serialised, $recursion_level = 0, $visited_data = array() ) {
6565

6666
// some unseriliased data cannot be re-serialised eg. SimpleXMLElements
6767
try {
@@ -85,11 +85,11 @@ private function _run( $data, $serialised, $recursion_level = 0, $visited_data =
8585

8686
$unserialized = @unserialize( $data );
8787
if ( is_string( $data ) && false !== $unserialized ) {
88-
$data = $this->_run( $unserialized, true, $recursion_level + 1 );
88+
$data = $this->run_recursively( $unserialized, true, $recursion_level + 1 );
8989
} elseif ( is_array( $data ) ) {
9090
$keys = array_keys( $data );
9191
foreach ( $keys as $key ) {
92-
$data[ $key ] = $this->_run( $data[ $key ], false, $recursion_level + 1, $visited_data );
92+
$data[ $key ] = $this->run_recursively( $data[ $key ], false, $recursion_level + 1, $visited_data );
9393
}
9494
} elseif ( $this->recurse_objects && ( is_object( $data ) || $data instanceof \__PHP_Incomplete_Class ) ) {
9595
if ( $data instanceof \__PHP_Incomplete_Class ) {
@@ -102,7 +102,7 @@ private function _run( $data, $serialised, $recursion_level = 0, $visited_data =
102102
);
103103
} else {
104104
foreach ( $data as $key => $value ) {
105-
$data->$key = $this->_run( $value, false, $recursion_level + 1, $visited_data );
105+
$data->$key = $this->run_recursively( $value, false, $recursion_level + 1, $visited_data );
106106
}
107107
}
108108
} elseif ( is_string( $data ) ) {

0 commit comments

Comments
 (0)