Completed
Push — milestone/2_0/react-ui ( 5b168c...b737dc )
by
unknown
04:15
created

Container_Condition_Provider   C

Complexity

Total Complexity 11

Size/Duplication

Total Lines 313
Duplicated Lines 10.22 %

Coupling/Cohesion

Components 1
Dependencies 25

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 32
loc 313
ccs 0
cts 157
cp 0
rs 5
c 0
b 0
f 0
wmc 11
lcom 1
cbo 25

11 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
B install_conditions() 32 122 1
B install_comparers() 0 41 1
A install_translators() 0 9 1
A install_container_conditions() 0 19 1
A filter_post_meta_container_static_condition_types() 0 6 1
A filter_post_meta_container_dynamic_condition_types() 0 6 1
A filter_term_meta_container_static_condition_types() 0 6 1
A filter_term_meta_container_dynamic_condition_types() 0 6 1
A filter_user_meta_container_static_condition_types() 0 6 1
A filter_user_meta_container_dynamic_condition_types() 0 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Carbon_Fields\Provider;
4
5
use Carbon_Fields\Pimple\Container as PimpleContainer;
6
use Carbon_Fields\Pimple\ServiceProviderInterface;
7
use Carbon_Fields\Container\Condition\Factory as ConditionFactory;
8
use Carbon_Fields\Container\Fulfillable\Fulfillable_Collection;
9
10
class Container_Condition_Provider implements ServiceProviderInterface {
11
12
	/**
13
	 * Install dependencies in IoC container
14
	 *
15
	 * @param  PimpleContainer $ioc
16
	 */
17
	public function register( PimpleContainer $ioc ) {
18
		$this->install_conditions( $ioc );
19
		$this->install_comparers( $ioc );
1 ignored issue
show
Unused Code introduced by
The call to the method Carbon_Fields\Provider\C...er::install_comparers() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
20
		$this->install_translators( $ioc );
1 ignored issue
show
Unused Code introduced by
The call to the method Carbon_Fields\Provider\C...::install_translators() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
21
		$this->install_container_conditions( $ioc );
22
	}
23
24
	/**
25
	 * Install all codition types and the condition factory
26
	 *
27
	 * @param  PimpleContainer $ioc
28
	 */
29
	protected function install_conditions( $ioc ) {
30
		$ioc['container_condition_factory'] = function( $ioc ) {
31
			return new ConditionFactory( $ioc['container_conditions'] );
32
		};
33
34
		$ioc['container_condition_fulfillable_collection'] = $ioc->factory( function( $ioc ) {
35
			return new Fulfillable_Collection( $ioc['container_condition_factory'], $ioc['container_condition_translator_array'] );
36
		} );
37
38
		$ioc['container_conditions'] = function( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
			return new PimpleContainer();
40
		};
41
42
		$cc_ioc = $ioc['container_conditions'];
43
44
		$cc_ioc['boolean'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
			$condition = new \Carbon_Fields\Container\Condition\Boolean_Condition();
46
			$condition->set_comparers( array(
47
				$ioc['container_condition_comparers']['equality'],
48
			) );
49
			return $condition;
50
		} );
51
52
		$cc_ioc['post_id'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"boolean":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
			$condition = new \Carbon_Fields\Container\Condition\Post_ID_Condition();
54
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
55
			return $condition;
56
		} );
57
		$cc_ioc['post_parent_id'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_id":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
			$condition = new \Carbon_Fields\Container\Condition\Post_Parent_ID_Condition();
59
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
60
			return $condition;
61
		} );
62
		$cc_ioc['post_type'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_parent_id":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
			$condition = new \Carbon_Fields\Container\Condition\Post_Type_Condition();
64
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['nonscalar'] );
65
			return $condition;
66
		} );
67
		$cc_ioc['post_format'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_type":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
			$condition = new \Carbon_Fields\Container\Condition\Post_Format_Condition();
69
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['nonscalar'] );
70
			return $condition;
71
		} );
72
		$cc_ioc['post_level'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_format":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
			$condition = new \Carbon_Fields\Container\Condition\Post_Level_Condition();
74
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
75
			return $condition;
76
		} );
77
		$cc_ioc['post_template'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_level":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
78
			$condition = new \Carbon_Fields\Container\Condition\Post_Template_Condition();
79
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['nonscalar'] );
80
			return $condition;
81
		} );
82
		$cc_ioc['post_term'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_template":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
83
			$condition = new \Carbon_Fields\Container\Condition\Post_Term_Condition( $ioc['wp_toolset'] );
84
			$condition->set_comparers( array(
85
				// Only support the custom comparer as this condition has it's own comparison methods
86
				$ioc['container_condition_comparers']['custom'],
87
			) );
88
			return $condition;
89
		} );
90
91
		$cc_ioc['term'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"post_term":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
92
			$condition = new \Carbon_Fields\Container\Condition\Term_Condition( $ioc['wp_toolset'] );
93
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['nonscalar'] );
94
			return $condition;
95
		} );
