Code Duplication    Length = 10-10 lines in 2 locations

projects/packages/changelogger/lib/Changelog.php 1 location

@@ 99-108 (lines=10) @@
96
	 * @return $this
97
	 * @throws InvalidArgumentException If an argument is invalid.
98
	 */
99
	public function setEntries( array $entries ) {
100
		foreach ( $entries as $i => $entry ) {
101
			if ( ! $entry instanceof ChangelogEntry ) {
102
				$what = is_object( $entry ) ? get_class( $entry ) : gettype( $entry );
103
				throw new InvalidArgumentException( __METHOD__ . ": Expected a ChangelogEntry, got $what at index $i" );
104
			}
105
		}
106
		$this->entries = array_values( $entries );
107
		return $this;
108
	}
109
110
	/**
111
	 * Get the latest changelog entry.

projects/packages/changelogger/lib/ChangelogEntry.php 1 location

@@ 227-236 (lines=10) @@
224
	 * @return $this
225
	 * @throws InvalidArgumentException If an argument is invalid.
226
	 */
227
	public function setChanges( array $changes ) {
228
		foreach ( $changes as $i => $change ) {
229
			if ( ! $change instanceof ChangeEntry ) {
230
				$what = is_object( $change ) ? get_class( $change ) : gettype( $change );
231
				throw new InvalidArgumentException( __METHOD__ . ": Expected a ChangeEntry, got $what at index $i" );
232
			}
233
		}
234
		$this->changes = array_values( $changes );
235
		return $this;
236
	}
237
238
	/**
239
	 * Add a new change.