Code Duplication    Length = 12-12 lines in 3 locations

packages/autoloader/src/AutoloadGenerator.php 3 locations

@@ 159-170 (lines=12) @@
156
				$installPath = substr( $installPath, 0, -strlen( '/' . $package->getTargetDir() ) );
157
			}
158
159
			if ( 'psr-4' === $type && isset( $autoload['psr-4'] ) && is_array( $autoload['psr-4'] ) ) {
160
				foreach ( $autoload['psr-4'] as $namespace => $paths ) {
161
					$paths = is_array( $paths ) ? $paths : array( $paths );
162
					foreach ( $paths as $path ) {
163
						$relativePath              = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
164
						$autoloads[ $namespace ][] = array(
165
							'path'    => $relativePath,
166
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
167
						);
168
					}
169
				}
170
			}
171
172
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
173
				foreach ( $autoload['classmap'] as $paths ) {
@@ 172-183 (lines=12) @@
169
				}
170
			}
171
172
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
173
				foreach ( $autoload['classmap'] as $paths ) {
174
					$paths = is_array( $paths ) ? $paths : array( $paths );
175
					foreach ( $paths as $path ) {
176
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
177
						$autoloads[]  = array(
178
							'path'    => $relativePath,
179
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
180
						);
181
					}
182
				}
183
			}
184
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
185
				foreach ( $autoload['files'] as $file_id => $paths ) {
186
					$paths = is_array( $paths ) ? $paths : array( $paths );
@@ 184-195 (lines=12) @@
181
					}
182
				}
183
			}
184
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
185
				foreach ( $autoload['files'] as $file_id => $paths ) {
186
					$paths = is_array( $paths ) ? $paths : array( $paths );
187
					foreach ( $paths as $path ) {
188
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
189
						$autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
190
							'path'    => $relativePath,
191
							'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
192
						);
193
					}
194
				}
195
			}
196
		}
197
198
		return $autoloads;