96
		$cc_ioc['term_taxonomy'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"term":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
97
			$condition = new \Carbon_Fields\Container\Condition\Term_Taxonomy_Condition();
98
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['nonscalar'] );
99
			return $condition;
100
		} );
101
		$cc_ioc['term_level'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"term_taxonomy":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
102
			$condition = new \Carbon_Fields\Container\Condition\Term_Level_Condition();
103
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
104
			return $condition;
105
		} );
106
107
		$cc_ioc['user_id'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"term_level":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
108
			$condition = new \Carbon_Fields\Container\Condition\User_ID_Condition();
109
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
110
			return $condition;
111
		} );
112 View Code Duplication
		$cc_ioc['user_role'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
2 ignored issues
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"user_id":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
113
			$condition = new \Carbon_Fields\Container\Condition\User_Role_Condition();
114
			$condition->set_comparers( array(
115
				// Only support the custom comparer as this condition has it's own comparison methods
116
				$ioc['container_condition_comparers']['custom'],
117
			) );
118
			return $condition;
119
		} );
120 View Code Duplication
		$cc_ioc['user_capabiltiy'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
2 ignored issues
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"user_role":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
121
			$condition = new \Carbon_Fields\Container\Condition\User_Capability_Condition();
122
			$condition->set_comparers( array(
123
				// Only support the custom comparer as this condition has it's own comparison methods
124
				$ioc['container_condition_comparers']['custom'],
125
			) );
126
			return $condition;
127
		} );
128
129
		$cc_ioc['current_user_id'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
1 ignored issue
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"user_capabiltiy":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
130
			$condition = new \Carbon_Fields\Container\Condition\Current_User_ID_Condition();
131
			$condition->set_comparers( $ioc['container_condition_comparer_collections']['generic'] );
132
			return $condition;
133
		} );
134 View Code Duplication
		$cc_ioc['current_user_role'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
2 ignored issues
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"current_user_id":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
135
			$condition = new \Carbon_Fields\Container\Condition\Current_User_Role_Condition();
136
			$condition->set_comparers( array(
137
				// Only support the custom comparer as this condition has it's own comparison methods
138
				$ioc['container_condition_comparers']['custom'],
139
			) );
140
			return $condition;
141
		} );
