Code Duplication    Length = 12-12 lines in 2 locations

core/Field/Complex_Field.php 1 location

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

core/Container/Container.php 1 location

@@ 549-560 (lines=12) @@
546
	 * @param Datastore_Interface $datastore
547
	 * @return object $this
548
	 **/
549
	public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) {
550
		if ( $set_as_default && ! $this->has_default_datastore() ) {
551
			return $this; // datastore has been overriden with a custom one - abort changing to a default one
552
		}
553
		$this->datastore = $datastore;
554
		$this->has_default_datastore = $set_as_default;
555
556
		foreach ( $this->fields as $field ) {
557
			$field->set_datastore( $this->get_datastore(), true );
558
		}
559
		return $this;
560
	}
561
562
	/**
563
	 * Get the DataStore instance