Code Duplication    Length = 10-12 lines in 2 locations

core/Field/Complex_Field.php 1 location

@@ 159-168 (lines=10) @@
156
	 * @param  boolean             $set_as_default
157
	 * @return Field               $this
158
	 */
159
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
160
		if ( $set_as_default && ! $this->has_default_datastore() ) {
161
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
162
		}
163
		$this->datastore = $datastore;
164
		$this->has_default_datastore = $set_as_default;
165
166
		$this->update_child_datastore( $this->get_datastore(), true );
167
		return $this;
168
	}
169
170
	/**
171
	 * Propagate the datastore down the hierarchy

core/Container/Container.php 1 location

@@ 590-601 (lines=12) @@
587
	 * @param Datastore_Interface $datastore
588
	 * @return Container $this
589
	 */
590
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
591
		if ( $set_as_default && ! $this->has_default_datastore() ) {
592
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
593
		}
594
		$this->datastore = $datastore;
595
		$this->has_default_datastore = $set_as_default;
596
597
		foreach ( $this->fields as $field ) {
598
			$field->set_datastore( $this->get_datastore(), true );
599
		}
600
		return $this;
601
	}
602
603
	/**
604
	 * Get the DataStore instance