Code Duplication    Length = 12-12 lines in 2 locations

core/Container/Container.php 1 location

@@ 696-707 (lines=12) @@
693
	 * @param Datastore_Interface $datastore
694
	 * @return object $this
695
	 **/
696
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
697
		if ( $set_as_default && !$this->has_default_datastore() ) {
698
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
699
		}
700
		$this->datastore = $datastore;
701
		$this->has_default_datastore = $set_as_default;
702
703
		foreach ( $this->fields as $field ) {
704
			$field->set_datastore( $this->get_datastore(), true );
705
		}
706
		return $this;
707
	}
708
709
	/**
710
	 * Return the DataStore instance used by container fields

core/Field/Complex_Field.php 1 location

@@ 152-163 (lines=12) @@
149
	 *
150
	 * @param Datastore_Interface $datastore
151
	 */
152
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
153
		if ( $set_as_default && !$this->has_default_datastore() ) {
154
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
155
		}
156
		$this->datastore = $datastore;
157
		$this->has_default_datastore = $set_as_default;
158
159
		foreach ( $this->groups as $group ) {
160
			$group->set_datastore( $this->get_datastore(), true );
161
		}
162
		return $this;
163
	}
164
165
	/**
166
	 * Load the field value from an input array based on it's name.