Code Duplication    Length = 24-24 lines in 2 locations

projects/packages/changelogger/src/Plugins/SemverVersioning.php 1 location

@@ 91-114 (lines=24) @@
88
	 * @return array
89
	 * @throws InvalidArgumentException If the `$extra` data is invalid.
90
	 */
91
	private function validateExtra( array $extra ) {
92
		$info = array();
93
94
		if ( isset( $extra['prerelease'] ) ) {
95
			try {
96
				$info['prerelease'] = $this->parseVersion( '0.0.0-' . $extra['prerelease'] )['prerelease'];
97
			} catch ( InvalidArgumentException $ex ) {
98
				throw new InvalidArgumentException( 'Invalid prerelease data' );
99
			}
100
		} else {
101
			$info['prerelease'] = null;
102
		}
103
		if ( isset( $extra['buildinfo'] ) ) {
104
			try {
105
				$info['buildinfo'] = $this->parseVersion( '0.0.0+' . $extra['buildinfo'] )['buildinfo'];
106
			} catch ( InvalidArgumentException $ex ) {
107
				throw new InvalidArgumentException( 'Invalid buildinfo data' );
108
			}
109
		} else {
110
			$info['buildinfo'] = null;
111
		}
112
113
		return $info;
114
	}
115
116
	/**
117
	 * Determine the next version given a current version and a set of changes.

projects/packages/changelogger/src/Plugins/WordpressVersioning.php 1 location

@@ 103-126 (lines=24) @@
100
	 * @return array
101
	 * @throws InvalidArgumentException If the `$extra` data is invalid.
102
	 */
103
	private function validateExtra( array $extra ) {
104
		$info = array();
105
106
		if ( isset( $extra['prerelease'] ) ) {
107
			try {
108
				$info['prerelease'] = $this->parseVersion( '0.0-' . $extra['prerelease'] )['prerelease'];
109
			} catch ( InvalidArgumentException $ex ) {
110
				throw new InvalidArgumentException( 'Invalid prerelease data' );
111
			}
112
		} else {
113
			$info['prerelease'] = null;
114
		}
115
		if ( isset( $extra['buildinfo'] ) ) {
116
			try {
117
				$info['buildinfo'] = $this->parseVersion( '0.0+' . $extra['buildinfo'] )['buildinfo'];
118
			} catch ( InvalidArgumentException $ex ) {
119
				throw new InvalidArgumentException( 'Invalid buildinfo data' );
120
			}
121
		} else {
122
			$info['buildinfo'] = null;
123
		}
124
125
		return $info;
126
	}
127
128
	/**
129
	 * Determine the next version given a current version and a set of changes.