142 View Code Duplication
		$cc_ioc['current_user_capability'] = $cc_ioc->factory( function( $cc_ioc ) use ( $ioc ) {
2 ignored issues
show
Bug introduced by
The method factory cannot be called on $cc_ioc (of type array<string,?,{"current_user_role":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
The parameter $cc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
143
			$condition = new \Carbon_Fields\Container\Condition\Current_User_Capability_Condition();
144
			$condition->set_comparers( array(
145
				// Only support the custom comparer as this condition has it's own comparison methods
146
				$ioc['container_condition_comparers']['custom'],
147
			) );
148
			return $condition;
149
		} );
150
	}
151
152
	/**
153
	 * Install all condition comparers
154
	 *
155
	 * @param  PimpleContainer $ioc
156
	 */
157
	protected function install_comparers( $ioc ) {
158
		$ioc['container_condition_comparers'] = function( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
159
			return new PimpleContainer();
160
		};
161
162
		$ioc['container_condition_comparers']['equality'] = function() {
163
			return new \Carbon_Fields\Container\Condition\Comparer\Equality_Comparer();
164
		};
165
166
		$ioc['container_condition_comparers']['contain'] = function() {
167
			return new \Carbon_Fields\Container\Condition\Comparer\Contain_Comparer();
168
		};
169
170
		$ioc['container_condition_comparers']['scalar'] = function() {
171
			return new \Carbon_Fields\Container\Condition\Comparer\Scalar_Comparer();
172
		};
173
174
		$ioc['container_condition_comparers']['custom'] = function() {
175
			return new \Carbon_Fields\Container\Condition\Comparer\Custom_Comparer();
176
		};
177
178
		$ioc['container_condition_comparer_collections'] = function( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
179
			return new PimpleContainer();
180
		};
181
182
		$ioc['container_condition_comparer_collections']['generic'] = function( $cccc_ioc ) use ( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $cccc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
183
			return array(
184
				$ioc['container_condition_comparers']['equality'],
185
				$ioc['container_condition_comparers']['contain'],
186
				$ioc['container_condition_comparers']['scalar'],
187
				$ioc['container_condition_comparers']['custom'],
188
			);
189
		};
190
		$ioc['container_condition_comparer_collections']['nonscalar'] = function( $cccc_ioc ) use ( $ioc ) {
0 ignored issues
show
Unused Code introduced by
The parameter $cccc_ioc is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
191
			return array(
192
				$ioc['container_condition_comparers']['equality'],
193
				$ioc['container_condition_comparers']['contain'],
194
				$ioc['container_condition_comparers']['custom'],
195
			);
196
		};
197
	}
198
199
	/**
200
	 * Install all codition translators
201
	 *
202
	 * @param  PimpleContainer $ioc
203
	 */
204
	protected static function install_translators( $ioc ) {
205
		$ioc['container_condition_translator_array'] = function( $ioc ) {
206
			return new \Carbon_Fields\Container\Fulfillable\Translator\Array_Translator( $ioc['container_condition_factory'] );
207
		};
208
209
		$ioc['container_condition_translator_json'] = function( $ioc ) {
210
			return new \Carbon_Fields\Container\Fulfillable\Translator\Json_Translator( $ioc['container_condition_factory'] );
211
		};
212
	}
213
214
	/**
215
	 * Install all container coditions
216
	 *
217
	 * @param  PimpleContainer $ioc
218
	 */
219
	protected function install_container_conditions( $ioc ) {
220
		// add current_user_* static condition types to all containers
221
		add_filter( 'carbon_fields_container_static_condition_types', function( $condition_types, $container_type, $container ) {
222
			return array_merge(
223
				$condition_types,
224
				array( 'current_user_id', 'current_user_role', 'current_user_capability' )
225
			);
226
		}, 10, 3 );
227
228
		// add container-specific conditions
229
		add_filter( 'carbon_fields_post_meta_container_static_condition_types', array( $this, 'filter_post_meta_container_static_condition_types' ), 10, 3 );
230
		add_filter( 'carbon_fields_post_meta_container_dynamic_condition_types', array( $this, 'filter_post_meta_container_dynamic_condition_types' ), 10, 3 );
231
232
		add_filter( 'carbon_fields_term_meta_container_static_condition_types', array( $this, 'filter_term_meta_container_static_condition_types' ), 10, 3 );
233
		add_filter( 'carbon_fields_term_meta_container_dynamic_condition_types', array( $this, 'filter_term_meta_container_dynamic_condition_types' ), 10, 3 );
234
235
		add_filter( 'carbon_fields_user_meta_container_static_condition_types', array( $this, 'filter_user_meta_container_static_condition_types' ), 10, 3 );
236
		add_filter( 'carbon_fields_user_meta_container_dynamic_condition_types', array( $this, 'filter_user_meta_container_dynamic_condition_types' ), 10, 3 );
237
	}
238
239
	/**
240
	 * Filter the Post_Meta_Container static condition types
241
	 *
242
	 * @param  array<string>                     $condition_types
243
	 * @param  Carbon_Fields\Container\Container $container
244
	 * @return array<string>
245
	 */
246
	public function filter_post_meta_container_static_condition_types( $condition_types, $container_type, $container ) {
247
		return array_merge(
248
			$condition_types,
249
			array( 'post_id', 'post_type' )
250
		);
251
	}
252
253
	/**
254
	 * Filter the Post_Meta_Container dynamic condition types
255
	 *
256
	 * @param  array<string>                     $condition_types
257
	 * @param  Carbon_Fields\Container\Container $container
258
	 * @return array<string>
259
	 */
260
	public function filter_post_meta_container_dynamic_condition_types( $condition_types, $container_type, $container ) {
261
		return array_merge(
262
			$condition_types,
263
			array( 'post_parent_id', 'post_format', 'post_level', 'post_template', 'post_term' )
264
		);
265
	}
266
267
	/**
268
	 * Filter the Term_Meta_Container static condition types
269
	 *
270
	 * @param  array<string>                     $condition_types
271
	 * @param  Carbon_Fields\Container\Container $container
272
	 * @return array<string>
273
	 */
274
	public function filter_term_meta_container_static_condition_types( $condition_types, $container_type, $container ) {
275
		return array_merge(
276
			$condition_types,
277
			array( 'term', 'term_taxonomy' )
278
		);
279
	}
280
281
	/**
282
	 * Filter the Term_Meta_Container dynamic condition types
283
	 *
284
	 * @param  array<string>                     $condition_types
285
	 * @param  Carbon_Fields\Container\Container $container
286
	 * @return array<string>
287
	 */
288
	public function filter_term_meta_container_dynamic_condition_types( $condition_types, $container_type, $container ) {
289
		return array_merge(
290
			$condition_types,
291
			array( 'term_level' )
292
		);
293
	}
294
295
	/**
296
	 * Filter the User_Meta_Container static condition types
297
	 *
298
	 * @param  array<string>                     $condition_types
299
	 * @param  Carbon_Fields\Container\Container $container
300
	 * @return array<string>
301
	 */
302
	public function filter_user_meta_container_static_condition_types( $condition_types, $container_type, $container ) {
303
		return array_merge(
304
			$condition_types,
305
			array( 'user_id', 'user_capability' )
306
		);
307
	}
308
309
	/**
310
	 * Filter the User_Meta_Container dynamic condition types
311
	 *
312
	 * @param  array<string>                     $condition_types
313
	 * @param  Carbon_Fields\Container\Container $container
314
	 * @return array<string>
315
	 */
316
	public function filter_user_meta_container_dynamic_condition_types( $condition_types, $container_type, $container ) {
317
		return array_merge(
318
			$condition_types,
319
			array( 'user_role' )
320
		);
321
	}
322
}
323