Code Duplication    Length = 15-19 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

@@ 181-199 (lines=19) @@
178
	 *
179
	 * @return bool True if the container is allowed to be attached
180
	 **/
181
	public function is_valid_attach_for_request() {
182
		global $pagenow;
183
184
		if ( $pagenow !== 'post.php' && $pagenow !== 'post-new.php' ) {
185
			return false;
186
		}
187
188
		$environment = $this->get_environment_for_request();
189
		if ( ! $environment['post_type'] ) {
190
			return false;
191
		}
192
193
		$static_conditions_collection = $this->conditions_collection->evaluate( $this->get_dynamic_conditions(), true );
194
		if ( ! $static_conditions_collection->is_fulfilled( $environment ) ) {
195
			return false;
196
		}
197
198
		return true;
199
	}
200
201
	/**
202
	 * Get environment array for object id

core/Container/Term_Meta_Container.php 1 location

@@ 121-135 (lines=15) @@
118
	 *
119
	 * @return bool True if the container is allowed to be attached
120
	 **/
121
	public function is_valid_attach_for_request() {
122
		global $pagenow;
123
124
		if ( $pagenow !== 'edit-tags.php' && $pagenow !== 'term.php' ) {
125
			return false;
126
		}
127
128
		$environment = $this->get_environment_for_request();
129
		$static_conditions_collection = $this->conditions_collection->evaluate( $this->get_dynamic_conditions(), true );
130
		if ( ! $static_conditions_collection->is_fulfilled( $environment ) ) {
131
			return false;
132
		}
133
134
		return true;
135
	}
136
137
	/**
138
	 * Get environment array for object id