Code Duplication    Length = 12-12 lines in 2 locations

core/Field/Complex_Field.php 1 location

@@ 153-164 (lines=12) @@
150
	 *
151
	 * @param Datastore_Interface $datastore
152
	 */
153
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
154
		if ( $set_as_default && ! $this->has_default_datastore() ) {
155
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
156
		}
157
		$this->datastore = $datastore;
158
		$this->has_default_datastore = $set_as_default;
159
160
		foreach ( $this->groups as $group ) {
161
			$group->set_datastore( $this->get_datastore(), true );
162
		}
163
		return $this;
164
	}
165
166
	/**
167
	 * Retrieve all groups of fields.

core/Container/Container.php 1 location

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