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