Code Duplication    Length = 8-9 lines in 2 locations

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

@@ 52-59 (lines=8) @@
49
		$builder->setNamespace( __NAMESPACE__ )
50
			->setName( 'apply_filters' )
51
			->setFunction(
52
				function() {
53
					$current_args = func_get_args();
54
					foreach ( $this->mocked_filters as $filter ) {
55
						if ( array_slice( $filter, 0, -1 ) === $current_args ) {
56
							return array_pop( $filter );
57
						}
58
					}
59
				}
60
			);
61
		$this->apply_filters_mock = $builder->build();
62
		$this->apply_filters_mock->enable();

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();