Code Duplication    Length = 12-12 lines in 2 locations

core/Field/Complex_Field.php 1 location

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

core/Container/Container.php 1 location

@@ 513-524 (lines=12) @@
510
	 * @param Datastore_Interface $datastore
511
	 * @return object $this
512
	 **/
513
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
514
		if ( $set_as_default && ! $this->has_default_datastore() ) {
515
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
516
		}
517
		$this->datastore = $datastore;
518
		$this->has_default_datastore = $set_as_default;
519
520
		foreach ( $this->fields as $field ) {
521
			$field->set_datastore( $this->get_datastore(), true );
522
		}
523
		return $this;
524
	}
525
526
	/**
527
	 * Get the DataStore instance