Code Duplication    Length = 8-9 lines in 2 locations

packages/status/tests/php/test_Status.php 1 location

@@ 126-134 (lines=9) @@
123
		$builder->setNamespace( __NAMESPACE__ )
124
			->setName( $function_name )
125
			->setFunction(
126
				function() use ( &$args ) {
127
					$current_args = func_get_args();
128
129
					foreach ( $args as $arg ) {
130
						if ( array_slice( $arg, 0, -1 ) === $current_args ) {
131
							return array_pop( $arg );
132
						}
133
					}
134
				}
135
			);
136
137
		$mock = $builder->build();

packages/jitm/tests/php/test_JITM.php 1 location

@@ 100-107 (lines=8) @@
97
		$builder->setNamespace( __NAMESPACE__ )
98
			->setName( 'apply_filters' )
99
			->setFunction(
100
				function() {
101
					$current_args = func_get_args();
102
					foreach ( $this->mocked_filters as $filter ) {
103
						if ( array_slice( $filter, 0, -1 ) === $current_args ) {
104
							return array_pop( $filter );
105
						}
106
					}
107
				}
108
			);
109
		$this->apply_filters_mock = $builder->build();
110
		$this->apply_filters_mock->enable();