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 self                $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

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