Code Duplication    Length = 12-12 lines in 2 locations

core/Container/Container.php 1 location

@@ 498-509 (lines=12) @@
495
	 * @param Datastore_Interface $datastore
496
	 * @return object $this
497
	 **/
498
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
499
		if ( $set_as_default && ! $this->has_default_datastore() ) {
500
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
501
		}
502
		$this->datastore = $datastore;
503
		$this->has_default_datastore = $set_as_default;
504
505
		foreach ( $this->fields as $field ) {
506
			$field->set_datastore( $this->get_datastore(), true );
507
		}
508
		return $this;
509
	}
510
511
	/**
512
	 * Get the DataStore instance

core/Field/Complex_Field.php 1 location

@@ 195-206 (lines=12) @@
192
	 *
193
	 * @param Datastore_Interface $datastore
194
	 */
195
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
196
		if ( $set_as_default && ! $this->has_default_datastore() ) {
197
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
198
		}
199
		$this->datastore = $datastore;
200
		$this->has_default_datastore = $set_as_default;
201
202
		foreach ( $this->groups as $group ) {
203
			$group->set_datastore( $this->get_datastore(), true );
204
		}
205
		return $this;
206
	}
207
208
	/**
209
	 * Return a clone of a field with hierarchy settings applied