Changeset 55023 for trunk/tests/phpunit/includes/functions.php
- Timestamp:
- 12/31/2022 01:15:42 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/functions.php
r53688 r55023 72 72 * 73 73 * @param string $tag Unused. The name of the filter to build ID for. 74 * @param callable $ functionThe function to generate ID for.74 * @param callable $callback The function to generate ID for. 75 75 * @param int $priority Unused. The order in which the functions 76 76 * associated with a particular action are executed. 77 77 * @return string Unique function ID for usage as array key. 78 78 */ 79 function _test_filter_build_unique_id( $tag, $ function, $priority ) {80 if ( is_string( $ function) ) {81 return $ function;82 } 83 84 if ( is_object( $ function) ) {79 function _test_filter_build_unique_id( $tag, $callback, $priority ) { 80 if ( is_string( $callback ) ) { 81 return $callback; 82 } 83 84 if ( is_object( $callback ) ) { 85 85 // Closures are currently implemented as objects. 86 $ function = array( $function, '' );86 $callback = array( $callback, '' ); 87 87 } else { 88 $ function = (array) $function;89 } 90 91 if ( is_object( $ function[0] ) ) {88 $callback = (array) $callback; 89 } 90 91 if ( is_object( $callback[0] ) ) { 92 92 // Object class calling. 93 return spl_object_hash( $ function[0] ) . $function[1];94 } elseif ( is_string( $ function[0] ) ) {93 return spl_object_hash( $callback[0] ) . $callback[1]; 94 } elseif ( is_string( $callback[0] ) ) { 95 95 // Static calling. 96 return $ function[0] . '::' . $function[1];96 return $callback[0] . '::' . $callback[1]; 97 97 } 98 98 }
Note: See TracChangeset
for help on using the changeset viewer.