| @@ 98-107 (lines=10) @@ | ||
| 95 | * @return $this |
|
| 96 | * @throws InvalidArgumentException If an argument is invalid. |
|
| 97 | */ |
|
| 98 | public function setEntries( array $entries ) { |
|
| 99 | foreach ( $entries as $i => $entry ) { |
|
| 100 | if ( ! $entry instanceof ChangelogEntry ) { |
|
| 101 | $what = is_object( $entry ) ? get_class( $entry ) : gettype( $entry ); |
|
| 102 | throw new InvalidArgumentException( __METHOD__ . ": Expected a ChangelogEntry, got $what at index $i" ); |
|
| 103 | } |
|
| 104 | } |
|
| 105 | $this->entries = array_values( $entries ); |
|
| 106 | return $this; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Get the latest changelog entry. |
|
| @@ 222-231 (lines=10) @@ | ||
| 219 | * @return $this |
|
| 220 | * @throws InvalidArgumentException If an argument is invalid. |
|
| 221 | */ |
|
| 222 | public function setChanges( array $changes ) { |
|
| 223 | foreach ( $changes as $i => $change ) { |
|
| 224 | if ( ! $change instanceof ChangeEntry ) { |
|
| 225 | $what = is_object( $change ) ? get_class( $change ) : gettype( $change ); |
|
| 226 | throw new InvalidArgumentException( __METHOD__ . ": Expected a ChangeEntry, got $what at index $i" ); |
|
| 227 | } |
|
| 228 | } |
|
| 229 | $this->changes = array_values( $changes ); |
|
| 230 | return $this; |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * Add a new change. |
|